Porównaj commity

...

6 Commity

Autor SHA1 Wiadomość Data
Ryan Barrett df321234c0
load and include Web.manual_opt_out users in Protocol.is_blocklisted 2024-03-28 09:18:35 -07:00
dependabot[bot] c1f0d6b0dd build(deps): bump pyasn1 from 0.5.1 to 0.6.0
Bumps [pyasn1](https://github.com/pyasn1/pyasn1) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/pyasn1/pyasn1/releases)
- [Changelog](https://github.com/pyasn1/pyasn1/blob/main/CHANGES.rst)
- [Commits](https://github.com/pyasn1/pyasn1/compare/v0.5.1...v0.6.0)

---
updated-dependencies:
- dependency-name: pyasn1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-27 05:33:20 -07:00
dependabot[bot] 0676a64ffc build(deps): bump pyasn1-modules from 0.3.0 to 0.4.0
Bumps [pyasn1-modules](https://github.com/pyasn1/pyasn1-modules) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/pyasn1/pyasn1-modules/releases)
- [Changelog](https://github.com/pyasn1/pyasn1-modules/blob/main/CHANGES.txt)
- [Commits](https://github.com/pyasn1/pyasn1-modules/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: pyasn1-modules
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-27 05:27:02 -07:00
Ryan Barrett be4e85ebd5
add missing Object-feed-created index
fixes https://console.cloud.google.com/errors/detail/CO-fpZfMq_6ktgE;time=P30D?project=bridgy-federated
2024-03-24 08:59:54 -04:00
Ryan Barrett 5a1dda151c
ATProto.create_for: better support for local testing 2024-03-24 08:59:54 -04:00
Ryan Barrett e5fde2deb6
hub.py: remove unused import 2024-03-24 08:59:54 -04:00
7 zmienionych plików z 32 dodań i 10 usunięć

Wyświetl plik

@ -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
Wyświetl plik

@ -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

Wyświetl plik

@ -82,6 +82,11 @@ indexes:
- name: updated
direction: desc
- kind: Object
properties:
- name: feed
- name: created
- kind: Object
properties:
- name: feed

Wyświetl plik

@ -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

Wyświetl plik

@ -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):

Wyświetl plik

@ -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

Wyświetl plik

@ -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,