Users paths

merge-requests/30/head
Bob Mottram 2021-07-29 18:14:33 +01:00
parent da3a2672ef
commit 485b537fe7
3 changed files with 10 additions and 2 deletions

View File

@ -1725,6 +1725,10 @@ if args.followers:
nickname = args.followers.split('/u/')[1] nickname = args.followers.split('/u/')[1]
nickname = nickname.replace('\n', '').replace('\r', '') nickname = nickname.replace('\n', '').replace('\r', '')
domain = args.followers.split('/u/')[0] domain = args.followers.split('/u/')[0]
elif '/c/' in args.followers:
nickname = args.followers.split('/c/')[1]
nickname = nickname.replace('\n', '').replace('\r', '')
domain = args.followers.split('/c/')[0]
else: else:
# format: @nick@domain # format: @nick@domain
if '@' not in args.followers: if '@' not in args.followers:
@ -1790,6 +1794,7 @@ if args.followers:
personUrl = personUrl.replace('/channel/', '/actor/') personUrl = personUrl.replace('/channel/', '/actor/')
personUrl = personUrl.replace('/profile/', '/actor/') personUrl = personUrl.replace('/profile/', '/actor/')
personUrl = personUrl.replace('/u/', '/actor/') personUrl = personUrl.replace('/u/', '/actor/')
personUrl = personUrl.replace('/c/', '/actor/')
if not personUrl: if not personUrl:
# try single user instance # try single user instance
personUrl = httpPrefix + '://' + domain personUrl = httpPrefix + '://' + domain

View File

@ -564,6 +564,8 @@ def _storeFollowRequest(baseDir: str,
alreadyFollowing = True alreadyFollowing = True
elif '://' + domainFull + '/u/' + nickname in followersStr: elif '://' + domainFull + '/u/' + nickname in followersStr:
alreadyFollowing = True alreadyFollowing = True
elif '://' + domainFull + '/c/' + nickname in followersStr:
alreadyFollowing = True
if alreadyFollowing: if alreadyFollowing:
if debug: if debug:

View File

@ -14,6 +14,7 @@ import time
import random import random
from linked_data_sig import verifyJsonSignature from linked_data_sig import verifyJsonSignature
from languages import understoodPostLanguage from languages import understoodPostLanguage
from utils import getUserPaths
from utils import getBaseContentFromPost from utils import getBaseContentFromPost
from utils import acctDir from utils import acctDir
from utils import removeDomainPort from utils import removeDomainPort
@ -749,10 +750,10 @@ def _personReceiveUpdate(baseDir: str,
' ' + str(personJson)) ' ' + str(personJson))
domainFull = getFullDomain(domain, port) domainFull = getFullDomain(domain, port)
updateDomainFull = getFullDomain(updateDomain, updatePort) updateDomainFull = getFullDomain(updateDomain, updatePort)
usersPaths = ('users', 'profile', 'channel', 'accounts', 'u', 'c') usersPaths = getUserPaths()
usersStrFound = False usersStrFound = False
for usersStr in usersPaths: for usersStr in usersPaths:
actor = updateDomainFull + '/' + usersStr + '/' + updateNickname actor = updateDomainFull + usersStr + updateNickname
if actor in personJson['id']: if actor in personJson['id']:
usersStrFound = True usersStrFound = True
break break