|
|
@ -16,7 +16,7 @@ A...P... |
|
|
|
|
|
|
|
# Config |
|
|
|
DOMAIN = 'https://ap.virtualprivateserver.space' |
|
|
|
# domain = 'http://localhost:5000' # for local testing only, ActivityPub doesn't allow the usage of http:// (it only accepts https://) |
|
|
|
# domain = 'http://localhost:5010' # for local testing only, ActivityPub doesn't allow the usage of http:// (it only accepts https://) |
|
|
|
|
|
|
|
def publicKey(): |
|
|
|
if not os.path.exists('./public.pem'): |
|
|
@ -36,8 +36,8 @@ APP = flask.Flask(__name__) |
|
|
|
@APP.route('/', methods=['GET']) |
|
|
|
def index(): |
|
|
|
""" Displays the index page accessible at '/' """ |
|
|
|
|
|
|
|
content = f'This ActivityPub Server is running !!! (exciting): ({ DOMAIN })' |
|
|
|
|
|
|
|
content = 'This ActivityPub Server is running !!! (exciting): ({ domain })'.format(domain=DOMAIN) |
|
|
|
return content |
|
|
|
|
|
|
|
@APP.route('/.well-known/webfinger', methods=['GET']) |
|
|
@ -87,10 +87,10 @@ def inbox(actor): |
|
|
|
""" |
|
|
|
|
|
|
|
if flask.request.method == 'GET': |
|
|
|
return f'''This has been a <em>{ flask.request.method }</em> request. <br> |
|
|
|
It came with the following header: <br><br><em>{ flask.request.headers }</em><br><br> |
|
|
|
return '''This has been a <em>{ mode }</em> request. <br> |
|
|
|
It came with the following header: <br><br><em>{ headers }</em><br><br> |
|
|
|
You have searched for the actor <em>{ actor }</em>. <br> |
|
|
|
This is <em>{ DOMAIN }</em>'s shared inbox: <br><br><em>{ str(INBOX) }</em>''' |
|
|
|
This is <em>{ domain }</em>'s shared inbox: <br><br><em>{ inbox }</em>'''.format(mode=flask.request.method, headers=flask.request.headers, actor=actor, somain=DOMAIN, inbox=str(INBOX)) |
|
|
|
|
|
|
|
if flask.request.method == 'POST': |
|
|
|
INBOX.append(flask.request.data) |
|
|
@ -98,4 +98,4 @@ def inbox(actor): |
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
APP.debug=True |
|
|
|
APP.run(port=5001) |
|
|
|
APP.run(port=5010) |