Ryan Barrett
244dbc6862
DMs: drop welcome special case, don't allow multiple welcome DMs
2024-08-17 16:51:08 -07:00
Ryan Barrett
d7642e0392
AP DMs: wrap in post activity, add mention tag, improve DM vs public handling
2024-08-17 16:48:55 -07:00
Ryan Barrett
14a63b8106
Protocol.maybe_bot_dm bug fix: send a Create activity, not a bare Note
...
for #1205 etc
2024-08-17 14:35:57 -07:00
Ryan Barrett
38b646ef7d
bug fix for DM prompt when unbridged user replies to bridged user
...
use the right reply URL and in-reply-to author name and URL
for #1205
2024-08-17 12:22:05 -07:00
Ryan Barrett
98098aeabb
when an unbridged user replies to a bridged user, DM them a prompt
...
one time only, per user per protocol!
for #1205
2024-08-16 14:03:44 -07:00
Ryan Barrett
ccb7158350
Protocol.check_supported: allow DMs both to and from bot accounts
...
for #1205 , #1148 , #966 , #1024
2024-08-16 14:01:28 -07:00
Ryan Barrett
a185b34052
Protocol.receive: switch more as1.is_dm to as1.recipient_if_dm
2024-08-16 12:46:02 -07:00
Ryan Barrett
0ce8eaff1a
Protocol.bot_dm => maybe_bot_dm, populate and check User.sent_dms
...
for #1205 , #1148 , #966 , #1024
2024-08-15 17:24:25 -07:00
Ryan Barrett
9011fa2cbd
Protocol.for_id: error handling for bad URLs
2024-08-15 14:35:49 -07:00
Ryan Barrett
303ea175cf
Protocol.receive: more undo handling, mark object as deleted
...
also add undo test
for #1243
2024-08-14 13:07:03 -07:00
Ryan Barrett
c086eea9eb
Protocol.targets: only use orig_obj for replies and reposts
...
...not eg link tags. for #1237 , #1257
2024-08-13 17:48:50 -07:00
Ryan Barrett
8d67e79f8f
Protocol.translate_ids: handle multiply valued fields like inReplyTo
2024-08-13 15:51:20 -07:00
Ryan Barrett
f0ef0bb12b
noop: fix log message in /convert/
2024-08-12 21:04:20 -07:00
Ryan Barrett
497136f1fc
cache Protocol.for_handle
2024-08-12 13:39:11 -07:00
Ryan Barrett
e21dabe98d
noop: Protocol.targets refactoring, source protocol isn't in to_protocols
...
for #1248
2024-08-12 13:39:10 -07:00
Ryan Barrett
67567ca589
noop: Protocol.targets refactoring for to_protocols loop
2024-08-12 13:39:10 -07:00
Ryan Barrett
5d5a983564
Protocol.bot_follow: handle when user has no profile obj
...
fixes https://console.cloud.google.com/errors/detail/CIvu-KTludO5LA;time=P1D;locations=global?project=bridgy-federated
2024-08-11 08:51:08 -07:00
Ryan Barrett
eebea504b6
Protocol.bot_dm: handle when recipient has no profile obj
...
fixes https://console.cloud.google.com/errors/detail/CIGR6crBlMKMBg;locations=global;time=P30D?project=bridgy-federated
2024-08-11 08:41:44 -07:00
Ryan Barrett
b0f6b1799b
Protocol.bot_dm: log full text
2024-08-09 12:12:26 -07:00
Ryan Barrett
925771562f
add Protocol.SUPPORTS_DMS
...
for #1024 , #966 , etc
2024-08-08 20:41:57 -07:00
Ryan Barrett
cd0a4bce9e
AP: add outbound DM support
...
for #1024 , #966 , etc
2024-08-08 20:35:56 -07:00
Ryan Barrett
23aa24eb4f
User.enable_protocol: send welcome DM
...
via new Protocol.bot_dm method
for #1024 , #966 , etc
2024-08-08 20:17:06 -07:00
Ryan Barrett
5f1a99d6cd
Protocol.translate_ids: support multiple objects
2024-08-05 21:22:41 -07:00
Ryan Barrett
3acde571ad
more minor logging optimizations
...
for https://github.com/snarfed/bridgy-fed/issues/1149
2024-08-02 10:39:25 -07:00
Ryan Barrett
70dd6d3ceb
minor logging optimizations
...
for https://github.com/snarfed/bridgy-fed/issues/1149
2024-08-02 08:03:44 -07:00
Ryan Barrett
5679d696a4
cache models.get_originals in memory
...
for #1149
2024-08-01 16:20:13 -07:00
Ryan Barrett
d769d03a4f
Protocol.check_supported: block DMs (for now)
2024-07-31 23:12:47 -07:00
Ryan Barrett
caa8dd2341
Protocol.delete_user_copy: use better id for delete activity
...
that's more likely to pass Protocol.owns_id for all protocols. (this was failing ATProto)
2024-07-27 16:40:56 -07:00
Ryan Barrett
5454e19a23
ATProto.handle_to_id: skip opted out/blocked users
...
for #1215
2024-07-27 08:55:53 -07:00
Ryan Barrett
05ad4d8ccd
Protocol.receive: set expiration on memcache activity id "done" entries
2024-07-27 08:55:53 -07:00
Ryan Barrett
8bdcd1ff1b
protocol: minor log tweak
2024-07-25 18:18:53 -07:00
Ryan Barrett
96846c2f2a
protocol, activitypub: drop some verbose logging from INFO down to DEBUG
2024-07-25 14:44:15 -07:00
Ryan Barrett
37e70104e5
drop unused protocol.seen_ids, we switched it to memcache a bit ago
2024-07-24 14:58:25 -07:00
Ryan Barrett
100a208e5e
add allow_opt_out to Protocol.key_for, User.get_or_create, Protocol.receive internal
...
for #1204
2024-07-23 19:26:30 -07:00
Ryan Barrett
0c797b8b49
Protocol.receive: minor bug fix for logging message
2024-07-19 21:34:37 -07:00
Ryan Barrett
f5bcb98d5e
log message tweaks for receive, send
2024-07-18 17:05:21 -07:00
Ryan Barrett
b3b825f66c
tweak receive activity logging msg
2024-07-18 15:23:40 -07:00
Ryan Barrett
f1713e68d9
drop a bunch of log messages from info to debug
...
...and other logging tweaks
for https://github.com/snarfed/bridgy-fed/issues/1060
2024-07-18 14:15:12 -07:00
Ryan Barrett
1280982e97
load LIMITED_DOMAINS from env var if available
...
for #1089
2024-07-16 14:28:45 -07:00
Ryan Barrett
bf11eb8649
Protocol.send_task: retry writing results to Object more aggressively
...
this has high contention during inbox delivery.
for https://console.cloud.google.com/errors/detail/CJm_4sDv9O-iKg;time=P7D?project=bridgy-federated
2024-07-16 13:58:43 -07:00
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
Ryan Barrett
7e594e3227
authz: move NO_AUTH_DOMAINS (a.gup.pe) from Protocol.receive to activitypub.inbox
...
for #566
2024-05-30 13:34:14 -07:00
Ryan Barrett
9f33767f33
authz: move LD Sig check from Protocol.receive to activitypub.inbox
...
for #566
2024-05-29 21:17:38 -07:00
Ryan Barrett
8f5d8221a9
add ids.profile_id, use everywhere
...
for #566
2024-05-29 16:18:15 -07:00
Ryan Barrett
bfbae4b280
authz: normalize user ids before comparing, in both receive and Object.get_or_create
...
for #566
2024-05-29 12:29:38 -07:00
Ryan Barrett
d8910d52cd
LIMITED_DOMAINS bug fix, read lines from file separately
2024-05-28 20:40:48 -07:00
Ryan Barrett
ea0f61f446
authz: when comparing domains, handle common subdomains like www
...
for #566
2024-05-28 20:36:18 -07:00
Ryan Barrett
f2a64c8b5c
Object.get_or_create: rename actor => authed_as, add to all calls
...
for #566
2024-05-28 16:07:32 -07:00
Ryan Barrett
820f7fa4f4
authz: add protocol.NO_AUTH_DOMAINS for domains we can't authorize yet
...
...eg a.gup.pe. https://github.com/snarfed/bridgy-fed/issues/566#issuecomment-2130714037
2024-05-28 15:23:22 -07:00
Ryan Barrett
fc14298f0d
authz: expand LD Sigs check to any signature field, regardless of creator
...
for #566
2024-05-28 15:15:23 -07:00
Ryan Barrett
03672679b9
activitypub, protocol: misc noop logging and code style tweaks
2024-05-27 20:38:49 -07:00