activitypub:
parent
bdc298f268
commit
929d59dde4
|
@ -2,9 +2,12 @@ import overseer.apis.v1.base as base
|
|||
import overseer.apis.v1.whitelist as whitelist
|
||||
import overseer.apis.v1.endorsements as endorsements
|
||||
import overseer.apis.v1.guarantees as guarantees
|
||||
import overseer.apis.v1.activitypub as activitypub
|
||||
from overseer.apis.v1.base import api
|
||||
|
||||
api.add_resource(base.Suspicions, "/instances")
|
||||
api.add_resource(activitypub.User, "/user/<string:username>")
|
||||
api.add_resource(activitypub.Inbox, "/inbox/<string:username>")
|
||||
api.add_resource(whitelist.Whitelist, "/whitelist")
|
||||
api.add_resource(whitelist.WhitelistDomain, "/whitelist/<string:domain>")
|
||||
api.add_resource(endorsements.Endorsements, "/endorsements/<string:domain>")
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
from overseer.apis.v1.base import *
|
||||
from overseer.utils import get_nodeinfo
|
||||
|
||||
class User(Resource):
|
||||
get_parser = reqparse.RequestParser()
|
||||
|
||||
@api.expect(get_parser)
|
||||
@cache.cached(timeout=10)
|
||||
def get(self, username):
|
||||
'''User details
|
||||
'''
|
||||
self.args = self.get_parser.parse_args()
|
||||
if username != "overseer":
|
||||
raise e.NotFound("User does not exist")
|
||||
with open('public.pem', 'r') as file:
|
||||
pubkey = file.read()
|
||||
overseer = {
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1"
|
||||
],
|
||||
|
||||
"id": "https://overseer.dbzer0.com/api/v1/user/overseer",
|
||||
"type": "Person",
|
||||
"preferredUsername": "overseer",
|
||||
"inbox": "https://overseer.dbzer0.com/api/v1/inbox/overseer",
|
||||
|
||||
"publicKey": {
|
||||
"id": "https://overseer.dbzer0.com/api/v1/user/overseer#main-key",
|
||||
"owner": "https://overseer.dbzer0.com/api/v1/user/overseer",
|
||||
"publicKeyPem": pubkey
|
||||
}
|
||||
}
|
||||
return overseer,200
|
||||
|
||||
class Inbox(Resource):
|
||||
post_parser = reqparse.RequestParser()
|
||||
|
||||
@api.expect(post_parser)
|
||||
def post(self, username):
|
||||
'''User Inbox
|
||||
'''
|
||||
if username != "overseer":
|
||||
raise e.NotFound("User does not exist")
|
||||
self.args = self.post_parser.parse_args()
|
||||
print("inbox hit")
|
||||
return {"message": "delivered"}, 200
|
|
@ -47,7 +47,7 @@ def wellknown_redirect():
|
|||
{
|
||||
"rel": "self",
|
||||
"type": "application/activity+json",
|
||||
"href": "https://overseer.dbzer0.com/actor"
|
||||
"href": "https://overseer.dbzer0.com/api/v1/user/overseer"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue