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 = nickname.replace('\n', '').replace('\r', '')
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:
# format: @nick@domain
if '@' not in args.followers:
@ -1790,6 +1794,7 @@ if args.followers:
personUrl = personUrl.replace('/channel/', '/actor/')
personUrl = personUrl.replace('/profile/', '/actor/')
personUrl = personUrl.replace('/u/', '/actor/')
personUrl = personUrl.replace('/c/', '/actor/')
if not personUrl:
# try single user instance
personUrl = httpPrefix + '://' + domain

View File

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

View File

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