fix: headers
parent
b1122ac048
commit
323809afea
|
@ -7,7 +7,7 @@ from fediseer.flask import OVERSEER
|
|||
from fediseer.routes import *
|
||||
from fediseer.apis import apiv1
|
||||
from fediseer.argparser import args
|
||||
from fediseer.consts import OVERSEER_VERSION
|
||||
from fediseer.consts import FEDISEER_VERSION
|
||||
|
||||
|
||||
OVERSEER.register_blueprint(apiv1)
|
||||
|
@ -18,5 +18,5 @@ def after_request(response):
|
|||
response.headers["Access-Control-Allow-Origin"] = "*"
|
||||
response.headers["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS, PUT, DELETE, PATCH"
|
||||
response.headers["Access-Control-Allow-Headers"] = "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, apikey, Client-Agent, X-Fields"
|
||||
response.headers["Fediseer-Node"] = f"{socket.gethostname()}:{args.port}:{OVERSEER_VERSION}"
|
||||
response.headers["Fediseer-Node"] = f"{socket.gethostname()}:{args.port}:{FEDISEER_VERSION}"
|
||||
return response
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
OVERSEER_VERSION = "0.5.0"
|
||||
FEDISEER_VERSION = "0.5.0"
|
||||
SUPPORTED_SOFTWARE = [
|
||||
"lemmy",
|
||||
"mastodon",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import requests
|
||||
from loguru import logger
|
||||
from pythorhead import Lemmy
|
||||
from fediseer.consts import FEDISEER_VERSION
|
||||
|
||||
def get_lemmy_admins(domain):
|
||||
requested_lemmy = Lemmy(f"https://{domain}")
|
||||
|
@ -36,11 +37,11 @@ def get_nodeinfo(domain):
|
|||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Sec-GPC": "1",
|
||||
"User-Agent": "Fediseer/0.5",
|
||||
"User-Agent": f"Fediseer/{FEDISEER_VERSION}",
|
||||
}
|
||||
wellknown = requests.get(f"https://{domain}/.well-known/nodeinfo", headers=headers, timeout=4).json()
|
||||
wellknown = requests.get(f"https://{domain}/.well-known/nodeinfo", headers=headers, timeout=3).json()
|
||||
headers["Sec-Fetch-Site"] = "cross-site"
|
||||
nodeinfo = requests.get(wellknown['links'][0]['href'], headers=headers, timeout=2).json()
|
||||
nodeinfo = requests.get(wellknown['links'][0]['href'], headers=headers, timeout=3).json()
|
||||
return nodeinfo
|
||||
except Exception as err:
|
||||
logger.debug(err)
|
||||
|
|
|
@ -12,7 +12,7 @@ import fediseer.exceptions as e
|
|||
from pythorhead import Lemmy
|
||||
from loguru import logger
|
||||
from fediseer.database import functions as database
|
||||
from fediseer.consts import SUPPORTED_SOFTWARE
|
||||
from fediseer.consts import SUPPORTED_SOFTWARE, FEDISEER_VERSION
|
||||
from fediseer.fediverse import get_admin_for_software
|
||||
|
||||
class ActivityPubPM:
|
||||
|
@ -92,7 +92,13 @@ class ActivityPubPM:
|
|||
'Date': date,
|
||||
'Signature': header,
|
||||
'Digest': digest_header,
|
||||
'Content-Type': 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"'
|
||||
'Content-Type': 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"',
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Sec-GPC": "1",
|
||||
"User-Agent": f"Fediseer/{FEDISEER_VERSION}",
|
||||
}
|
||||
url = f"https://{domain}/inbox"
|
||||
response = requests.post(url, data=document, headers=headers)
|
||||
|
|
Loading…
Reference in New Issue