From 343c9771bb704afde68f3f0c9c92893da2e14a8e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 22 Oct 2021 10:10:23 +0100 Subject: [PATCH] Use function to generate actor url --- daemon.py | 4 ++-- inbox.py | 2 +- theme.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index 9bbbf2c09..e751c4561 100644 --- a/daemon.py +++ b/daemon.py @@ -3497,7 +3497,7 @@ class PubServer(BaseHTTPRequestHandler): shareActor = shareActor.split('&')[0] adminNickname = getConfigParam(baseDir, 'admin') adminActor = \ - httpPrefix + '://' + domainFull + '/users' + adminNickname + localActorUrl(httpPrefix, domainFull, adminNickname) actor = originPathStr actorNickname = getNicknameFromActor(actor) if actor == shareActor or actor == adminActor or \ @@ -3564,7 +3564,7 @@ class PubServer(BaseHTTPRequestHandler): shareActor = shareActor.split('&')[0] adminNickname = getConfigParam(baseDir, 'admin') adminActor = \ - httpPrefix + '://' + domainFull + '/users' + adminNickname + localActorUrl(httpPrefix, domainFull, adminNickname) actor = originPathStr actorNickname = getNicknameFromActor(actor) if actor == shareActor or actor == adminActor or \ diff --git a/inbox.py b/inbox.py index 8df064200..0b278ac05 100644 --- a/inbox.py +++ b/inbox.py @@ -172,7 +172,7 @@ def _updateCachedHashtagSwarm(baseDir: str, nickname: str, domain: str, else: print('WARN: no modified date for ' + str(lastModified)) if saveSwarm: - actor = httpPrefix + '://' + domainFull + '/users/' + nickname + actor = localActorUrl(httpPrefix, domainFull, nickname) newSwarmStr = htmlHashTagSwarm(baseDir, actor, translate) if newSwarmStr: try: diff --git a/theme.py b/theme.py index 9f1935595..0138ba653 100644 --- a/theme.py +++ b/theme.py @@ -15,6 +15,7 @@ from utils import getImageExtensions from utils import copytree from utils import acctDir from utils import dangerousSVG +from utils import localActorUrl from shutil import copyfile from shutil import make_archive from shutil import unpack_archive @@ -736,7 +737,7 @@ def setNewsAvatar(baseDir: str, name: str, if not os.path.isfile(newFilename): return avatarFilename = \ - httpPrefix + '://' + domainFull + '/users/' + nickname + '.png' + localActorUrl(httpPrefix, domainFull, nickname) + '.png' avatarFilename = avatarFilename.replace('/', '-') filename = baseDir + '/cache/avatars/' + avatarFilename