kopia lustrzana https://github.com/snarfed/bridgy-fed
Porównaj commity
6 Commity
f6969c5812
...
df321234c0
Autor | SHA1 | Data |
---|---|---|
Ryan Barrett | df321234c0 | |
dependabot[bot] | c1f0d6b0dd | |
dependabot[bot] | 0676a64ffc | |
Ryan Barrett | be4e85ebd5 | |
Ryan Barrett | 5a1dda151c | |
Ryan Barrett | e5fde2deb6 |
|
@ -208,9 +208,10 @@ class ATProto(User, Protocol):
|
|||
return
|
||||
|
||||
# create new DID, repo
|
||||
logger.info(f'Creating new did:plc for {user.key}')
|
||||
pds_url = common.host_url() if DEBUG else cls.PDS_URL
|
||||
logger.info(f'Creating new did:plc for {user.key} {pds_url}')
|
||||
did_plc = did.create_plc(user.handle_as('atproto'),
|
||||
pds_url=cls.PDS_URL,
|
||||
pds_url=pds_url,
|
||||
post_fn=util.requests_post)
|
||||
|
||||
Object.get_or_create(did_plc.did, raw=did_plc.doc)
|
||||
|
@ -223,7 +224,9 @@ class ATProto(User, Protocol):
|
|||
name = f'_atproto.{handle}.'
|
||||
val = f'"did={did_plc.did}"'
|
||||
logger.info(f'adding GCP DNS TXT record for {name} {val}')
|
||||
if not DEBUG:
|
||||
if DEBUG:
|
||||
logger.info(' skipped since DEBUG is true')
|
||||
else:
|
||||
zone = dns_client.zone(DNS_ZONE)
|
||||
r = zone.resource_record_set(name=name, record_type='TXT', ttl=DNS_TTL,
|
||||
rrdatas=[val])
|
||||
|
|
1
hub.py
1
hub.py
|
@ -8,7 +8,6 @@ from threading import Timer
|
|||
|
||||
import arroba.server
|
||||
from arroba.datastore_storage import DatastoreStorage
|
||||
from arroba.util import service_jwt
|
||||
from arroba import xrpc_sync
|
||||
from flask import Flask, request
|
||||
import google.cloud.logging
|
||||
|
|
|
@ -82,6 +82,11 @@ indexes:
|
|||
- name: updated
|
||||
direction: desc
|
||||
|
||||
- kind: Object
|
||||
properties:
|
||||
- name: feed
|
||||
- name: created
|
||||
|
||||
- kind: Object
|
||||
properties:
|
||||
- name: feed
|
||||
|
|
|
@ -37,7 +37,7 @@ PROTOCOLS = {'ostatus': None}
|
|||
|
||||
# 2048 bits makes tests slow, so use 1024 for them
|
||||
KEY_BITS = 1024 if DEBUG else 2048
|
||||
PAGE_SIZE = 20
|
||||
PAGE_SIZE = 30
|
||||
|
||||
# auto delete old objects of these types via the Object.expire property
|
||||
# https://cloud.google.com/datastore/docs/ttl
|
||||
|
|
17
protocol.py
17
protocol.py
|
@ -11,6 +11,7 @@ from flask import g, request
|
|||
from google.cloud import ndb
|
||||
from google.cloud.ndb import OR
|
||||
from google.cloud.ndb.model import _entity_to_protobuf
|
||||
from google.cloud.ndb.query import FilterNode, Query
|
||||
from granary import as1
|
||||
from oauth_dropins.webutil.flask_util import cloud_tasks_only
|
||||
from oauth_dropins.webutil import util
|
||||
|
@ -44,6 +45,9 @@ SUPPORTED_TYPES = (
|
|||
|
||||
OBJECT_REFRESH_AGE = timedelta(days=30)
|
||||
|
||||
# populated in Protocol.is_blocklisted
|
||||
WEB_DOMAIN_BLOCKLIST = None
|
||||
|
||||
# activity ids that we've already handled and can now ignore.
|
||||
# used in Protocol.receive
|
||||
seen_ids = LRUCache(100000)
|
||||
|
@ -469,8 +473,19 @@ class Protocol:
|
|||
|
||||
Returns: bool:
|
||||
"""
|
||||
global WEB_DOMAIN_BLOCKLIST
|
||||
if WEB_DOMAIN_BLOCKLIST is None:
|
||||
WEB_DOMAIN_BLOCKLIST = {
|
||||
key.id() for key in Query(
|
||||
'MagicKey',
|
||||
filters=FilterNode('manual_opt_out', '=', True)
|
||||
).fetch(keys_only=True)
|
||||
}
|
||||
logger.info(f'Loaded {len(WEB_DOMAIN_BLOCKLIST)} manually opted out Web users')
|
||||
WEB_DOMAIN_BLOCKLIST.update(DOMAIN_BLOCKLIST + DOMAINS)
|
||||
|
||||
return util.domain_or_parent_in(util.domain_from_link(url),
|
||||
DOMAIN_BLOCKLIST + DOMAINS)
|
||||
WEB_DOMAIN_BLOCKLIST)
|
||||
|
||||
@classmethod
|
||||
def translate_ids(to_cls, obj):
|
||||
|
|
|
@ -74,8 +74,8 @@ praw==7.7.1
|
|||
prawcore==2.4.0
|
||||
proto-plus==1.23.0
|
||||
protobuf==4.24.3
|
||||
pyasn1==0.5.1
|
||||
pyasn1-modules==0.3.0
|
||||
pyasn1==0.6.0
|
||||
pyasn1-modules==0.4.0
|
||||
pycparser==2.21
|
||||
pycryptodome==3.20.0
|
||||
pyjwt==2.8.0
|
||||
|
|
|
@ -644,7 +644,7 @@ class ATProtoTest(TestCase):
|
|||
assert did
|
||||
self.assertEqual([Target(uri=did, protocol='atproto')], user.copies)
|
||||
did_obj = ATProto.load(did, did_doc=True)
|
||||
self.assertEqual('https://atproto.brid.gy/',
|
||||
self.assertEqual('http://localhost/',
|
||||
did_obj.raw['service'][0]['serviceEndpoint'])
|
||||
|
||||
# check repo, record
|
||||
|
@ -678,7 +678,7 @@ class ATProtoTest(TestCase):
|
|||
'services': {
|
||||
'atproto_pds': {
|
||||
'type': 'AtprotoPersonalDataServer',
|
||||
'endpoint': 'https://atproto.brid.gy/',
|
||||
'endpoint': 'http://localhost/',
|
||||
}
|
||||
},
|
||||
'prev': None,
|
||||
|
|
Ładowanie…
Reference in New Issue