Wykres commitów

319 Commity (55ef7de2f7ebfba9ae1eab404dfab46fef478f07)

Autor SHA1 Wiadomość Data
Ryan Barrett 4ff28ca377
minor noop refactorings 2024-07-15 20:09:33 -07:00
Ryan Barrett 1a23d8eba3
Protocol.targets: when adding in-reply-to, check from user's enabled protocols
fixes https://console.cloud.google.com/errors/detail/CMHloZaRmPXQZQ;time=P7D?project=bridgy-federated
2024-07-14 13:42:38 -07:00
Ryan Barrett 2a83cbb0d8
Protocol.targets: bug fix for self replies
this bug snuck in because of our special case handling of Fake and OtherFake in Protocol.targets. ugh. need to get rid of that, and elsewhere, eg ids.*.

fixes #1179
2024-07-13 12:58:06 -07:00
Ryan Barrett 1f73058ef6
Protocol.receive, ActivityPub.inbox: consolidate memcache key for seen activities 2024-07-12 08:21:30 -07:00
Ryan Barrett 7b0151b0cf
memcache: truncate keys at 250 chars
max memcache key len:
https://github.com/memcached/memcached/wiki/Commands#standard-protocol
https://pymemcache.readthedocs.io/en/latest/apidoc/pymemcache.client.base.html

fixes https://console.cloud.google.com/errors/detail/CNPzqYzWg4_TyQE;time=P30D?project=bridgy-federated
2024-07-12 07:50:54 -07:00
Ryan Barrett 06f3694c9d
Protocol.receive: return HTTP 299 for deterministic errors to prevent retries
for https://github.com/snarfed/bridgy-fed/issues/1063
2024-07-10 21:04:04 -07:00
Ryan Barrett 89e2372922
Protocol.receive: detect and prevent duplicate calls for the same object
for https://github.com/snarfed/bridgy-fed/issues/1063, should fix it. coming up with the test for this was fun!
2024-07-10 20:59:03 -07:00
Ryan Barrett 6879aa93b0
noop: Protocol.targets: revise a misleading log message 2024-07-09 19:17:04 -07:00
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 893176fb56
Protocol.targets bug fix for undo share
fixes https://console.cloud.google.com/errors/detail/CJK54eaoneesMg;time=P30D?project=bridgy-federated
2024-07-09 07:41:24 -07:00
Ryan Barrett 23e1a90c88
Protocol.targets bug fix for 71ebc99: don't add object to feed if internal call
for https://console.cloud.google.com/errors/detail/CMzg3eXbyOi1ygE;time=P1D?project=bridgy-federated
2024-07-09 07:41:24 -07:00
Ryan Barrett 4b0146c590
Protocol.targets: skip copy protocol if inReplyTo or repost original wasn't copied there
once more with feeling!

for #1166
2024-07-09 07:41:24 -07:00
Ryan Barrett 71ebc99a9f
Protocol.targets: give undo same targets as the activity it's undoing
for #1162
2024-07-07 17:21:37 -07:00
Ryan Barrett 2189652a1d
Protocol.maybe_accept_follow: switch send from inline to task 2024-07-05 23:20:34 -07:00
Ryan Barrett e5a6ebf228
drop Protocol.HAS_FOLLOW_ACCEPTS in favor of SUPPORTED_AS1_TYPES 2024-07-05 23:12:35 -07:00
Ryan Barrett 17ced85c6f
Protocol.receive: support blocks
for #1162
2024-07-05 22:46:52 -07:00
Ryan Barrett 2d1cb80e80
Protocol.check_supported bug fix: handle undo of activity 2024-07-05 12:26:59 -07:00
Ryan Barrett fa1ae889d8
Protocol.check_supported: don't report error, just log 2024-07-04 22:13:28 -07:00
Ryan Barrett b606924d63
refactor SUPPORTED_AS1_TYPES usage into new Protocol.check_supported method 2024-07-04 21:11:38 -07:00
Ryan Barrett 850d681f83
add Protocol.SUPPORTED_AS1_TYPES 2024-07-04 16:58:06 -07:00
Ryan Barrett 036ccb8d16
fix a few errant AS1 'create' verbs to 'post' 2024-06-30 21:29:06 -07:00
Ryan Barrett b87b4aa5f8
Protocol.receive: stop special casing replies, bridge them everywhere more often
For https://github.com/snarfed/bridgy-fed/issues/1047#issuecomment-2195298955 . This is a bit of a YOLO, I'm a bit apprehensive about it: I'm jettisoning much of the reply-specific logic in Protocol.receive and instead delivering replies across protocols more often. Still only delivering self-replies to followers though, not other replies.

🤞🤞🤞
2024-06-27 13:20:07 -07:00
Ryan Barrett 45b48c6efb
Protocol.translate_ids: bug fix for ac2df74 for attachments with blocklisted url
fixes https://console.cloud.google.com/errors/CO25nvfq2Ojq0gE?project=bridgy-federated&time=P30D& , https://console.cloud.google.com/errors/CO2h-5yh276BQw?project=bridgy-federated&time=P30D& , etc

for #1154
2024-06-26 11:07:18 -07:00
Ryan Barrett ac2df747a6
Protocol.translate_ids: fix user-visible quote post URL
broken by a735396, for #1154 and #461
2024-06-25 21:10:33 -07:00
Ryan Barrett 308501236e
Protocol.receive bug fix for 350e234b9c
for #1047
2024-06-25 15:57:55 -07:00
Ryan Barrett 350e234b9c
Protocol.receive: bridge native replies if the in-reply-to was bridged
for https://github.com/snarfed/bridgy-fed/issues/1047
2024-06-25 13:37:14 -07:00
Ryan Barrett a735396864
Protocol.translate_ids: add attachment.url
for https://github.com/snarfed/bridgy-fed/issues/461 , fixes AP => ATProto quote post of AP original post that was bridged
2024-06-25 12:27:43 -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 a59eb8c466
Protocol.maybe_accept_follow: pass authed_as to Object.get_or_create
fixes https://console.cloud.google.com/errors/detail/CM7b86Se9r_qfQ;time=P7D?project=bridgy-federated
2024-06-20 13:08:35 -07:00
Ryan Barrett 3d3ac1e9f4
ATProto.send: implement stop-following
hopefullly fixes https://console.cloud.google.com/errors/detail/CPvA_dLO4r_hIA;time=P7D?project=bridgy-federated
2024-06-19 19:59:55 -07:00
Ryan Barrett 679e89c175
Protocol.translate_ids: add AS1 attachments[].id
needed for quote posts, #461
2024-06-17 16:36:44 -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 81319a7628
when a Bluesky user blocks the ap.brid.gy bot, delete their bridged fediverse profile
for #783
2024-06-13 21:47:19 -07:00
Ryan Barrett fdca3b6d55
Protocol.receive: don't attempt to deliver to followers on non-enabled protocols
mostly just handles this more gracefully. these deliveries were failing anyway, just not cleanly. fixes eg https://console.cloud.google.com/errors/detail/CMHloZaRmPXQZQ;time=P30D?project=bridgy-federated , probably others too
2024-06-13 12:02:54 -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 aca0a060a3
Protocol.send_task: only interpret HTTP exceptions as failures; re-raise others
this contributed to hiding the root cause of #1121. log:

```
Running send task 6251425858687873358
Params: [('obj', 'ahBicmlkZ3ktZmVkZXJhdGVkclYLEgZPYmplY3QiSmh0dHBzOi8vaW5kaWV3ZWIuc29jaWFsL3VzZXJzL3NuYXJmZWQvc3RhdHVzZXMvMTEyNTgyNzgwNzcwODQzNjQ1L2FjdGl2aXR5DA'), ('orig_obj', ''), ('protocol', 'atproto'), ('url', 'https://atproto.brid.gy'), ('user', 'ahBicmlkZ3ktZmVkZXJhdGVkcjYLEgtBY3Rpdml0eVB1YiIlaHR0cHM6Ly9pbmRpZXdlYi5zb2NpYWwvdXNlcnMvc25hcmZlZAw')]
Sending https://indieweb.social/users/snarfed/statuses/112582780770843645/activity AS1: ...
Using server at https://api.bsky.app
Determining protocol for id https://indieweb.social/users/snarfed/statuses/112582780770843645
  Key('Object', 'https://indieweb.social/users/snarfed/statuses/112582780770843645') owned by source_protocol activitypub
Can't translate object id https://indieweb.social/users/snarfed/statuses/112582780770843645 to atproto , haven't copied it there yet!
Determining protocol for id https://indieweb.social/users/snarfed
  Key('Object', 'https://indieweb.social/users/snarfed') owned by source_protocol activitypub
Using server at https://bsky.social/
"name 'link_length' is not defined
Traceback (most recent call last):
  File "/workspace/protocol.py", line 1611, in send_task
    sent = PROTOCOLS[protocol].send(obj, url, from_user=user, orig_obj=orig_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/atproto.py", line 423, in send
    record = to_cls.convert(base_obj, fetch_blobs=True, from_user=from_user)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/protocol.py", line 540, in convert
    converted = cls._convert(obj, from_user=from_user, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/atproto.py", line 610, in _convert
    ret = bluesky.from_as1(cls.translate_ids(obj.as1), blobs=blobs,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "granary/bluesky.py", line 577, in from_as1
    text = src.truncate(full_text, None, OMIT_LINK)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "granary/source.py", line 908, in truncate
    truncated = brevity.shorten(content, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "brevity.py", line 247, in shorten
    base_length = total_length(tokens)
                  ^^^^^^^^^^^^^^^^^^^^
  File "brevity.py", line 188, in total_length
    return sum(token_length(t) for t in tokens)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "brevity.py", line 188, in <genexpr>
    return sum(token_length(t) for t in tokens)
               ^^^^^^^^^^^^^^^
  File "brevity.py", line 183, in token_length
    return link_length
           ^^^^^^^^^^^
NameError: name 'link_length' is not defined"
```
2024-06-08 13:20:34 -07:00
Ryan Barrett e761f23324
Protocol: noop, comment tweak and TODO 2024-06-08 13:14:56 -07:00
Ryan Barrett 026d99edc0
pass ignore_links=True to html_to_text everywhere
for #976
2024-06-06 18:14:35 -07:00
Ryan Barrett 27fc843825
Protocol.add_source_links bug fixes, handle actors inside create/update activities
for #976
2024-06-06 11:40:25 -07:00
Ryan Barrett be30afd55a
ATProto: use plain text URLs domains in "bridged by Bridgy Fed" profile text
for #976
2024-06-06 08:58:09 -07:00
Ryan Barrett 9e18b7f110
tweak "bridged by Bridgy Fed" links in profile: use handle, add source protocol
for #976
2024-06-06 08:58:09 -07:00
Ryan Barrett ad81b1883e
refactor Protocol.convert, extract out new add_source_links method
for #976
2024-06-06 08:58:08 -07:00
Ryan Barrett 3fe402e54c
drop Object cache in Protocol.load 2024-06-04 14:27:04 -07:00
Ryan Barrett 5e2dacc21f
Protocol.send_task: if send returns False, return 204, not 304
send returns False when the object or target URL are undeliverable. retries shouldn't fix this, so we don't want to retry.
2024-06-04 12:30:50 -07:00
Ryan Barrett 712da61181
auth error reporting: standardize messages, include HTTP context
trying to collect them into two top-level Error Reporting errors, with details for each one in the user field

for #566
2024-06-04 11:27:17 -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 5266974731
Protocol.for_id: make Web own bot actor AP ids, not bot protocol 2024-06-02 08:21:18 -07:00
Ryan Barrett a2376f8f14
prune more logging messages 2024-06-01 07:17:44 -07:00