mirror of https://gitlab.com/bashrc2/epicyon
Allow profile in path
parent
8a1fb72ccb
commit
cd5af800c2
|
@ -185,9 +185,9 @@ def receiveAcceptReject(session,baseDir: str, \
|
|||
if debug:
|
||||
print('DEBUG: '+messageJson['type']+' has no actor')
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor in '+messageJson['type'])
|
||||
print('DEBUG: "users" or "profile" missing from actor in '+messageJson['type'])
|
||||
return False
|
||||
domain,tempPort=getDomainFromActor(messageJson['actor'])
|
||||
if not domainPermitted(domain,federationList):
|
||||
|
|
2
auth.py
2
auth.py
|
@ -46,7 +46,7 @@ def authorizeBasic(baseDir: str,path: str,authHeader: str,debug: bool) -> bool:
|
|||
if debug:
|
||||
print('DEBUG: Authorixation header does not contain a space character')
|
||||
return False
|
||||
if '/users/' not in path:
|
||||
if '/users/' not in path and '/profile/' not in path:
|
||||
if debug:
|
||||
print('DEBUG: Path for Authorization does not contain a user')
|
||||
return False
|
||||
|
|
|
@ -322,7 +322,7 @@ def outboxBlock(baseDir: str,httpPrefix: str, \
|
|||
if debug:
|
||||
print('DEBUG: c2s block object is not a status')
|
||||
return
|
||||
if '/users/' not in messageId:
|
||||
if '/users/' not in messageId and '/profile/' not in messageId:
|
||||
if debug:
|
||||
print('DEBUG: c2s block object has no nickname')
|
||||
return
|
||||
|
@ -397,7 +397,7 @@ def outboxUndoBlock(baseDir: str,httpPrefix: str, \
|
|||
if debug:
|
||||
print('DEBUG: c2s undo block object is not a status')
|
||||
return
|
||||
if '/users/' not in messageId:
|
||||
if '/users/' not in messageId and '/profile/' not in messageId:
|
||||
if debug:
|
||||
print('DEBUG: c2s undo block object has no nickname')
|
||||
return
|
||||
|
|
|
@ -241,7 +241,7 @@ def outboxDelete(baseDir: str,httpPrefix: str, \
|
|||
if debug:
|
||||
print('DEBUG: c2s delete object is not a status')
|
||||
return
|
||||
if '/users/' not in messageId:
|
||||
if '/users/' not in messageId and '/profile/' not in messageId:
|
||||
if debug:
|
||||
print('DEBUG: c2s delete object has no nickname')
|
||||
return
|
||||
|
|
10
epicyon.py
10
epicyon.py
|
@ -820,11 +820,15 @@ if args.actor:
|
|||
if '/@' in args.actor or '/users/' in args.actor or args.actor.startswith('http') or args.actor.startswith('dat'):
|
||||
# format: https://domain/@nick
|
||||
args.actor=args.actor.replace('https://','').replace('http://','').replace('dat://','').replace('/@','/users/')
|
||||
if '/users/' not in args.actor:
|
||||
if '/users/' not in args.actor and '/profile/' not in args.actor:
|
||||
print('Expected actor format: https://domain/@nick or https://domain/users/nick')
|
||||
sys.exit()
|
||||
nickname=args.actor.split('/users/')[1].replace('\n','')
|
||||
domain=args.actor.split('/users/')[0]
|
||||
if '/users/' in args.actor:
|
||||
nickname=args.actor.split('/users/')[1].replace('\n','')
|
||||
domain=args.actor.split('/users/')[0]
|
||||
else:
|
||||
nickname=args.actor.split('/profile/')[1].replace('\n','')
|
||||
domain=args.actor.split('/profile/')[0]
|
||||
else:
|
||||
# format: @nick@domain
|
||||
if '@' not in args.actor:
|
||||
|
|
|
@ -373,9 +373,9 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
|
|||
if debug:
|
||||
print('DEBUG: follow request has no actor')
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor')
|
||||
print('DEBUG: "users" or "profile" missing from actor')
|
||||
return False
|
||||
domain,tempPort=getDomainFromActor(messageJson['actor'])
|
||||
fromPort=port
|
||||
|
@ -397,9 +397,9 @@ def receiveFollowRequest(session,baseDir: str,httpPrefix: str, \
|
|||
if not messageJson.get('to'):
|
||||
messageJson['to']=messageJson['object']
|
||||
handle=nickname.lower()+'@'+domain.lower()
|
||||
if '/users/' not in messageJson['object']:
|
||||
if '/users/' not in messageJson['object'] and '/profile/' not in messageJson['object']:
|
||||
if debug:
|
||||
print('DEBUG: "users" not found within object')
|
||||
print('DEBUG: "users" or "profile" not found within object')
|
||||
return False
|
||||
domainToFollow,tempPort=getDomainFromActor(messageJson['object'])
|
||||
if not domainPermitted(domainToFollow,federationList):
|
||||
|
|
36
inbox.py
36
inbox.py
|
@ -505,9 +505,9 @@ def receiveUndoFollow(session,baseDir: str,httpPrefix: str, \
|
|||
if debug:
|
||||
print('DEBUG: follow request has no actor within object')
|
||||
return False
|
||||
if '/users/' not in messageJson['object']['actor']:
|
||||
if '/users/' not in messageJson['object']['actor'] and '/profile/' not in messageJson['object']['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor within object')
|
||||
print('DEBUG: "users" or "profile" missing from actor within object')
|
||||
return False
|
||||
if messageJson['object']['actor'] != messageJson['actor']:
|
||||
if debug:
|
||||
|
@ -564,9 +564,9 @@ def receiveUndo(session,baseDir: str,httpPrefix: str, \
|
|||
if debug:
|
||||
print('DEBUG: follow request has no actor')
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor')
|
||||
print('DEBUG: "users" or "profile" missing from actor')
|
||||
return False
|
||||
if not messageJson.get('object'):
|
||||
if debug:
|
||||
|
@ -679,9 +679,9 @@ def receiveUpdate(session,baseDir: str, \
|
|||
if debug:
|
||||
print('DEBUG: '+messageJson['type']+' object has no type')
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor in '+messageJson['type'])
|
||||
print('DEBUG: "users" or "profile" missing from actor in '+messageJson['type'])
|
||||
return False
|
||||
|
||||
if messageJson['object']['type']=='Person' or \
|
||||
|
@ -742,9 +742,9 @@ def receiveLike(session,handle: str,baseDir: str, \
|
|||
if debug:
|
||||
print('DEBUG: '+messageJson['type']+' has no "to" list')
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor in '+messageJson['type'])
|
||||
print('DEBUG: "users" or "profile" missing from actor in '+messageJson['type'])
|
||||
return False
|
||||
if '/statuses/' not in messageJson['object']:
|
||||
if debug:
|
||||
|
@ -791,9 +791,9 @@ def receiveUndoLike(session,handle: str,baseDir: str, \
|
|||
if debug:
|
||||
print('DEBUG: '+messageJson['type']+' like object is not a string')
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor in '+messageJson['type']+' like')
|
||||
print('DEBUG: "users" or "profile" missing from actor in '+messageJson['type']+' like')
|
||||
return False
|
||||
if '/statuses/' not in messageJson['object']['object']:
|
||||
if debug:
|
||||
|
@ -852,9 +852,9 @@ def receiveDelete(session,handle: str,baseDir: str, \
|
|||
if debug:
|
||||
print('DEBUG: '+messageJson['type']+' has no "to" list')
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor in '+messageJson['type'])
|
||||
print('DEBUG: "users" or "profile" missing from actor in '+messageJson['type'])
|
||||
return False
|
||||
if '/statuses/' not in messageJson['object']:
|
||||
if debug:
|
||||
|
@ -906,9 +906,13 @@ def receiveAnnounce(session,handle: str,baseDir: str, \
|
|||
if debug:
|
||||
print('DEBUG: '+messageJson['type']+' has no "to" list')
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor in '+messageJson['type'])
|
||||
print('DEBUG: "users" or "profile" missing from actor in '+messageJson['type'])
|
||||
return False
|
||||
if '/users/' not in messageJson['object'] and '/profile/' not in messageJson['object']:
|
||||
if debug:
|
||||
print('DEBUG: "users" or "profile" missing in '+messageJson['type'])
|
||||
return False
|
||||
if '/statuses/' not in messageJson['object']:
|
||||
if debug:
|
||||
|
@ -949,9 +953,9 @@ def receiveUndoAnnounce(session,handle: str,baseDir: str, \
|
|||
return False
|
||||
if messageJson['object']['type']!='Announce':
|
||||
return False
|
||||
if '/users/' not in messageJson['actor']:
|
||||
if '/users/' not in messageJson['actor'] and '/profile/' not in messageJson['actor']:
|
||||
if debug:
|
||||
print('DEBUG: "users" missing from actor in '+messageJson['type']+' announce')
|
||||
print('DEBUG: "users" or "profile" missing from actor in '+messageJson['type']+' announce')
|
||||
return False
|
||||
if '/statuses/' not in messageJson['object']:
|
||||
if debug:
|
||||
|
|
4
like.py
4
like.py
|
@ -505,7 +505,7 @@ def outboxLike(baseDir: str,httpPrefix: str, \
|
|||
if debug:
|
||||
print('DEBUG: c2s like object is not a status')
|
||||
return
|
||||
if '/users/' not in messageId:
|
||||
if '/users/' not in messageId and '/profile/' not in messageId:
|
||||
if debug:
|
||||
print('DEBUG: c2s like object has no nickname')
|
||||
return
|
||||
|
@ -560,7 +560,7 @@ def outboxUndoLike(baseDir: str,httpPrefix: str, \
|
|||
if debug:
|
||||
print('DEBUG: c2s undo like object is not a status')
|
||||
return
|
||||
if '/users/' not in messageId:
|
||||
if '/users/' not in messageId and '/profile/' not in messageId:
|
||||
if debug:
|
||||
print('DEBUG: c2s undo like object has no nickname')
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue