mirror of https://gitlab.com/bashrc2/epicyon
group resource is deprecated within webfinger
parent
d28bedad71
commit
3bb8a7958e
8
tests.py
8
tests.py
|
@ -2246,8 +2246,8 @@ def testGroupFollow(baseDir: str) -> None:
|
||||||
testgroupDir + '/wfendpoints/testgroup@' + \
|
testgroupDir + '/wfendpoints/testgroup@' + \
|
||||||
testgroupDomain + ':' + str(testgroupPort) + '.json'
|
testgroupDomain + ':' + str(testgroupPort) + '.json'
|
||||||
assert os.path.isfile(testgroupWebfingerFilename)
|
assert os.path.isfile(testgroupWebfingerFilename)
|
||||||
assert 'group:testgroup@' in open(testgroupWebfingerFilename).read()
|
assert 'acct:testgroup@' in open(testgroupWebfingerFilename).read()
|
||||||
print('group: exists within the webfinger endpoint for testgroup')
|
print('acct: exists within the webfinger endpoint for testgroup')
|
||||||
|
|
||||||
testgroupHandle = 'testgroup@' + testgroupDomain
|
testgroupHandle = 'testgroup@' + testgroupDomain
|
||||||
followingStr = ''
|
followingStr = ''
|
||||||
|
@ -2321,8 +2321,8 @@ def testGroupFollow(baseDir: str) -> None:
|
||||||
testgroupDir + '/wfendpoints/testgroup@' + \
|
testgroupDir + '/wfendpoints/testgroup@' + \
|
||||||
testgroupDomain + ':' + str(testgroupPort) + '.json'
|
testgroupDomain + ':' + str(testgroupPort) + '.json'
|
||||||
assert os.path.isfile(testgroupWebfingerFilename)
|
assert os.path.isfile(testgroupWebfingerFilename)
|
||||||
assert 'group:testgroup@' in open(testgroupWebfingerFilename).read()
|
assert 'acct:testgroup@' in open(testgroupWebfingerFilename).read()
|
||||||
print('group: exists within the webfinger endpoint for testgroup')
|
print('acct: exists within the webfinger endpoint for testgroup')
|
||||||
|
|
||||||
testgroupHandle = 'testgroup@' + testgroupDomain
|
testgroupHandle = 'testgroup@' + testgroupDomain
|
||||||
followingStr = ''
|
followingStr = ''
|
||||||
|
|
43
webfinger.py
43
webfinger.py
|
@ -75,8 +75,6 @@ def webfingerHandle(session, handle: str, httpPrefix: str,
|
||||||
nickname, domain, grpAccount = _parseHandle(handle)
|
nickname, domain, grpAccount = _parseHandle(handle)
|
||||||
if not nickname:
|
if not nickname:
|
||||||
return None
|
return None
|
||||||
if grpAccount:
|
|
||||||
groupAccount = True
|
|
||||||
wfDomain = removeDomainPort(domain)
|
wfDomain = removeDomainPort(domain)
|
||||||
|
|
||||||
wfHandle = nickname + '@' + wfDomain
|
wfHandle = nickname + '@' + wfDomain
|
||||||
|
@ -89,14 +87,9 @@ def webfingerHandle(session, handle: str, httpPrefix: str,
|
||||||
hdr = {
|
hdr = {
|
||||||
'Accept': 'application/jrd+json'
|
'Accept': 'application/jrd+json'
|
||||||
}
|
}
|
||||||
if not groupAccount:
|
par = {
|
||||||
par = {
|
'resource': 'acct:{}'.format(wfHandle)
|
||||||
'resource': 'acct:{}'.format(wfHandle)
|
}
|
||||||
}
|
|
||||||
else:
|
|
||||||
par = {
|
|
||||||
'resource': 'group:{}'.format(wfHandle)
|
|
||||||
}
|
|
||||||
try:
|
try:
|
||||||
result = \
|
result = \
|
||||||
getJson(signingPrivateKeyPem, session, url, hdr, par,
|
getJson(signingPrivateKeyPem, session, url, hdr, par,
|
||||||
|
@ -147,10 +140,7 @@ def createWebfingerEndpoint(nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
personName = nickname
|
personName = nickname
|
||||||
personId = localActorUrl(httpPrefix, personName, domain)
|
personId = localActorUrl(httpPrefix, personName, domain)
|
||||||
if not groupAccount:
|
subjectStr = "acct:" + personName + "@" + originalDomain
|
||||||
subjectStr = "acct:" + personName + "@" + originalDomain
|
|
||||||
else:
|
|
||||||
subjectStr = "group:" + personName + "@" + originalDomain
|
|
||||||
profilePageHref = httpPrefix + "://" + domain + "/@" + nickname
|
profilePageHref = httpPrefix + "://" + domain + "/@" + nickname
|
||||||
if nickname == 'inbox' or nickname == originalDomain:
|
if nickname == 'inbox' or nickname == originalDomain:
|
||||||
personName = 'actor'
|
personName = 'actor'
|
||||||
|
@ -232,20 +222,17 @@ def webfingerLookup(path: str, baseDir: str,
|
||||||
if not path.startswith('/.well-known/webfinger?'):
|
if not path.startswith('/.well-known/webfinger?'):
|
||||||
return None
|
return None
|
||||||
handle = None
|
handle = None
|
||||||
resourceTypes = ('acct', 'group')
|
resType = 'acct'
|
||||||
for resType in resourceTypes:
|
if 'resource=' + resType + ':' in path:
|
||||||
if 'resource=' + resType + ':' in path:
|
handle = path.split('resource=' + resType + ':')[1].strip()
|
||||||
handle = path.split('resource=' + resType + ':')[1].strip()
|
handle = urllib.parse.unquote(handle)
|
||||||
handle = urllib.parse.unquote(handle)
|
if debug:
|
||||||
if debug:
|
print('DEBUG: WEBFINGER handle ' + handle)
|
||||||
print('DEBUG: WEBFINGER handle ' + handle)
|
elif 'resource=' + resType + '%3A' in path:
|
||||||
break
|
handle = path.split('resource=' + resType + '%3A')[1]
|
||||||
elif 'resource=' + resType + '%3A' in path:
|
handle = urllib.parse.unquote(handle.strip())
|
||||||
handle = path.split('resource=' + resType + '%3A')[1]
|
if debug:
|
||||||
handle = urllib.parse.unquote(handle.strip())
|
print('DEBUG: WEBFINGER handle ' + handle)
|
||||||
if debug:
|
|
||||||
print('DEBUG: WEBFINGER handle ' + handle)
|
|
||||||
break
|
|
||||||
if not handle:
|
if not handle:
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: WEBFINGER handle missing')
|
print('DEBUG: WEBFINGER handle missing')
|
||||||
|
|
Loading…
Reference in New Issue