kopia lustrzana https://github.com/snarfed/bridgy-fed
Porównaj commity
9 Commity
0c9356746f
...
2f824410ff
Autor | SHA1 | Data |
---|---|---|
dependabot[bot] | 2f824410ff | |
dependabot[bot] | fe41336110 | |
dependabot[bot] | 057fb73e45 | |
Ryan Barrett | 5c470a4647 | |
Ryan Barrett | 55b8063aa8 | |
Ryan Barrett | 4ed45e5af5 | |
dependabot[bot] | 798db9b606 | |
dependabot[bot] | e86b95a117 | |
Ryan Barrett | df321234c0 |
|
@ -8,7 +8,7 @@ from urllib.parse import quote_plus, urljoin, urlparse
|
|||
|
||||
from flask import abort, g, redirect, request
|
||||
from google.cloud import ndb
|
||||
from google.cloud.ndb.query import OR
|
||||
from google.cloud.ndb.query import FilterNode, OR, Query
|
||||
from granary import as1, as2
|
||||
from httpsig import HeaderVerifier
|
||||
from httpsig.requests_auth import HTTPSignatureAuth
|
||||
|
@ -51,6 +51,10 @@ SECURITY_CONTEXT = 'https://w3id.org/security/v1'
|
|||
# https://seb.jambor.dev/posts/understanding-activitypub-part-4-threads/#the-instance-actor
|
||||
_INSTANCE_ACTOR = None
|
||||
|
||||
# populated in User.status
|
||||
WEB_OPT_OUT_DOMAINS = None
|
||||
|
||||
|
||||
def instance_actor():
|
||||
global _INSTANCE_ACTOR
|
||||
if _INSTANCE_ACTOR is None:
|
||||
|
@ -103,6 +107,27 @@ class ActivityPub(User, Protocol):
|
|||
|
||||
return as2.address(self.key.id())
|
||||
|
||||
@ndb.ComputedProperty
|
||||
def status(self):
|
||||
"""Override :meth:`Model.status` and include Web opted out domains."""
|
||||
global WEB_OPT_OUT_DOMAINS
|
||||
if WEB_OPT_OUT_DOMAINS is None:
|
||||
WEB_OPT_OUT_DOMAINS = {
|
||||
key.id() for key in Query(
|
||||
'MagicKey',
|
||||
filters=FilterNode('manual_opt_out', '=', True)
|
||||
).fetch(keys_only=True)
|
||||
}
|
||||
logger.info(f'Loaded {len(WEB_OPT_OUT_DOMAINS)} manually opted out Web users')
|
||||
|
||||
status = super().status
|
||||
if status:
|
||||
return status
|
||||
|
||||
return util.domain_or_parent_in(util.domain_from_link(self.key.id()),
|
||||
WEB_OPT_OUT_DOMAINS)
|
||||
|
||||
|
||||
@classmethod
|
||||
def owns_id(cls, id):
|
||||
"""Returns None if ``id`` is an http(s) URL, False otherwise.
|
||||
|
|
|
@ -21,6 +21,7 @@ from granary import as1, bluesky
|
|||
from lexrpc import Client
|
||||
import requests
|
||||
from requests import RequestException
|
||||
from oauth_dropins.webutil.appengine_config import ndb_client
|
||||
from oauth_dropins.webutil.appengine_info import DEBUG
|
||||
from oauth_dropins.webutil import util
|
||||
from oauth_dropins.webutil.util import json_dumps, json_loads
|
||||
|
@ -40,7 +41,7 @@ from protocol import Protocol
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
arroba.server.storage = DatastoreStorage()
|
||||
arroba.server.storage = DatastoreStorage(ndb_client=ndb_client)
|
||||
|
||||
LEXICONS = Client('https://unused').defs
|
||||
|
||||
|
|
7
hub.py
7
hub.py
|
@ -1,26 +1,19 @@
|
|||
"""Single-instance hub for ATProto and Nostr websocket subscriptions."""
|
||||
from datetime import datetime, timedelta
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from threading import Timer
|
||||
|
||||
import arroba.server
|
||||
from arroba.datastore_storage import DatastoreStorage
|
||||
from arroba import xrpc_sync
|
||||
from flask import Flask, request
|
||||
import google.cloud.logging
|
||||
import lexrpc.client
|
||||
import lexrpc.server
|
||||
import lexrpc.flask_server
|
||||
from oauth_dropins.webutil import (
|
||||
appengine_info,
|
||||
appengine_config,
|
||||
flask_util,
|
||||
util,
|
||||
)
|
||||
import requests
|
||||
|
||||
# all protocols, and atproto-poll-notifs task handler
|
||||
import activitypub, atproto, web
|
||||
|
|
|
@ -42,7 +42,7 @@ google-cloud-audit-log==0.2.5
|
|||
google-cloud-core==2.3.2
|
||||
google-cloud-datastore==2.16.1
|
||||
google-cloud-dns==0.35.0
|
||||
google-cloud-error-reporting==1.10.0
|
||||
google-cloud-error-reporting==1.11.0
|
||||
google-cloud-logging==3.10.0
|
||||
google-cloud-ndb==2.3.1
|
||||
google-cloud-tasks==2.16.3
|
||||
|
@ -57,10 +57,11 @@ html5lib==1.1
|
|||
humanfriendly==10.0
|
||||
humanize==4.9.0
|
||||
idna==3.6
|
||||
iterators==0.2.0
|
||||
itsdangerous==2.1.2
|
||||
Jinja2==3.1.3
|
||||
jsonschema==4.21.1
|
||||
lxml==5.1.0
|
||||
lxml==5.2.0
|
||||
MarkupSafe==2.1.5
|
||||
mf2py==2.0.1
|
||||
mf2util==0.5.2
|
||||
|
@ -73,10 +74,10 @@ pkce==1.0.3
|
|||
praw==7.7.1
|
||||
prawcore==2.4.0
|
||||
proto-plus==1.23.0
|
||||
protobuf==4.24.3
|
||||
protobuf==5.26.1
|
||||
pyasn1==0.6.0
|
||||
pyasn1-modules==0.4.0
|
||||
pycparser==2.21
|
||||
pycparser==2.22
|
||||
pycryptodome==3.20.0
|
||||
pyjwt==2.8.0
|
||||
pymemcache==4.0.0
|
||||
|
|
Ładowanie…
Reference in New Issue