Remove shared item

master
Bob Mottram 2019-08-26 10:31:45 +01:00
parent 70b41eb3c7
commit 6daf95d70b
1 changed files with 21 additions and 0 deletions

View File

@ -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]