diff --git a/daemon.py b/daemon.py index 670ee4f1..7cf42ff9 100644 --- a/daemon.py +++ b/daemon.py @@ -3164,7 +3164,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.session, self.server.baseDir, deleteUrl, self.server.httpPrefix, __version__, self.server.cachedWebfingers, - self.server.personCache) + self.server.personCache, callingDomain) if deleteStr: self._set_headers('text/html', len(deleteStr), cookie, callingDomain) diff --git a/webinterface.py b/webinterface.py index d7e86d6c..b57c388c 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5112,7 +5112,8 @@ def htmlDeletePost(recentPostsCache: {}, maxRecentPosts: int, translate, pageNumber: int, session, baseDir: str, messageId: str, httpPrefix: str, projectVersion: str, - wfRequest: {}, personCache: {}) -> str: + wfRequest: {}, personCache: {}, + callingDomain: str) -> str: """Shows a screen asking to confirm the deletion of a post """ if '/statuses/' not in messageId: @@ -5121,6 +5122,10 @@ def htmlDeletePost(recentPostsCache: {}, maxRecentPosts: int, actor = messageId.split('/statuses/')[0] nickname = getNicknameFromActor(actor) domain, port = getDomainFromActor(actor) + domainFull = domain + if port: + if port != 80 and port != 443: + domainFull = domain + ':' + str(port) postFilename = locatePost(baseDir, nickname, domain, messageId) if not postFilename: @@ -5157,7 +5162,16 @@ def htmlDeletePost(recentPostsCache: {}, maxRecentPosts: int, deletePostStr += \ ' <p class="followText">' + \ translate['Delete this post?'] + '</p>' - deletePostStr += ' <form method="POST" action="' + actor + '/rmpost">' + postActor = actor + if callingDomain not in actor and domainFull in actor: + if callingDomain.endswith('.onion') or \ + callingDomain.endswith('.i2p'): + postActor = \ + 'http://' + callingDomain + actor.split(domainFull)[1] + print('Changed POST domain from ' + actor + ' to ' + postActor) + + deletePostStr += \ + ' <form method="POST" action="' + postActor + '/rmpost">' deletePostStr += \ ' <input type="hidden" name="pageNumber" value="' + \ str(pageNumber) + '">'