Use function to generate actor url

main
Bob Mottram 2021-10-22 10:10:23 +01:00
parent 88c4b14ca3
commit 343c9771bb
3 changed files with 5 additions and 4 deletions

View File

@ -3497,7 +3497,7 @@ class PubServer(BaseHTTPRequestHandler):
shareActor = shareActor.split('&')[0] shareActor = shareActor.split('&')[0]
adminNickname = getConfigParam(baseDir, 'admin') adminNickname = getConfigParam(baseDir, 'admin')
adminActor = \ adminActor = \
httpPrefix + '://' + domainFull + '/users' + adminNickname localActorUrl(httpPrefix, domainFull, adminNickname)
actor = originPathStr actor = originPathStr
actorNickname = getNicknameFromActor(actor) actorNickname = getNicknameFromActor(actor)
if actor == shareActor or actor == adminActor or \ if actor == shareActor or actor == adminActor or \
@ -3564,7 +3564,7 @@ class PubServer(BaseHTTPRequestHandler):
shareActor = shareActor.split('&')[0] shareActor = shareActor.split('&')[0]
adminNickname = getConfigParam(baseDir, 'admin') adminNickname = getConfigParam(baseDir, 'admin')
adminActor = \ adminActor = \
httpPrefix + '://' + domainFull + '/users' + adminNickname localActorUrl(httpPrefix, domainFull, adminNickname)
actor = originPathStr actor = originPathStr
actorNickname = getNicknameFromActor(actor) actorNickname = getNicknameFromActor(actor)
if actor == shareActor or actor == adminActor or \ if actor == shareActor or actor == adminActor or \

View File

@ -172,7 +172,7 @@ def _updateCachedHashtagSwarm(baseDir: str, nickname: str, domain: str,
else: else:
print('WARN: no modified date for ' + str(lastModified)) print('WARN: no modified date for ' + str(lastModified))
if saveSwarm: if saveSwarm:
actor = httpPrefix + '://' + domainFull + '/users/' + nickname actor = localActorUrl(httpPrefix, domainFull, nickname)
newSwarmStr = htmlHashTagSwarm(baseDir, actor, translate) newSwarmStr = htmlHashTagSwarm(baseDir, actor, translate)
if newSwarmStr: if newSwarmStr:
try: try:

View File

@ -15,6 +15,7 @@ from utils import getImageExtensions
from utils import copytree from utils import copytree
from utils import acctDir from utils import acctDir
from utils import dangerousSVG from utils import dangerousSVG
from utils import localActorUrl
from shutil import copyfile from shutil import copyfile
from shutil import make_archive from shutil import make_archive
from shutil import unpack_archive from shutil import unpack_archive
@ -736,7 +737,7 @@ def setNewsAvatar(baseDir: str, name: str,
if not os.path.isfile(newFilename): if not os.path.isfile(newFilename):
return return
avatarFilename = \ avatarFilename = \
httpPrefix + '://' + domainFull + '/users/' + nickname + '.png' localActorUrl(httpPrefix, domainFull, nickname) + '.png'
avatarFilename = avatarFilename.replace('/', '-') avatarFilename = avatarFilename.replace('/', '-')
filename = baseDir + '/cache/avatars/' + avatarFilename filename = baseDir + '/cache/avatars/' + avatarFilename