From 6daf95d70bd5bd1639f56cdd17941487618cd048 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 26 Aug 2019 10:31:45 +0100 Subject: [PATCH] Remove shared item --- daemon.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/daemon.py b/daemon.py index 65a63673..395239a3 100644 --- a/daemon.py +++ b/daemon.py @@ -106,6 +106,7 @@ from shares import getSharesFeedForPerson from shares import outboxShareUpload from shares import outboxUndoShareUpload from shares import addShare +from shares import removeShare from utils import getNicknameFromActor from utils import getDomainFromActor from utils import getStatusNumber @@ -2541,6 +2542,26 @@ class PubServer(BaseHTTPRequestHandler): self.server.POSTbusy=False return + # removes a shared item + if authorized and self.path.endswith('/rmshare'): + originPathStr=self.path.split('/rmshare')[0] + length = int(self.headers['Content-length']) + removeShareConfirmParams=self.rfile.read(length).decode('utf-8') + if '&submitYes=' in removeShareConfirmParams: + removeShareConfirmParams=removeShareConfirmParams.replace('%3A',':').replace('%2F','/') + shareActor=removeShareConfirmParams.split('actor=')[1] + if '&' in shareActor: + shareActor=shareActor.split('&')[0] + shareName=removeShareConfirmParams.split('shareName=')[1] + if '&' in shareName: + shareName=shareName.split('&')[0] + shareNickname=getNicknameFromActor(shareActor) + shareDomain,sharePort=getDomainFromActor(shareActor) + removeShare(self.server.baseDir,shareNickname,shareDomain,shareName) + self._redirect_headers(originPathStr,cookie) + self.server.POSTbusy=False + return + # decision to follow in the web interface is confirmed if authorized and self.path.endswith('/followconfirm'): originPathStr=self.path.split('/followconfirm')[0]