Wykres commitów

42 Commity (1280982e97d7fcaafeb3bebc5b4a6eb9a58d1585)

Autor SHA1 Wiadomość Data
Ryan Barrett 714c317dd4
Protocol.targets: only deliver reposts, replies etc if the original post was bridged
for #1166, #1151, maybe others. #1151 is the big motivation here: that we're currently generating and sending Bluesky a ton of reposts with blank subject cid/URL, which afaict is the main reason bridging is getting stuck for some accounts and the relay is constantly calling `getRepo`. I'm hoping this will reduce or eliminate that.

this isn't a big behavior change, but it is a kind of big change to routing logic. it's tested pretty well, but I still expect something to break. we'll see.
2024-07-09 17:29:02 -07:00
Ryan Barrett 0dce5c108d
integration test for ATProto => AP undo block
for #1162
2024-07-09 07:41:23 -07:00
Ryan Barrett 08b41b0ede
test Protocol.targets for undo block, special case in activitypub.postprocess_as2
for #1162
2024-07-06 19:36:11 -07:00
Ryan Barrett 6e7667c266
ATProto.send and nearby: don't assume that ids are already translated
for refactoring opt_out.py to be more generic
2024-06-22 16:41:23 -07:00
Ryan Barrett 81bb033e68
Protocol.receive: on bot user follow, refresh profile id, not just actor id
fixes https://console.cloud.google.com/errors/detail/CIvu-KTludO5LA;time=P7D?project=bridgy-federated
2024-06-20 14:19:17 -07:00
Ryan Barrett 4a197549cd
migrate old ATProto integration tests from polling to firehose
for #689
2024-06-18 20:41:00 -07:00
Ryan Barrett da5d434595
bug fix for deleting bridged fediverse actors: translate object as actor id
...not as object id. for #783, 81319a7628
2024-06-14 12:54:55 -07:00
Ryan Barrett 616073f788
merge hub and atproto_firehose services into a single service, atproto_hub
atproto_firehose is averaging 20-40% CPU right now, hub 5-10%, and both are 500-600M memory steady state, so they can easily fit together.
2024-06-13 12:02:54 -07:00
Ryan Barrett 417a88a2a6
ATProto: support new off-lexicon originalDescription and originalUrl fields
for snarfed/bridgy-fed#1092
2024-06-12 15:22:45 -07:00
Ryan Barrett 796edf2033
Protocol.receive: drop direct targets if user isn't bridged into their protocol
fixes https://console.cloud.google.com/errors/detail/CMHloZaRmPXQZQ;time=P30D?project=bridgy-federated
2024-06-08 15:08:12 -07:00
Ryan Barrett 0046f6436e
ATProto: when creating repo, store chat declaration to disable DMs
for https://github.com/snarfed/bridgy-fed/issues/1101
2024-06-04 20:22:31 -07:00
Ryan Barrett cc564a2b19
turn on authorization checks! HTTP sig matches actor, actor is allowed to modify object
for #566
2024-06-03 14:12:08 -07:00
Ryan Barrett 24559c8f17
Protocol.receive: normalize ids before resolving
for #959, and possibly others
2024-06-02 08:41:52 -07:00
Ryan Barrett ae8b6ca7b6
fix test_activitypub_follow_bsky_bot_bad_username_error for d789fd10b6 2024-05-23 15:39:45 -07:00
Ryan Barrett 7f72a62081
ATProto: delete polling code and config
for #978. end of a (brief) era!
2024-05-22 14:28:17 -07:00
Ryan Barrett b4124bd23f
AP: wrap content in <p> tag to preserve whitespace
for #990

this assumes an implementation detail of fediverse servers: that they apply a white-space: pre-wrap style to <p>s inside content. awkward overreach, but useful since white-space: pre-wrap preserves more whitespace (eg leading spaces on a line, multiple spaces, etc) than just converting newlines to <br>s.
2024-05-20 12:18:41 -07:00
Ryan Barrett 06e2e61b1e
ATProto: switch to granary's logic to populate strongRefs, via DatastoreClient
for #1007
2024-05-16 13:11:29 -07:00
Ryan Barrett 79e5d2be07
bug fix for User.status handling: check for false-ness, not is None
we have some users in the datastore with status None, some with False. 😕 fixes #1048
2024-05-12 19:02:07 -07:00
Ryan Barrett 078bef041e
turn on REQUIRES_AVATAR/NAME for ActivityPub, Bluesky 2024-05-11 16:50:57 -07:00
Ryan Barrett 4da00192b0
when someone follows a bot user to opt in, have the bot user follow them back
fixes #999. this makes sure we start receiving posts from AP users immediately, instead of waiting until a Bluesky opted in user follows them.
2024-05-07 10:54:18 -07:00
Ryan Barrett c98d8fce00
switch ATProto polling from cursor to indexedAt
for #954
2024-05-05 07:31:12 -07:00
Ryan Barrett 0781a4c695
AP inbox delivery: return 422 when a user with a bad handle follows the bot user
for #982
2024-05-04 13:39:39 -07:00
Ryan Barrett ee9bb53745
ATProto: drop trailing slash from PDS URL
the ATProto DID spec says it shouldn't be there: https://atproto.com/specs/did#did-documents

> The serviceEndpoint field must contain an HTTPS URL of server. It should contain only the URI scheme (http or https), hostname, and optional port number, not any "userinfo", path prefix, or other components.

thanks for the nudge @mackuba!
2024-05-01 17:45:48 -07:00
Ryan Barrett cbe4b59206
convert Protocol.is_enabled_to to an instance method
next commit will move it to User
2024-04-27 20:27:33 -07:00
Ryan Barrett 853b4be142
ATroto.send: for flag activities, send createReport to mod service
for snarfed/granary#596. background:
* https://docs.bsky.app/docs/advanced-guides/moderation#reporting
* https://github.com/bluesky-social/atproto/discussions/2350#discussioncomment-8847613
* https://github.com/snarfed/granary/issues/596
2024-04-26 13:59:04 -07:00
Ryan Barrett c065c712f1
more id/handle translation tweaks for protocol bot users
hopefully fixes Accept actor for responding to bot user follows in AP
2024-04-25 14:29:48 -07:00
Ryan Barrett c86c91b25b
User.enable_protocols bug fix: only call create_for for copy protocols
also add integration test for following protocol bot user from ATProto
2024-04-23 16:38:08 -07:00
Ryan Barrett 11eb082190
tighten common.unwrap so it doesn't remove protocol bot user URLs
...like https://bsky.brid.gy/ . this hopefully fixes following bot users in eg AP to enable protocols.
2024-04-23 12:00:39 -07:00
Ryan Barrett 10023d17fd
Protocol.enable_protocol: create copy user if necessary 2024-04-21 12:18:12 -07:00
Ryan Barrett 2886ae180d
remove common.ENABLED_PROTOCOLS, use Protocol.DEFAULT_ENABLED_PROTOCOLS instead
also use is_enabled_to in user page template
2024-04-18 16:39:15 -07:00
Ryan Barrett 393605bde9
change ATProto.ABBREV to bsky
🤞, for #961
2024-04-17 06:54:16 -07:00
Ryan Barrett e913ad1f53
ATProto.convert: refetch subject for cid if we don't have it 2024-04-15 07:31:05 -07:00
Ryan Barrett 131cbd9eb6
add web => ATProto follow integration test 2024-04-09 10:49:14 -07:00
Ryan Barrett 9b2bb9ef37
make ATProto.load([DID]) return the profile record by default
add did_doc kwarg to make it return the DID doc instead
2024-03-13 16:08:08 -07:00
Ryan Barrett 663063e06c
test_integrations: add ATProto => Web follow 2024-03-12 21:41:05 -07:00
Ryan Barrett 95e46c5ebb
Revert "cache outbound HTTP request responses, locally to each inbound request"
This reverts commit 30debfc8fa.

seemed promising, but broke in production. Saw a lot of `IncompleteRead`s on both GETs and POSTs. Rolled back for now.

```
('Connection broken: IncompleteRead(9172 bytes read, -4586 more expected)', IncompleteRead(9172 bytes read, -4586 more expected))
...
File "oauth_dropins/webutil/util.py", line 1673, in call
  resp = getattr((session or requests), fn)(url, *args, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/session.py", line 102, in get
  return self.request('GET', url, params=params, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/session.py", line 158, in request
  return super().request(method, url, *args, headers=headers, **kwargs)  # type: ignore
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests/sessions.py", line 589, in request
  resp = self.send(prep, **send_kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/session.py", line 205, in send
  response = self._send_and_cache(request, actions, cached_response, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/session.py", line 233, in _send_and_cache
  self.cache.save_response(response, actions.cache_key, actions.expires)
File "requests_cache/backends/base.py", line 89, in save_response
  cached_response = CachedResponse.from_response(response, expires=expires)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/models/response.py", line 102, in from_response
  obj.raw = CachedHTTPResponse.from_response(response)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/models/raw_response.py", line 69, in from_response
  _ = response.content  # This property reads, decodes, and stores response content
      ^^^^^^^^^^^^^^^^
File "requests/models.py", line 899, in content
  self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests/models.py", line 818, in generate
  raise ChunkedEncodingError(e)
```
2024-03-11 15:31:30 -07:00
Ryan Barrett 30debfc8fa
cache outbound HTTP request responses, locally to each inbound request
using requests-cache. pretty straightforward! for #588
2024-03-08 12:34:49 -08:00
Ryan Barrett d2865fdb86
add common.ENABLED_BRIDGES, check before conversion and /bridge-user 2024-02-28 12:07:06 -08:00
Ryan Barrett c593a80ee9
fix test_integrations for g.user minimizing in #690 2023-11-19 21:53:39 -08:00
Ryan Barrett bee313fb67
drop User.atproto_did, switch to using copies 2023-11-15 19:08:06 -08:00
Ryan Barrett 507cb19c32
test_integrations: import test_web instead of WebTest to avoid duplicating
before this, unittest thought the imported WebTest was a new test class and ran it again.
2023-11-15 12:40:59 -08:00
Ryan Barrett ac6f98f54c
integration test for #720
BF's first integration test! hopefully more to come, eg snarfed/bridgy-fed#689

actual fix is in snarfed/granary@3c782f9
2023-11-13 14:37:16 -08:00