mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
e5e6cad1b4
commit
d0884fa04d
|
@ -507,9 +507,11 @@ def sendAnnounceViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newAnnounceJson,[],inboxUrl,headers,"inbox:write")
|
||||
|
||||
|
|
|
@ -103,7 +103,8 @@ def sendAvailabilityViaServer(baseDir: str,session, \
|
|||
handle=httpPrefix+'://'+domainFull+'/@'+nickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
wfRequest= \
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
domain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
|
@ -128,9 +129,11 @@ def sendAvailabilityViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(Nickname,password)
|
||||
|
||||
headers = {'host': domain, \
|
||||
headers={
|
||||
'host': domain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newAvailabilityJson,[],inboxUrl,headers,"inbox:write")
|
||||
|
||||
|
|
15
blocking.py
15
blocking.py
|
@ -189,7 +189,8 @@ def sendBlockViaServer(baseDir: str,session, \
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
wfRequest= \
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
|
@ -215,9 +216,11 @@ def sendBlockViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newBlockJson,[],inboxUrl,headers,"inbox:write")
|
||||
|
||||
|
@ -292,9 +295,11 @@ def sendUndoBlockViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newBlockJson,[],inboxUrl,headers,"inbox:write")
|
||||
|
||||
|
|
19
blurhash.py
19
blurhash.py
|
@ -155,7 +155,8 @@ def blurhash_decode(blurhash, width, height, punch = 1.0, linear = False):
|
|||
|
||||
for j in range(size_y):
|
||||
for i in range(size_x):
|
||||
basis = math.cos(math.pi * float(x) * float(i) / float(width)) * \
|
||||
basis= \
|
||||
math.cos(math.pi*float(x)*float(i)/float(width))* \
|
||||
math.cos(math.pi*float(y)*float(j)/float(height))
|
||||
colour=colours[i+j*size_x]
|
||||
pixel[0] += colour[0]*basis
|
||||
|
@ -213,7 +214,8 @@ def blurhash_encode(image, components_x = 4, components_y = 4, linear = False):
|
|||
component=[0.0,0.0,0.0]
|
||||
for y in range(int(height)):
|
||||
for x in range(int(width)):
|
||||
basis = norm_factor * math.cos(math.pi * float(i) * float(x) / width) * \
|
||||
basis= \
|
||||
norm_factor * math.cos(math.pi * float(i) * float(x) / width) * \
|
||||
math.cos(math.pi * float(j) * float(y) / height)
|
||||
component[0] += basis * image_linear[y][x][0]
|
||||
component[1] += basis * image_linear[y][x][1]
|
||||
|
@ -225,15 +227,20 @@ def blurhash_encode(image, components_x = 4, components_y = 4, linear = False):
|
|||
components.append(component)
|
||||
|
||||
if not (i==0 and j==0):
|
||||
max_ac_component = max(max_ac_component, abs(component[0]), abs(component[1]), abs(component[2]))
|
||||
max_ac_component= \
|
||||
max(max_ac_component,abs(component[0]), \
|
||||
abs(component[1]),abs(component[2]))
|
||||
|
||||
# Encode components
|
||||
dc_value = (linear_to_srgb(components[0][0]) << 16) + \
|
||||
dc_value= \
|
||||
(linear_to_srgb(components[0][0]) << 16)+ \
|
||||
(linear_to_srgb(components[0][1]) << 8)+ \
|
||||
linear_to_srgb(components[0][2])
|
||||
|
||||
quant_max_ac_component = int(max(0, min(82, math.floor(max_ac_component * 166 - 0.5))))
|
||||
ac_component_norm_factor = float(quant_max_ac_component + 1) / 166.0
|
||||
quant_max_ac_component= \
|
||||
int(max(0, min(82, math.floor(max_ac_component * 166 - 0.5))))
|
||||
ac_component_norm_factor= \
|
||||
float(quant_max_ac_component+1) / 166.0
|
||||
|
||||
ac_values=[]
|
||||
for r, g, b in components[1:]:
|
||||
|
|
12
bookmarks.py
12
bookmarks.py
|
@ -490,9 +490,11 @@ def sendBookmarkViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newBookmarkJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
@ -569,9 +571,11 @@ def sendUndoBookmarkViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newUndoBookmarkJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
|
|
@ -158,7 +158,8 @@ def addWebLinks(content: str) -> str:
|
|||
def validHashTag(hashtag: str) -> bool:
|
||||
"""Returns true if the give hashtag contains valid characters
|
||||
"""
|
||||
validChars = set('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
validChars= \
|
||||
set('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
if set(hashtag).issubset(validChars):
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -116,7 +116,8 @@ def sendDeleteViaServer(baseDir: str,session, \
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
wfRequest= \
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
|
@ -142,9 +143,11 @@ def sendDeleteViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newDeleteJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
|
26
epicyon.py
26
epicyon.py
|
@ -366,7 +366,9 @@ if args.postsraw:
|
|||
|
||||
if args.json:
|
||||
session=createSession(False)
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
testJson=getJson(session,args.json,asHeader,None,__version__,httpPrefix,None)
|
||||
pprint(testJson)
|
||||
sys.exit()
|
||||
|
@ -994,7 +996,9 @@ if args.actor:
|
|||
else:
|
||||
sys.exit()
|
||||
|
||||
asHeader = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
if not personUrl:
|
||||
personUrl=getUserUrl(wfRequest)
|
||||
if nickname==domain:
|
||||
|
@ -1002,16 +1006,24 @@ if args.actor:
|
|||
if not personUrl:
|
||||
# try single user instance
|
||||
personUrl=httpPrefix+'://'+domain
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
if '/channel/' in personUrl:
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
|
||||
personJson = getJson(session,personUrl,asHeader,None,__version__,httpPrefix,None)
|
||||
personJson= \
|
||||
getJson(session,personUrl,asHeader,None,__version__,httpPrefix,None)
|
||||
if personJson:
|
||||
pprint(personJson)
|
||||
else:
|
||||
asHeader = {'Accept': 'application/jrd+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
personJson = getJson(session,personUrl,asHeader,None,__version__,httpPrefix,None)
|
||||
asHeader={
|
||||
'Accept': 'application/jrd+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
personJson= \
|
||||
getJson(session,personUrl,asHeader,None,__version__,httpPrefix,None)
|
||||
if personJson:
|
||||
pprint(personJson)
|
||||
else:
|
||||
|
|
24
follow.py
24
follow.py
|
@ -320,7 +320,8 @@ def getFollowingFeed(baseDir: str,domain: str,port: int,path: str, \
|
|||
'first': httpPrefix+'://'+domain+'/users/'+nickname+'/'+followFile+'?page=1',
|
||||
'id': httpPrefix+'://'+domain+'/users/'+nickname+'/'+followFile,
|
||||
'totalItems': getNoOfFollows(baseDir,nickname,domain,authenticated),
|
||||
'type': 'OrderedCollection'}
|
||||
'type': 'OrderedCollection'
|
||||
}
|
||||
return following
|
||||
|
||||
if not pageNumber:
|
||||
|
@ -333,7 +334,8 @@ def getFollowingFeed(baseDir: str,domain: str,port: int,path: str, \
|
|||
'orderedItems': [],
|
||||
'partOf': httpPrefix+'://'+domain+'/users/'+nickname+'/'+followFile,
|
||||
'totalItems': 0,
|
||||
'type': 'OrderedCollectionPage'}
|
||||
'type': 'OrderedCollectionPage'
|
||||
}
|
||||
|
||||
handleDomain=domain
|
||||
if ':' in handleDomain:
|
||||
|
@ -825,7 +827,8 @@ def sendFollowRequestViaServer(baseDir: str,session, \
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
wfRequest= \
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
|
@ -851,9 +854,11 @@ def sendFollowRequestViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newFollowJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
@ -910,7 +915,8 @@ def sendUnfollowRequestViaServer(baseDir: str,session, \
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
wfRequest= \
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
|
@ -936,9 +942,11 @@ def sendUnfollowRequestViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,unfollowJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
|
13
httpsig.py
13
httpsig.py
|
@ -104,7 +104,9 @@ def createSignedHeader(privateKeyPem: str,nickname: str, \
|
|||
|
||||
dateStr=strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime())
|
||||
if not withDigest:
|
||||
headers = {'(request-target)': f'post {path}','host': headerDomain,'date': dateStr}
|
||||
headers={
|
||||
'(request-target)': f'post {path}','host': headerDomain,'date': dateStr
|
||||
}
|
||||
signatureHeader= \
|
||||
signPostHeaders(dateStr,privateKeyPem,nickname, \
|
||||
domain,port,toDomain,toPort, \
|
||||
|
@ -119,7 +121,14 @@ def createSignedHeader(privateKeyPem: str,nickname: str, \
|
|||
#print('***************************Send Content-type: '+contentType)
|
||||
#print('***************************Send Content-Length: '+str(len(messageBodyJsonStr)))
|
||||
#print('***************************Send messageBodyJsonStr: '+messageBodyJsonStr)
|
||||
headers = {'(request-target)': f'post {path}','host': headerDomain,'date': dateStr,'digest': f'SHA-256={bodyDigest}','content-length': str(contentLength),'content-type': contentType}
|
||||
headers={
|
||||
'(request-target)': f'post {path}',
|
||||
'host': headerDomain,
|
||||
'date': dateStr,
|
||||
'digest': f'SHA-256={bodyDigest}',
|
||||
'content-length': str(contentLength),
|
||||
'content-type': contentType
|
||||
}
|
||||
signatureHeader= \
|
||||
signPostHeaders(dateStr,privateKeyPem,nickname, \
|
||||
domain,port, \
|
||||
|
|
15
like.py
15
like.py
|
@ -445,9 +445,11 @@ def sendLikeViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newLikeJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
@ -498,7 +500,8 @@ def sendUndoLikeViaServer(baseDir: str,session, \
|
|||
handle=httpPrefix+'://'+fromDomainFull+'/@'+fromNickname
|
||||
|
||||
# lookup the inbox for the To handle
|
||||
wfRequest = webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
wfRequest= \
|
||||
webfingerHandle(session,handle,httpPrefix,cachedWebfingers, \
|
||||
fromDomain,projectVersion)
|
||||
if not wfRequest:
|
||||
if debug:
|
||||
|
@ -524,9 +527,11 @@ def sendUndoLikeViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newUndoLikeJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
|
|
@ -61,7 +61,8 @@ def metaDataInstance(instanceTitle: str, \
|
|||
|
||||
instance={
|
||||
'approval_required': False,
|
||||
'contact_account': {'acct': adminActor['preferredUsername'],
|
||||
'contact_account': {
|
||||
'acct': adminActor['preferredUsername'],
|
||||
'avatar': adminActor['icon']['url'],
|
||||
'avatar_static': adminActor['icon']['url'],
|
||||
'bot': isBot,
|
||||
|
|
22
person.py
22
person.py
|
@ -100,10 +100,13 @@ def setProfileImage(baseDir: str,httpPrefix :str,nickname: str,domain: str, \
|
|||
personJson=loadJson(personFilename)
|
||||
if personJson:
|
||||
personJson[iconFilenameBase]['mediaType']=mediaType
|
||||
personJson[iconFilenameBase]['url']=httpPrefix+'://'+fullDomain+'/users/'+nickname+'/'+iconFilename
|
||||
personJson[iconFilenameBase]['url']= \
|
||||
httpPrefix+'://'+fullDomain+'/users/'+nickname+'/'+iconFilename
|
||||
saveJson(personJson,personFilename)
|
||||
|
||||
cmd = '/usr/bin/convert '+imageFilename+' -size '+resolution+' -quality 50 '+profileFilename
|
||||
cmd= \
|
||||
'/usr/bin/convert '+imageFilename+' -size '+ \
|
||||
resolution+' -quality 50 '+profileFilename
|
||||
subprocess.call(cmd, shell=True)
|
||||
removeMetaData(profileFilename,profileFilename)
|
||||
return True
|
||||
|
@ -180,7 +183,8 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \
|
|||
approveFollowers=True
|
||||
personType='Application'
|
||||
|
||||
newPerson = {'@context': ['https://www.w3.org/ns/activitystreams',
|
||||
newPerson={
|
||||
'@context': ['https://www.w3.org/ns/activitystreams',
|
||||
'https://w3id.org/security/v1',
|
||||
{'Emoji': 'toot:Emoji',
|
||||
'Hashtag': 'as:Hashtag',
|
||||
|
@ -207,13 +211,17 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \
|
|||
'skills': {},
|
||||
'roles': {},
|
||||
'availability': None,
|
||||
'icon': {'mediaType': 'image/png',
|
||||
'icon': {
|
||||
'mediaType': 'image/png',
|
||||
'type': 'Image',
|
||||
'url': personId+'/avatar'+str(randint(10000000000000,99999999999999))+'.png'},
|
||||
'url': personId+'/avatar'+str(randint(10000000000000,99999999999999))+'.png'
|
||||
},
|
||||
'id': personId,
|
||||
'image': {'mediaType': 'image/png',
|
||||
'image': {
|
||||
'mediaType': 'image/png',
|
||||
'type': 'Image',
|
||||
'url': personId+'/image'+str(randint(10000000000000,99999999999999))+'.png'},
|
||||
'url': personId+'/image'+str(randint(10000000000000,99999999999999))+'.png'
|
||||
},
|
||||
'inbox': inboxStr,
|
||||
'manuallyApprovesFollowers': approveFollowers,
|
||||
'name': personName,
|
||||
|
|
63
posts.py
63
posts.py
|
@ -165,7 +165,9 @@ def getPersonBox(baseDir: str,session,wfRequest: {},personCache: {}, \
|
|||
projectVersion: str,httpPrefix: str, \
|
||||
nickname: str,domain: str, \
|
||||
boxName='inbox') -> (str,str,str,str,str,str,str,str):
|
||||
asHeader = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
if not wfRequest.get('errors'):
|
||||
personUrl=getUserUrl(wfRequest)
|
||||
else:
|
||||
|
@ -173,7 +175,9 @@ def getPersonBox(baseDir: str,session,wfRequest: {},personCache: {}, \
|
|||
# try single user instance
|
||||
print('getPersonBox: Trying single user instance with ld+json')
|
||||
personUrl=httpPrefix+'://'+domain
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
else:
|
||||
personUrl=httpPrefix+'://'+domain+'/users/'+nickname
|
||||
if not personUrl:
|
||||
|
@ -181,11 +185,15 @@ def getPersonBox(baseDir: str,session,wfRequest: {},personCache: {}, \
|
|||
personJson=getPersonFromCache(baseDir,personUrl,personCache)
|
||||
if not personJson:
|
||||
if '/channel/' in personUrl:
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
personJson=getJson(session,personUrl,asHeader,None, \
|
||||
projectVersion,httpPrefix,domain)
|
||||
if not personJson:
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
personJson=getJson(session,personUrl,asHeader,None, \
|
||||
projectVersion,httpPrefix,domain)
|
||||
if not personJson:
|
||||
|
@ -246,9 +254,13 @@ def getPosts(session,outboxUrl: str,maxPosts: int, \
|
|||
personPosts={}
|
||||
if not outboxUrl:
|
||||
return personPosts
|
||||
asHeader = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
if '/outbox/' in outboxUrl:
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
if raw:
|
||||
result=[]
|
||||
i=0
|
||||
|
@ -1444,8 +1456,10 @@ def sendPostViaServer(projectVersion: str, \
|
|||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
if attachImageFilename:
|
||||
headers = {'host': fromDomain, \
|
||||
'Authorization': authHeader}
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postImage(session,attachImageFilename,[], \
|
||||
inboxUrl,headers,"inbox:write")
|
||||
|
@ -1454,9 +1468,11 @@ def sendPostViaServer(projectVersion: str, \
|
|||
# print('DEBUG: Failed to upload image')
|
||||
# return 9
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJsonString(session,json.dumps(postJsonObject),[], \
|
||||
inboxUrl,headers,"inbox:write",debug)
|
||||
|
@ -1648,7 +1664,8 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \
|
|||
if debug:
|
||||
print('DEBUG: starting thread to send post')
|
||||
pprint(postJsonObject)
|
||||
thr = threadWithTrace(target=threadSendPost, \
|
||||
thr= \
|
||||
threadWithTrace(target=threadSendPost, \
|
||||
args=(session, \
|
||||
postJsonStr, \
|
||||
federationList, \
|
||||
|
@ -2042,18 +2059,22 @@ def createModeration(baseDir: str,nickname: str,domain: str,port: int, \
|
|||
pageNumber=1
|
||||
|
||||
pageStr='?page='+str(pageNumber)
|
||||
boxHeader = {'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
boxHeader={
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'first': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname+'?page=true',
|
||||
'id': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname,
|
||||
'last': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname+'?page=true',
|
||||
'totalItems': 0,
|
||||
'type': 'OrderedCollection'}
|
||||
boxItems = {'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'type': 'OrderedCollection'
|
||||
}
|
||||
boxItems={
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname+pageStr,
|
||||
'orderedItems': [
|
||||
],
|
||||
'partOf': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname,
|
||||
'type': 'OrderedCollectionPage'}
|
||||
'type': 'OrderedCollectionPage'
|
||||
}
|
||||
|
||||
if isModerator(baseDir,nickname):
|
||||
moderationIndexFile=baseDir+'/accounts/moderation.txt'
|
||||
|
@ -2365,18 +2386,22 @@ def createBoxIndexed(recentPostsCache: {}, \
|
|||
pageStr='?page='+str(pageNumber)
|
||||
except:
|
||||
pass
|
||||
boxHeader = {'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
boxHeader={
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'first': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname+'?page=true',
|
||||
'id': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname,
|
||||
'last': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname+'?page=true',
|
||||
'totalItems': 0,
|
||||
'type': 'OrderedCollection'}
|
||||
boxItems = {'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'type': 'OrderedCollection'
|
||||
}
|
||||
boxItems={
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname+pageStr,
|
||||
'orderedItems': [
|
||||
],
|
||||
'partOf': httpPrefix+'://'+domain+'/users/'+nickname+'/'+boxname,
|
||||
'type': 'OrderedCollectionPage'}
|
||||
'type': 'OrderedCollectionPage'
|
||||
}
|
||||
|
||||
postsInBox=[]
|
||||
|
||||
|
|
13
roles.py
13
roles.py
|
@ -229,8 +229,11 @@ def sendRoleViaServer(baseDir: str,session, \
|
|||
if ':' not in delegatorDomain:
|
||||
delegatorDomainFull=delegatorDomain+':'+str(fromPort)
|
||||
|
||||
toUrl = httpPrefix+'://'+delegatorDomainFull+'/users/'+nickname
|
||||
ccUrl = httpPrefix+'://'+delegatorDomainFull+'/users/'+delegatorNickname+'/followers'
|
||||
toUrl= \
|
||||
httpPrefix+'://'+delegatorDomainFull+'/users/'+nickname
|
||||
ccUrl= \
|
||||
httpPrefix+'://'+delegatorDomainFull+'/users/'+ \
|
||||
delegatorNickname+'/followers'
|
||||
|
||||
if role:
|
||||
roleStr=project.lower()+';'+role.lower()
|
||||
|
@ -279,9 +282,11 @@ def sendRoleViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(delegatorNickname,password)
|
||||
|
||||
headers = {'host': delegatorDomain, \
|
||||
headers={
|
||||
'host': delegatorDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newRoleJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
|
|
@ -94,7 +94,8 @@ def postJsonString(session,postJsonStr: str, \
|
|||
print('postJson: '+inboxUrl+' not permitted by capabilities')
|
||||
return None,None
|
||||
|
||||
postResult = session.post(url = inboxUrl, data = postJsonStr, headers=headers)
|
||||
postResult= \
|
||||
session.post(url=inboxUrl,data=postJsonStr,headers=headers)
|
||||
if postResult.status_code<200 or postResult.status_code>202:
|
||||
#if postResult.status_code==400:
|
||||
# headers['content-type']='application/ld+json'
|
||||
|
|
24
shares.py
24
shares.py
|
@ -266,7 +266,8 @@ def getSharesFeedForPerson(baseDir: str, \
|
|||
'first': httpPrefix+'://'+domain+'/users/'+nickname+'/shares?page=1',
|
||||
'id': httpPrefix+'://'+domain+'/users/'+nickname+'/shares',
|
||||
'totalItems': str(noOfShares),
|
||||
'type': 'OrderedCollection'}
|
||||
'type': 'OrderedCollection'
|
||||
}
|
||||
return shares
|
||||
|
||||
if not pageNumber:
|
||||
|
@ -279,7 +280,8 @@ def getSharesFeedForPerson(baseDir: str, \
|
|||
'orderedItems': [],
|
||||
'partOf': httpPrefix+'://'+domain+'/users/'+nickname+'/shares',
|
||||
'totalItems': 0,
|
||||
'type': 'OrderedCollectionPage'}
|
||||
'type': 'OrderedCollectionPage'
|
||||
}
|
||||
|
||||
if not os.path.isfile(sharesFilename):
|
||||
print("test5")
|
||||
|
@ -385,14 +387,18 @@ def sendShareViaServer(baseDir,session, \
|
|||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
if imageFilename:
|
||||
headers = {'host': fromDomain, \
|
||||
'Authorization': authHeader}
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postImage(session,imageFilename,[],inboxUrl.replace('/'+postToBox,'/shares'),headers,"inbox:write")
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newShareJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
@ -471,9 +477,11 @@ def sendUndoShareViaServer(baseDir: str,session, \
|
|||
|
||||
authHeader=createBasicAuthHeader(fromNickname,password)
|
||||
|
||||
headers = {'host': fromDomain, \
|
||||
headers={
|
||||
'host': fromDomain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,undoShareJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
|
|
@ -152,9 +152,11 @@ def sendSkillViaServer(baseDir: str,session,nickname: str,password: str,
|
|||
|
||||
authHeader=createBasicAuthHeader(Nickname,password)
|
||||
|
||||
headers = {'host': domain, \
|
||||
headers={
|
||||
'host': domain, \
|
||||
'Content-type': 'application/json', \
|
||||
'Authorization': authHeader}
|
||||
'Authorization': authHeader
|
||||
}
|
||||
postResult= \
|
||||
postJson(session,newSkillJson,[],inboxUrl,headers,"inbox:write")
|
||||
#if not postResult:
|
||||
|
|
37
tests.py
37
tests.py
|
@ -103,7 +103,11 @@ def testHttpsigBase(withDigest):
|
|||
privateKeyPem,publicKeyPem,person,wfEndpoint= \
|
||||
createPerson(path,nickname,domain,port,httpPrefix,False,password)
|
||||
assert privateKeyPem
|
||||
messageBodyJson = {"a key": "a value", "another key": "A string","yet another key": "Another string"}
|
||||
messageBodyJson={
|
||||
"a key": "a value",
|
||||
"another key": "A string",
|
||||
"yet another key": "Another string"
|
||||
}
|
||||
messageBodyJsonStr=json.dumps(messageBodyJson)
|
||||
|
||||
headersDomain=domain
|
||||
|
@ -115,7 +119,11 @@ def testHttpsigBase(withDigest):
|
|||
dateStr=strftime("%a, %d %b %Y %H:%M:%S %Z", gmtime())
|
||||
boxpath='/inbox'
|
||||
if not withDigest:
|
||||
headers = {'host': headersDomain,'date': dateStr,'content-type': 'application/json'}
|
||||
headers={
|
||||
'host': headersDomain,
|
||||
'date': dateStr,
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
signatureHeader= \
|
||||
signPostHeaders(dateStr,privateKeyPem, nickname, \
|
||||
domain, port, \
|
||||
|
@ -124,7 +132,13 @@ def testHttpsigBase(withDigest):
|
|||
else:
|
||||
bodyDigest=messageContentDigest(messageBodyJsonStr)
|
||||
contentLength=len(messageBodyJsonStr)
|
||||
headers = {'host': headersDomain,'date': dateStr,'digest': f'SHA-256={bodyDigest}','content-type': contentType,'content-length': str(contentLength)}
|
||||
headers={
|
||||
'host': headersDomain,
|
||||
'date': dateStr,
|
||||
'digest': f'SHA-256={bodyDigest}',
|
||||
'content-type': contentType,
|
||||
'content-length': str(contentLength)
|
||||
}
|
||||
signatureHeader= \
|
||||
signPostHeaders(dateStr,privateKeyPem, nickname, \
|
||||
domain, port, \
|
||||
|
@ -149,13 +163,23 @@ def testHttpsigBase(withDigest):
|
|||
messageBodyJsonStr,False) == False
|
||||
if not withDigest:
|
||||
# fake domain
|
||||
headers = {'host': 'bogon.domain','date': dateStr,'content-type': 'application/json'}
|
||||
headers={
|
||||
'host': 'bogon.domain',
|
||||
'date': dateStr,
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
else:
|
||||
# correct domain but fake message
|
||||
messageBodyJsonStr='{"a key": "a value", "another key": "Fake GNUs", "yet another key": "More Fake GNUs"}'
|
||||
contentLength=len(messageBodyJsonStr)
|
||||
bodyDigest=messageContentDigest(messageBodyJsonStr)
|
||||
headers = {'host': domain,'date': dateStr,'digest': f'SHA-256={bodyDigest}','content-type': contentType,'content-length': str(contentLength)}
|
||||
headers={
|
||||
'host': domain,
|
||||
'date': dateStr,
|
||||
'digest': f'SHA-256={bodyDigest}',
|
||||
'content-type': contentType,
|
||||
'content-length': str(contentLength)
|
||||
}
|
||||
headers['signature']=signatureHeader
|
||||
assert verifyPostHeaders(httpPrefix,publicKeyPem,headers, \
|
||||
boxpath,True,None, \
|
||||
|
@ -184,7 +208,8 @@ def testThreadsFunction(param: str):
|
|||
|
||||
def testThreads():
|
||||
print('testThreads')
|
||||
thr = threadWithTrace(target=testThreadsFunction,args=('test',),daemon=True)
|
||||
thr= \
|
||||
threadWithTrace(target=testThreadsFunction,args=('test',),daemon=True)
|
||||
thr.start()
|
||||
assert thr.isAlive()==True
|
||||
time.sleep(1)
|
||||
|
|
12
utils.py
12
utils.py
|
@ -198,17 +198,21 @@ def getDomainFromActor(actor: str) -> (str,int):
|
|||
"""
|
||||
port=None
|
||||
if '/profile/' in actor:
|
||||
domain = actor.split('/profile/')[0].replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
|
||||
domain= \
|
||||
actor.split('/profile/')[0].replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
|
||||
else:
|
||||
if '/channel/' in actor:
|
||||
domain = actor.split('/channel/')[0].replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
|
||||
domain= \
|
||||
actor.split('/channel/')[0].replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
|
||||
else:
|
||||
if '/users/' not in actor:
|
||||
domain = actor.replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
|
||||
domain= \
|
||||
actor.replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
|
||||
if '/' in actor:
|
||||
domain=domain.split('/')[0]
|
||||
else:
|
||||
domain = actor.split('/users/')[0].replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
|
||||
domain= \
|
||||
actor.split('/users/')[0].replace('https://','').replace('http://','').replace('i2p://','').replace('dat://','')
|
||||
if ':' in domain:
|
||||
portStr=domain.split(':')[1]
|
||||
if not portStr.isdigit():
|
||||
|
|
|
@ -62,8 +62,12 @@ def webfingerHandle(session,handle: str,httpPrefix: str,cachedWebfingers: {}, \
|
|||
if wf:
|
||||
return wf
|
||||
url='{}://{}/.well-known/webfinger'.format(httpPrefix,domain)
|
||||
par = {'resource': 'acct:{}'.format(nickname+'@'+wfDomain)}
|
||||
hdr = {'Accept': 'application/jrd+json'}
|
||||
par={
|
||||
'resource': 'acct:{}'.format(nickname+'@'+wfDomain)
|
||||
}
|
||||
hdr={
|
||||
'Accept': 'application/jrd+json'
|
||||
}
|
||||
try:
|
||||
result=getJson(session,url,hdr,par,projectVersion,httpPrefix,fromDomain)
|
||||
except Exception as e:
|
||||
|
|
|
@ -81,17 +81,25 @@ def updateAvatarImageCache(session,baseDir: str,httpPrefix: str, \
|
|||
actorStr=actor.replace('/','-')
|
||||
avatarImagePath=baseDir+'/cache/avatars/'+actorStr
|
||||
if avatarUrl.endswith('.png') or '.png?' in avatarUrl:
|
||||
sessionHeaders = {'Accept': 'image/png'}
|
||||
sessionHeaders={
|
||||
'Accept': 'image/png'
|
||||
}
|
||||
avatarImageFilename=avatarImagePath+'.png'
|
||||
elif avatarUrl.endswith('.jpg') or avatarUrl.endswith('.jpeg') or \
|
||||
'.jpg?' in avatarUrl or '.jpeg?' in avatarUrl:
|
||||
sessionHeaders = {'Accept': 'image/jpeg'}
|
||||
sessionHeaders={
|
||||
'Accept': 'image/jpeg'
|
||||
}
|
||||
avatarImageFilename=avatarImagePath+'.jpg'
|
||||
elif avatarUrl.endswith('.gif') or '.gif?' in avatarUrl:
|
||||
sessionHeaders = {'Accept': 'image/gif'}
|
||||
sessionHeaders={
|
||||
'Accept': 'image/gif'
|
||||
}
|
||||
avatarImageFilename=avatarImagePath+'.gif'
|
||||
elif avatarUrl.endswith('.webp') or '.webp?' in avatarUrl:
|
||||
sessionHeaders = {'Accept': 'image/webp'}
|
||||
sessionHeaders={
|
||||
'Accept': 'image/webp'
|
||||
}
|
||||
avatarImageFilename=avatarImagePath+'.webp'
|
||||
else:
|
||||
return None
|
||||
|
@ -556,7 +564,9 @@ def htmlSkillsSearch(translate: {},baseDir: str, \
|
|||
actor=actorJson['id']
|
||||
for skillName,skillLevel in actorJson['skills'].items():
|
||||
skillName=skillName.lower()
|
||||
if skillName in skillsearch or skillsearch in skillName:
|
||||
if not (skillName in skillsearch or \
|
||||
skillsearch in skillName):
|
||||
continue
|
||||
skillLevelStr=str(skillLevel)
|
||||
if skillLevel<100:
|
||||
skillLevelStr='0'+skillLevelStr
|
||||
|
@ -589,7 +599,9 @@ def htmlSkillsSearch(translate: {},baseDir: str, \
|
|||
actor=actorJson['id']
|
||||
for skillName,skillLevel in actorJson['skills'].items():
|
||||
skillName=skillName.lower()
|
||||
if skillName in skillsearch or skillsearch in skillName:
|
||||
if not (skillName in skillsearch or \
|
||||
skillsearch in skillName):
|
||||
continue
|
||||
skillLevelStr=str(skillLevel)
|
||||
if skillLevel<100:
|
||||
skillLevelStr='0'+skillLevelStr
|
||||
|
@ -622,14 +634,17 @@ def htmlSkillsSearch(translate: {},baseDir: str, \
|
|||
ctr=0
|
||||
for skillMatch in results:
|
||||
skillMatchFields=skillMatch.split(';')
|
||||
if len(skillMatchFields)==4:
|
||||
if len(skillMatchFields)!=4:
|
||||
continue
|
||||
actor=skillMatchFields[1]
|
||||
actorName=skillMatchFields[2]
|
||||
avatarUrl=skillMatchFields[3]
|
||||
skillSearchForm+='<div class="search-result""><a href="'+actor+'/skills">'
|
||||
skillSearchForm+= \
|
||||
'<div class="search-result""><a href="'+actor+'/skills">'
|
||||
skillSearchForm+= \
|
||||
'<img loading="lazy" src="'+avatarUrl+ \
|
||||
'"/><span class="search-result-text">'+actorName+'</span></a></div>'
|
||||
'"/><span class="search-result-text">'+actorName+ \
|
||||
'</span></a></div>'
|
||||
ctr+=1
|
||||
if ctr>=postsPerPage:
|
||||
break
|
||||
|
@ -640,7 +655,8 @@ def htmlSkillsSearch(translate: {},baseDir: str, \
|
|||
def scheduledPostsExist(baseDir: str,nickname: str,domain: str) -> bool:
|
||||
"""Returns true if there are posts scheduled to be delivered
|
||||
"""
|
||||
scheduleIndexFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/schedule.index'
|
||||
scheduleIndexFilename= \
|
||||
baseDir+'/accounts/'+nickname+'@'+domain+'/schedule.index'
|
||||
if not os.path.isfile(scheduleIndexFilename):
|
||||
return False
|
||||
if '#users#' in open(scheduleIndexFilename).read():
|
||||
|
@ -653,7 +669,8 @@ def htmlEditProfile(translate: {},baseDir: str,path: str, \
|
|||
"""
|
||||
imageFormats='.png, .jpg, .jpeg, .gif, .webp'
|
||||
pathOriginal=path
|
||||
path=path.replace('/inbox','').replace('/outbox','').replace('/shares','')
|
||||
path= \
|
||||
path.replace('/inbox','').replace('/outbox','').replace('/shares','')
|
||||
nickname=getNicknameFromActor(path)
|
||||
if not nickname:
|
||||
return ''
|
||||
|
@ -730,13 +747,15 @@ def htmlEditProfile(translate: {},baseDir: str,path: str, \
|
|||
switchStr=switchfile.read()
|
||||
|
||||
blockedStr=''
|
||||
blockedFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/blocking.txt'
|
||||
blockedFilename= \
|
||||
baseDir+'/accounts/'+nickname+'@'+domain+'/blocking.txt'
|
||||
if os.path.isfile(blockedFilename):
|
||||
with open(blockedFilename, 'r') as blockedfile:
|
||||
blockedStr=blockedfile.read()
|
||||
|
||||
allowedInstancesStr=''
|
||||
allowedInstancesFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/allowedinstances.txt'
|
||||
allowedInstancesFilename= \
|
||||
baseDir+'/accounts/'+nickname+'@'+domain+'/allowedinstances.txt'
|
||||
if os.path.isfile(allowedInstancesFilename):
|
||||
with open(allowedInstancesFilename, 'r') as allowedInstancesFile:
|
||||
allowedInstancesStr=allowedInstancesFile.read()
|
||||
|
@ -928,7 +947,8 @@ def htmlEditProfile(translate: {},baseDir: str,path: str, \
|
|||
editProfileForm+=htmlFooter()
|
||||
return editProfileForm
|
||||
|
||||
def htmlGetLoginCredentials(loginParams: str,lastLoginTime: int) -> (str,str,bool):
|
||||
def htmlGetLoginCredentials(loginParams: str, \
|
||||
lastLoginTime: int) -> (str,str,bool):
|
||||
"""Receives login credentials via HTTPServer POST
|
||||
"""
|
||||
if not loginParams.startswith('username='):
|
||||
|
@ -4984,7 +5004,9 @@ def htmlProfileAfterSearch(recentPostsCache: {},maxRecentPosts: int, \
|
|||
personUrl=getUserUrl(wf)
|
||||
if not personUrl:
|
||||
# try single user instance
|
||||
asHeader = {'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'}
|
||||
asHeader={
|
||||
'Accept': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
}
|
||||
personUrl=httpPrefix+'://'+searchDomainFull
|
||||
profileJson=getJson(session,personUrl,asHeader,None,projectVersion,httpPrefix,domain)
|
||||
if not profileJson:
|
||||
|
|
Loading…
Reference in New Issue