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
8bcae4c09d
Protocol.receive: following protocol user enables that protocol
...
for #880
2024-04-18 16:09:09 -07:00
Ryan Barrett
d36885728f
Protocol.receive: blocking protocol user disables that protocol
...
for #880
2024-04-18 16:03:51 -07:00
Ryan Barrett
39a641e000
remove USER_ALLOWLIST in favor of User.enabled_protocols
2024-04-17 17:02:17 -07:00
Ryan Barrett
259b7d72dd
start on conditional opt in
...
* add Protocol.DEFAULT_ENABLED_PROTOCOLS
* add User.enabled_protocols
* move common.is_enabled to Protocol.is_enabled_to, include opt out/in
2024-04-17 16:43:10 -07:00
Ryan Barrett
393605bde9
change ATProto.ABBREV to bsky
...
🤞 , for #961
2024-04-17 06:54:16 -07:00
Ryan Barrett
2ec22de09f
abstract redirect.py to be multi-protocol
...
...mostly. creating the underlying user opportunistically is still Web-only.
2024-04-14 18:26:34 -07:00
Ryan Barrett
5ec2159546
user page: link to bridged Bluesky profile
...
for #825
2024-04-12 08:46:59 -07:00
Ryan Barrett
ea1f3dce49
user page bug fix for 133d640f1d
2024-04-12 07:16:06 -07:00
Ryan Barrett
5767ffabb5
add new Object.normalize_ids method, use in Protocol.receive
...
eg https://bsky.app/ ... URLs to DIDs for actors or at:// URIs for objects
this hopefully fixes web => ATProto follows of https://bsky.app/ ... profile URLs.
2024-04-09 13:07:57 -07:00
Ryan Barrett
c57e905204
Protocol.for_id: add remote kwarg
2024-04-09 10:48:05 -07:00
Ryan Barrett
5c470a4647
consider opted out Web domains in ActivityPub.status, not is_blocklisted
...
follow-up to df321234c0
2024-03-31 18:50:01 -07:00
Ryan Barrett
df321234c0
load and include Web.manual_opt_out users in Protocol.is_blocklisted
2024-03-28 09:18:35 -07:00
Ryan Barrett
878bbde328
atproto: handle bsky.app URLs in load, not fetch
2024-03-14 15:40:25 -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
7bf29d411f
atproto: only enable indieweb.org and snarfed.org, for now
2024-03-13 13:07:30 -07:00
Ryan Barrett
663063e06c
test_integrations: add ATProto => Web follow
2024-03-12 21:41:05 -07:00
Ryan Barrett
c9c74ac6b3
suppress many Protocol.load logging messages
2024-03-12 11:12:34 -07:00
Ryan Barrett
c0b75e4fbd
Protocol.load: return None if the entity is too big
...
fixes https://console.cloud.google.com/errors/detail/CO-fpZfMq_6ktgE;time=P30D?project=bridgy-federated
2024-03-11 15:31:31 -07:00
Ryan Barrett
8288390cfd
AP inbox delivery, Protocol.receive: error on blocklisted ids
...
fixes https://console.cloud.google.com/errors/detail/CN278MyjhZbtOQ;time=P30D?project=bridgy-federated , https://console.cloud.google.com/errors/detail/CLSnttKfy4v90wE;time=P30D?project=bridgy-federated
2024-02-27 06:42:19 -08:00
Ryan Barrett
8cb3628270
Protocol.targets: bug fix for self replies
2024-02-12 19:02:00 -08:00
Ryan Barrett
ddbd7f3fec
protocol.load: allow an object to switch protocols
...
fixes https://console.cloud.google.com/errors/detail/CPb-q_DKzvrYOw;time=P30D?project=bridgy-federated
2024-02-10 22:12:44 -08:00
Ryan Barrett
484c637219
authorization check: handle domain vs homepage for web users
...
for #566
2024-02-10 10:30:25 -08:00
Ryan Barrett
6a63820cd8
tighten Object.owns_id to reject blocklisted domains
...
fixes https://console.cloud.google.com/errors/detail/CLSnttKfy4v90wE;time=P30D?project=bridgy-federated
2024-02-08 14:41:15 -08:00
Ryan Barrett
c966090912
Protocol.load: reload objects if our copy is over 30d old
...
fixes #628
no clue how much this will impact our outbound request load. we'll see!
2024-02-08 11:23:09 -08:00
Ryan Barrett
3bcef0d37d
follow UI: specific error message for trying to follow bridged accounts
...
thanks for the nudge @campegg!
2024-01-25 17:05:26 -08:00
Ryan Barrett
bab5270c3b
start clearing Object.our_as1 again on updates
...
fixes #778 . bug was that when we fetched a web object, we'd populate the new `mf2` value, but still keep the old `our_as1`, which then overrode it in `as1`. ugh.
partially reverts commit 62ca4022fb
for #721 .
2024-01-08 13:03:44 -08:00
Ryan Barrett
6e236e2d70
switch User.ap_actor to id_as, use Web.ap_subdomain property
2023-11-30 17:10:18 -08:00
Ryan Barrett
62ca4022fb
stop clearing Object data properties
...
...so that we have original data preserved when we override it in our_as1. fixes #721
2023-11-28 06:39:34 -08:00
Ryan Barrett
ee373095e2
send follow accepts to protocols that support them
...
for #710
2023-11-27 16:32:22 -08:00
Ryan Barrett
8f7facda97
don't automatically accept follows from protocols that support them natively
...
for #710 . adds per-protocol `HAS_FOLLOW_ACCEPTS` constant
2023-11-27 14:44:05 -08:00
Ryan Barrett
8f0d2d8650
AP: handle opted out users in following/ers, outbox collections
2023-11-27 11:32:30 -08:00
Ryan Barrett
b81fa2090b
Protocol.receive: handle opted out users
2023-11-27 06:53:22 -08:00
Ryan Barrett
03315891aa
drop a lot of g.user
...
for #690
2023-11-25 20:23:19 -08:00
Ryan Barrett
1591dfb641
pass user to Protocol.send/convert instead of using g.user
...
for #690
2023-11-25 20:07:14 -08:00
Ryan Barrett
e947891d75
Protocol.receive: fail if incoming activity doesn't have actor or author
...
for #690
2023-11-25 14:50:08 -08:00
Ryan Barrett
fefcbbb77e
drop Protocol.actor_key's default_g_user kwarg
...
for #690
2023-11-19 21:53:38 -08:00
Ryan Barrett
4d095fa3d9
misc cleanup
...
* remove obsolete TODOs, commented out code
* remove obsolete circular imports of per-protocol modules
* minimize Object put in Protocol.load
* remove duplicated Protocol.load tests in test_activitypub
* re-enable rest of ActivityPubUtilsTest.test_postprocess_as2_idempotent
* drop default cls=Web in TestCase.make_user
2023-11-15 14:23:08 -08:00
Ryan Barrett
95631396b7
atproto: fill in createdAt
...
for snarfed/granary@a0795b8c34
2023-11-14 15:24:51 -08:00
Ryan Barrett
cbbea104fc
cache Protocol.for_id
...
fixes #727
2023-11-13 14:18:32 -08:00
Ryan Barrett
91c25f6955
testutil noop, TestCase.make_user: include source_protocol in profile Object
2023-11-13 14:08:21 -08:00
Ryan Barrett
12158eba64
Protocol.targets bug fix, handle composite inReplyTo
2023-11-13 14:08:21 -08:00
Ryan Barrett
0364ece4a8
stop resolving ids in Protocol.targets, since Protocol.receive already did it
2023-11-12 13:21:35 -08:00
Ryan Barrett
2a7c0adf0f
bug fixes for suppressing mentions of in-reply-to-authors
...
for 84324c0c0b
, #686
2023-11-11 14:52:21 -08:00
Ryan Barrett
84324c0c0b
Protocol.targets: suppress mentions of in-reply-to authors
...
fixes #686
2023-11-10 14:39:40 -08:00
Ryan Barrett
e801d52ed7
Protocol: add force= to /queue/send, allow unknown params in /queue/receive
2023-11-08 11:28:17 -08:00
Ryan Barrett
06275324fd
Web.convert: call translate_ids
2023-11-03 15:52:37 -07:00
Ryan Barrett
fdc5b8e1e9
Protocol.translate_ids bug fix: handle create/update user profile activities
2023-11-03 15:10:05 -07:00
Ryan Barrett
def5638a64
Protocol.translate: distinguish between object and user ids
2023-11-02 13:08:24 -07:00
Ryan Barrett
9aff3122c0
noop: rename get_for_copy[ies] => get_for_original[s]
2023-11-02 13:08:23 -07:00
Ryan Barrett
9358bf2fd2
Protocol.translate_ids: minor tweaks, bug fixes, comments
2023-11-01 12:33:38 -07:00
Ryan Barrett
db646909e2
delivery: switch from threads to tasks, one per send
...
for #652
2023-10-31 12:49:27 -07:00
Ryan Barrett
c280a3f213
switch Protocol.translate_ids from using subdomain_wrap to translate_object_id
2023-10-26 17:18:01 -07:00
Ryan Barrett
cfbfba654e
move User.get_for_copy/ies to module level, add Object results
2023-10-26 16:00:03 -07:00
Ryan Barrett
5843235fd1
rename ids.convert_id => translate_user_id, convert_handle => translate_handle
2023-10-26 13:53:31 -07:00
Ryan Barrett
f74be7b0e5
add Protocol.convert_wrap
2023-10-26 13:53:31 -07:00
Ryan Barrett
3471476092
Revert "Protocol.receive: bump up threads from 10 to 30"
...
Seemed to make things worse, not better. Guess I need to implement continuation passing across task handler requests. #652
This reverts commit 66da2efc7a
.
2023-10-25 12:31:52 -07:00
Ryan Barrett
acb1c703a3
rename Protocol.serve => .convert, move Content-Type to class constant
2023-10-25 12:31:52 -07:00
Ryan Barrett
422a240183
Resolve protocol-subdomain-wrapped ids/URLs by stripping the subdomain wrapping
...
Renames Object.replace_copies_with_originals => resolve_ids. As a side effect, also fixes https://console.cloud.google.com/errors/detail/CK3U3PONxv5Q;time=P30D?project=bridgy-federated
2023-10-24 10:47:44 -07:00
Ryan Barrett
d12fd99b03
noop: move Protocol.subdomain_url to common.subdomain_wrap
2023-10-23 15:44:32 -07:00
Ryan Barrett
16d8832c72
receive: support ?force=true to skip "already seen this id" check
2023-10-19 22:15:14 -07:00
Ryan Barrett
3b88b0f315
AP: don't create "receiving" user in inbox, don't set actor to g.user in send
...
more iffy kinda scary changes. gulp. important though, baby step toward killing g.user! #690
2023-10-19 16:15:40 -07:00
Ryan Barrett
89cd73831b
rework g.user
...
* it's always sending user ie actor
* don't pass it to task from atproto.poll_notifications (we were incorrectly passing the receiving user)
* in Protocol.receive, default g.user to actor/author
* in ActivityPub.signed_request, if g.user is ActivityPub, it won't have AP keys, so use default signing user instead
kinda scary and iffy. 🤞 🤞 🤞
2023-10-18 13:56:53 -07:00
Ryan Barrett
e66ca3fb7f
noop: expand a few log messages
2023-10-18 13:13:44 -07:00
Ryan Barrett
9e1acf1cf7
replace copy ids with originals in Protocol.load
...
honestly not sure if this is necessary yet, and it's moderately expensive, two serial datastore queries with an IN filter. we'll see.
2023-10-18 11:18:20 -07:00
Ryan Barrett
efdf84a023
Protocol.receive: replace copy ids with originals, related bug fixes
2023-10-18 11:03:22 -07:00
Ryan Barrett
b8c7d1cd96
receive_task: set object.new to force receive to process it
2023-10-18 11:03:21 -07:00
Ryan Barrett
fc96959383
tone down logging, especially for polling ATProto notifs
2023-10-18 11:03:21 -07:00
Ryan Barrett
66da2efc7a
Protocol.receive: bump up threads from 10 to 30
...
10 still isn't enough! tantek's ~300 inboxes are still hitting the 10m deadline.
2023-10-16 13:47:54 -07:00
Ryan Barrett
325ba64c66
authorization: block external requests to cloud task handlers
...
...by checking for a GAE Cloud Tasks header: https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_task_request_headers
2023-10-16 13:04:34 -07:00
Ryan Barrett
db3a5e7fd6
authorization: pass and accept authed_as in receive task handler
...
for #566
2023-10-16 12:45:27 -07:00
Ryan Barrett
c83c77a73e
authorization: log when authed user doesn't match activity's author/actor
...
for #566 . just logging for now, want to see if we're already hitting this at all.
2023-10-16 11:13:38 -07:00
Ryan Barrett
55c8d9bec6
authorization: log updates, deletes, creates from the wrong actor
...
for #566 . just logging for now, want to see if we're already hitting this at all.
2023-10-16 06:37:52 -07:00
Ryan Barrett
441c5aa29f
log_data bug fixes
2023-10-14 14:13:13 -07:00
Ryan Barrett
f3039fc87a
Protocol.send: bring back log_data kwarg
2023-10-13 18:29:28 -07:00
Ryan Barrett
d0da119b07
add opt out via #nobridge or #nobot text in user profile bio
...
fixes #666
(unfortunate issue number 😆 )
2023-10-13 12:36:31 -07:00
Ryan Barrett
1b78e86e6c
add Protocol.LOGO_HTML constant, change user page to link to external user
...
for #442
2023-10-11 12:25:38 -07:00
Ryan Barrett
f002b536d9
add thread name to log message prefix to trace across Protocol.deliver threads
2023-10-10 10:13:57 -07:00
Ryan Barrett
5bf081afdb
make Protocol/Web.key_for() follow use_instead
...
fixes #662 . probably more to do here eventually though, eg #665 .
2023-10-10 09:58:07 -07:00
Ryan Barrett
d5499acaf3
AP: parallelize inbox delivery with a thread pool
...
fixes #652 . this should make inbox deliveries roughly 10x faster.
2023-10-07 15:08:02 -07:00
Ryan Barrett
5efd97d867
add Object.lock and new add, remove, and put methods
2023-10-07 13:51:59 -07:00
Ryan Barrett
59abcb00bc
Protocol.send: drop log_data kwarg
...
protocols are responsible for logging objects themselves
2023-10-07 12:54:32 -07:00
Ryan Barrett
7e7962fe45
add orig_obj kwarg to Protocol.send
2023-10-07 12:49:39 -07:00
Ryan Barrett
4909c0814e
deliver self-replies to all followers
...
fixes #639
2023-10-06 14:59:47 -07:00
Ryan Barrett
62302b9105
more docstring formatting tweaks
2023-10-06 08:22:50 -07:00
Ryan Barrett
db29ad7757
docs: fix docstring formatting, other tweaks
2023-10-05 23:32:31 -07:00
Ryan Barrett
e89730e68f
drop /_ah/ path prefix on task handlers
...
...since it's not supported in dispatch.yaml: https://cloud.google.com/appengine/docs/flexible/reference/dispatch-yaml?tab=python#url
2023-09-29 13:49:17 -07:00
Ryan Barrett
03a9295224
noop, tweak logging in protocol.py
2023-09-29 11:32:28 -07:00
Ryan Barrett
01d3b67bed
add Protocol.for_handle
2023-09-29 11:32:28 -07:00
Ryan Barrett
a823dd1d65
use protocol subdomains in AP inbox
...
...and other misc protocol subdomain fixes
2023-09-27 13:55:16 -07:00
Ryan Barrett
771de9770e
AP inbox bug fix: handle Like with null object
...
fixes https://console.cloud.google.com/errors/detail/CIiI9b-nz7-bIA;time=P30D?project=bridgy-federated
2023-09-27 09:43:16 -07:00
Ryan Barrett
e9e8827ef9
standardize more on 'handle' and 'id' terms
...
* User.readable_id => handle
* User.readable_or_key_id => handle_or_id
2023-09-25 12:33:24 -07:00
Ryan Barrett
169f8d7a2c
add Protocol.handle_to_id, implement in all protocols
2023-09-22 13:11:15 -07:00
Ryan Barrett
0d33b6422d
add Protocol.owns_handle (and in subclasses)
2023-09-22 12:17:42 -07:00
Ryan Barrett
6a6a1657a7
rename Protocol.for_domain => for_bridgy_subdomain
2023-09-22 11:55:46 -07:00
Ryan Barrett
5214c77f6a
Protocol.targets: find and add originals for targets that are copies
...
both Object and User originals
2023-09-19 21:52:28 -07:00
Ryan Barrett
5107d003fe
Object.as1: genericize converting actor/author id from copy to original
2023-09-19 19:59:28 -07:00
Ryan Barrett
8e15a7559d
noop: TODO in Protocol.receive_task to use it for web/AP too
2023-09-19 11:47:43 -07:00
Ryan Barrett
f7792f81c8
tasks: add user param to receive, make create_task run inline in local server
2023-09-19 11:15:49 -07:00
Ryan Barrett
cae19172c9
Protocol: add receive task handler
2023-09-18 19:19:59 -07:00
Ryan Barrett
fd6e371635
make Protocol._targets use per-protocol blocklist check
2023-09-09 15:11:52 -07:00
Ryan Barrett
0d2e4fb66a
noop: protocol: label classmethod cls identifiers with from/to
2023-09-09 14:19:27 -07:00
Ryan Barrett
8b242e65ba
move common.is_blacklisted to Protocol so that subclasses can override it
2023-09-06 17:35:15 -07:00
Ryan Barrett
e18dabf510
implement ATProto.target_for, .fetch for at:// URIs
2023-08-31 10:48:28 -07:00
Ryan Barrett
3d23618b1b
Protocol.receive: handle unknown protocol for followeee
...
fixes https://console.cloud.google.com/errors/detail/CKjCqOC34bL3SQ;time=P30D?project=bridgy-federated
2023-07-25 09:53:23 -07:00
Ryan Barrett
414fa5f197
Protocol.receive: resume existing create if it's not complete
2023-07-24 14:07:44 -07:00
Ryan Barrett
17fe6db6eb
change Protocol.key_for to return None instead of raise on invalid user ids
...
hopefully fixes https://console.cloud.google.com/errors/detail/CKWmwa7SybLcQw;time=P30D?project=bridgy-federated
2023-07-22 20:32:55 -10:00
Ryan Barrett
c3f9c56c31
Protocol.receive: drop fed.brid.gy domain check
...
this happens after protocols pre-process objects and eg fill in BF AP actor ids. moved this check to *.send and user entity pre post hooks instead. for #597
2023-07-22 20:11:12 -10:00
Ryan Barrett
ad893b1a97
update test_activitypub, test_web for new Object.notify/feed props
...
added in 95d0a695aa30c06880c218a96a98f591850a0a3c
2023-07-17 05:34:56 -10:00
Ryan Barrett
57350ab81a
switch from Object.users + labels to users + notify + feed lists
...
needed to distinguish an activity's owners from who it should notify from who should see it in their feeds.
also, unrelated, start sending stop-following activities.
in progress, test_web and test_activitypub still need updating.
2023-07-17 05:34:56 -10:00
Ryan Barrett
764494be16
Protocol.receive follow: send accept for every followee, not just the last one
2023-07-17 05:34:56 -10:00
Ryan Barrett
e0a75b07bc
extract out the non-BF-specific parts of Protocol._targets into as1.targets
...
in snarfed/granary@91fde3201e
2023-07-15 14:23:09 -07:00
Ryan Barrett
e194ccb3ad
Protocol.load/fetch returns True/False (or None) to mean "not this protocol"
...
ie, nothing failed, but the given id eitehr doesn't below to the given protocol, or fetched successfully but its data belongs to a different protocol.
vs raising exceptions for fetches that fail or error, eg network connection problems, Web got HTML with microformats2 but no h-entry, ActivityPub got non-AS2, etc.
used in Protocol.for_id: when a given Protocol's fetch doesn't work, we move on and try the next protocol _if_ it returned False (ie wasn't fetchable with that protocol, but we fail fast if it raises an exception (ie fetch failed).
2023-07-14 12:58:47 -07:00
Ryan Barrett
0e47918a38
merging receive: skip same-protocol deliveries and Followers
...
for #529
2023-07-13 14:21:13 -07:00
Ryan Barrett
815ae95560
merging receive: bug fix for same domain check: normalize target URLs earlier
...
for #529 , a3f99a81ce
2023-07-11 13:25:32 -07:00
Ryan Barrett
174c55ae6e
merging receive: implement mentions, deliver to mentioned users
...
for #529
2023-07-11 13:25:31 -07:00
Ryan Barrett
605742a82c
merging receive: skip same-domain targets
...
for #529
2023-07-11 13:25:31 -07:00
Ryan Barrett
0d7df6d4e6
merging receive: handle follow with multiple objects (followees)
...
for #529
2023-07-11 13:25:31 -07:00
Ryan Barrett
ceb72e516c
Web.send: ignore accept activities
...
webmention/mf2 have no corrolary yet
2023-07-11 13:25:31 -07:00
Ryan Barrett
911dc56367
merging receive: check for already seen activity ids more carefully
...
for #529
2023-07-11 13:25:30 -07:00
Ryan Barrett
2c861dbbf4
merging receive: if incoming object has no id (eg web/mf2), default to URL
...
for #529
2023-07-11 13:25:30 -07:00
Ryan Barrett
56ebdba049
merging receive: propagate new/changed from receive into new Object
...
for #529
2023-07-11 13:25:30 -07:00
Ryan Barrett
79dd28eeb3
merging receive: Object.users bug fix, fix most test_activitypub tests
...
for #529
2023-07-11 13:25:30 -07:00
Ryan Barrett
9c62786f06
merging receive: delivery bug fix, stop suppressing webmention send errors
...
for #529
2023-07-11 13:25:30 -07:00
Ryan Barrett
5f4d6757e7
merging Protocol/Web receive: minor fix for extracting activity id
...
for #529
2023-07-11 13:25:30 -07:00
Ryan Barrett
568681a19e
merging Protocol/Web receive: start to work through test_web
...
for #529
2023-07-11 13:25:30 -07:00
Ryan Barrett
ab24b8680f
start using Protocol.owner_key
2023-07-11 13:25:30 -07:00
Ryan Barrett
3333509f5b
add Protocol.owner_key
2023-07-11 13:25:30 -07:00
Ryan Barrett
79c1f71a58
merging Protocol/Web receive: use actor for deletes, not g.user
...
for #529
2023-07-11 13:25:30 -07:00
Ryan Barrett
903f26bb0a
merging Protocol/Web receive: reposts, deletes
...
for #529
2023-07-11 13:25:29 -07:00
Ryan Barrett
b3a3de73f2
extend Web/ActivityPub.owns_id() to return False if blocklisted
2023-07-11 13:25:29 -07:00
Ryan Barrett
2ea78a894b
merging Protocol/Web receive: tests for repost, update reply
...
for #529
2023-07-11 13:25:29 -07:00
Ryan Barrett
ee3a596dbb
Summary merging Protocol/Web receive: change receive to take Object
...
for #529
2023-07-11 13:25:29 -07:00
Ryan Barrett
3ceeae418f
add Object.activity_changed
2023-07-11 13:25:29 -07:00
Ryan Barrett
6157f3f3b5
merging Protocol/Web receive: improve logic for bare objects
...
for #529
2023-07-11 13:25:29 -07:00
Ryan Barrett
4f8bcf9606
merging Protocol/Web receive: move _deliver, _targets from Web to Protocol
...
for #529
2023-07-11 13:25:29 -07:00
Ryan Barrett
d0d6a13044
merging Protocol/Web receive: tweaks to Object.users, Object.labels
...
for #529
2023-07-11 13:25:28 -07:00
Ryan Barrett
ecbc76dd94
minor, use common.add a few more places
2023-07-11 13:25:28 -07:00
Ryan Barrett
54881ea707
lots more on merging Protocol/Web receive and deliver
...
for #529
2023-07-11 13:25:28 -07:00
Ryan Barrett
f254dea004
merge Protocol.receive: follow tweaks, like test
...
for #529
2023-07-11 13:25:28 -07:00
Ryan Barrett
be7aa50eac
start merging web.webmention_task into Protocol.receive
...
for #529
2023-07-11 13:25:28 -07:00
Ryan Barrett
0caca9243e
add common.add to add to repeated properties only if not already there
...
tried a bunch of other more sophisticated ways to do this in snarfed/webutil@280a93e092 (plus snarfed/webutil@6cb9c1f719 ), tried a custom repeated property class that acted like a set instead of a list, but couldn't get it to work reliably or compatibly enough.
2023-06-29 22:15:07 -07:00
Ryan Barrett
342f67dfa2
Protocol.load bug fix, leave new/changed None if we don't know for sure
...
eg if local is False
2023-06-28 15:27:11 -07:00
Ryan Barrett
45d1468825
Protocol.deliver bug fix for normalizing target URLs
...
fixes https://console.cloud.google.com/errors/detail/CKnQ7sWFhfODRQ;time=P30D?project=bridgy-federated
2023-06-27 22:31:15 -07:00
Ryan Barrett
40ae3dec8e
start to port test_activitypub tests to test_protocol, using Fake protocol
...
also minor tweaks to Protocol.deliver
2023-06-27 09:48:47 -07:00
Ryan Barrett
9140318f4a
generalize Protocol.accept_follow, other bug fixes in Protocol.receive
...
for #529 , fixes https://console.cloud.google.com/errors/detail/CMbJ6a6j56LErwE;time=P30D?project=bridgy-federated
2023-06-26 20:22:55 -07:00
Ryan Barrett
c5d3dfb967
generalize protocol.accept_follow away from AP/AS2
...
didn't realize those bits were still there!
2023-06-25 12:54:44 -07:00
Ryan Barrett
65b4f1495f
Protocol.receive: fail "intra-BF" activities from ourselves
...
for #558
2023-06-23 11:20:29 -07:00
Ryan Barrett
c97ee862a5
Protocol.load: return copies of cached objects, not the originals
...
...so that modifications aren't durable in memory until we put() them. for #558
2023-06-22 12:30:25 -07:00
Ryan Barrett
2a7425a8c6
formalize Protocol.target_for() to take any object, not just actors
...
important because webmention endpoints are per page (object), not per site (actor).
2023-06-20 17:06:32 -07:00
Ryan Barrett
ab1c28ee4d
noop, lint fixes from flake8
...
remaining:
$ flake8 --extend-ignore=E501 *.py tests/*.py
"pyflakes" failed during execution due to "'FlakesChecker' object has no attribute 'NAMEDEXPR'"
Run flake8 with greater verbosity to see more details
activitypub.py:15:1: F401 'oauth_dropins.webutil.util.json_loads' imported but unused
activitypub.py:36:1: F401 'web' imported but unused
activitypub.py:48:1: E302 expected 2 blank lines, found 1
activitypub.py:51:9: F811 redefinition of unused 'web' from line 36
app.py:6:1: F401 'flask_app.app' imported but unused
app.py:9:1: F401 'activitypub' imported but unused
app.py:9:1: F401 'convert' imported but unused
app.py:9:1: F401 'follow' imported but unused
app.py:9:1: F401 'pages' imported but unused
app.py:9:1: F401 'redirect' imported but unused
app.py:9:1: F401 'superfeedr' imported but unused
app.py:9:1: F401 'ui' imported but unused
app.py:9:1: F401 'webfinger' imported but unused
app.py:9:1: F401 'web' imported but unused
app.py:9:1: F401 'xrpc_actor' imported but unused
app.py:9:1: F401 'xrpc_feed' imported but unused
app.py:9:1: F401 'xrpc_graph' imported but unused
app.py:9:19: E401 multiple imports on one line
models.py:19:1: F401 'oauth_dropins.webutil.util.json_loads' imported but unused
models.py:364:31: E114 indentation is not a multiple of four (comment)
models.py:364:31: E116 unexpected indentation (comment)
protocol.py:17:1: F401 'oauth_dropins.webutil.util.json_loads' imported but unused
redirect.py:26:1: F401 'oauth_dropins.webutil.util.json_loads' imported but unused
web.py:18:1: F401 'oauth_dropins.webutil.util.json_loads' imported but unused
webfinger.py:13:1: F401 'oauth_dropins.webutil.util.json_loads' imported but unused
webfinger.py:110:13: E122 continuation line missing indentation or outdented
webfinger.py:111:13: E122 continuation line missing indentation or outdented
webfinger.py:131:13: E122 continuation line missing indentation or outdented
webfinger.py:132:13: E122 continuation line missing indentation or outdented
webfinger.py:133:13: E122 continuation line missing indentation or outdented
webfinger.py:134:13: E122 continuation line missing indentation or outdented
tests/__init__.py:2:1: F401 'oauth_dropins.webutil.tests' imported but unused
tests/test_follow.py:11:1: F401 'oauth_dropins.webutil.util.json_dumps' imported but unused
tests/test_follow.py:14:1: F401 '.testutil.Fake' imported but unused
tests/test_models.py:156:15: E122 continuation line missing indentation or outdented
tests/test_models.py:157:15: E122 continuation line missing indentation or outdented
tests/test_models.py:158:11: E122 continuation line missing indentation or outdented
tests/test_web.py:12:1: F401 'oauth_dropins.webutil.util.json_dumps' imported but unused
tests/test_web.py:17:1: F401 '.testutil' imported but unused
tests/test_web.py:1513:13: E128 continuation line under-indented for visual indent
tests/test_web.py:1514:9: E124 closing bracket does not match visual indentation
tests/testutil.py:106:1: E402 module level import not at top of file
tests/testutil.py:107:1: E402 module level import not at top of file
tests/testutil.py:108:1: E402 module level import not at top of file
tests/testutil.py:109:1: E402 module level import not at top of file
tests/testutil.py:110:1: E402 module level import not at top of file
tests/testutil.py:301:24: E203 whitespace before ':'
tests/testutil.py:301:25: E701 multiple statements on one line (colon)
tests/testutil.py:301:25: E231 missing whitespace after ':'
2023-06-20 11:29:31 -07:00
Ryan Barrett
f5133b3ee3
bug fix for Protocol.load with remote=False and existing empty Object
...
fixes https://console.cloud.google.com/errors/detail/CI7JpJWfoff1Ew;time=P30D?project=bridgy-federated
2023-06-18 22:26:30 -07:00
Ryan Barrett
21ab9e34ed
Revise Protocol.load shallow and refresh kwargs, rename to local and remote
...
and use in for_id to optimize datastore usage.
2023-06-18 07:30:40 -07:00
Ryan Barrett
146abbf718
add shallow kwarg to Protocol.load
2023-06-17 14:13:17 -07:00
Ryan Barrett
1821e90f36
add Object.as_as2()
2023-06-16 14:09:28 -07:00
Ryan Barrett
374354a21f
add Protocol.target_for()
...
for #529
2023-06-16 13:16:17 -07:00
Ryan Barrett
d3c4415cd3
migrate User.actor_as2 to obj key pointing to Object
...
for #547
2023-06-15 21:23:31 -07:00
Ryan Barrett
002c6a9740
add Protocol.subdomain_url()
...
for #512 , #548
2023-06-14 14:57:59 -07:00
Ryan Barrett
ed734f3532
Protocol.receive: finish full protocol inference based on target ids
...
for #548 , #512
2023-06-14 13:46:13 -07:00
Ryan Barrett
bfb462e414
Protocol.for_id: handle null Object.source_protocol
2023-06-13 21:36:56 -07:00
Ryan Barrett
e6f72f33b6
Web.load: default check_backlink kwarg to False, pass it through to fetch
2023-06-13 20:24:42 -07:00
Ryan Barrett
7b3aeb2e8e
add Protocol.key_for to let us normalize Web keys from http://x.com/ => x.com
...
for #548 , #512
2023-06-13 14:30:00 -07:00
Ryan Barrett
730fa9155d
handle per-protocol subdomains in Protocol.for_id
...
for #548
2023-06-13 13:43:41 -07:00
Ryan Barrett
48c40c10a8
add Protocol.for_id and .owns_id
...
fixes #548
2023-06-13 13:21:30 -07:00
Ryan Barrett
98ec4fafdd
Protocol.for_domain: add fed kwarg, support URLs as well as domains
2023-06-12 22:05:13 -07:00
Ryan Barrett
436595c2a2
AP users: generalize protocol in Protocol.deliver
...
for #512
2023-06-12 21:43:08 -07:00
Ryan Barrett
fed9e40145
AP users: generalize sending class in Protocol.receive
...
for #512
2023-06-12 20:52:42 -07:00
Ryan Barrett
3448ec7368
AP users: generalize receiving class in Protocol.receive
...
for #512
2023-06-12 19:01:50 -07:00
Ryan Barrett
f951c143e3
fix tests for 0902994af0
2023-06-12 15:50:47 -07:00
Ryan Barrett
cb1f80832f
AP users: add Protocol.ABBREV, Protocol.OTHER_LABELS
...
for #512
2023-06-11 08:14:17 -07:00
Ryan Barrett
510cd036bf
AP users: add Protocol.for_domain and for_request
...
getting ready to serve per-protocol subdomains, eg nostr.brid.gy, ap.brid.gy, etc
for #512
2023-06-10 19:55:08 -07:00
Ryan Barrett
cb5e7bf8c7
noop, minor protocol generalization and cleanup
...
for #512
2023-06-10 15:07:26 -07:00
Ryan Barrett
c98ab3f2d5
AP users: Object schema change, domains => users
...
also for AP => wm, only try to send webmentions to domains that we already have an existing Web user for. the vast majority of targets are fediverse URLs, and we were trying to send them all wms, ie at least running wm discovery and finding nothing. harmless, but a waste.
2023-06-09 12:56:45 -07:00
Ryan Barrett
05f244b86f
AP => wm follow bug fix: store correct actor_as2, not Follow object
...
🤦
fixes https://console.cloud.google.com/errors/detail/CKOFx6_Wrfzf6wE;time=P30D?project=bridgy-federated
2023-06-09 12:28:13 -07:00
Ryan Barrett
afbb453043
AP users: finish migrating follow.py to Follower schema with new from/to
...
for #512 , fixes https://console.cloud.google.com/errors/detail/CPn404XJ2rC6rAE;time=P30D?project=bridgy-federated
2023-06-07 23:51:41 -07:00
Ryan Barrett
7c82bf7ec5
AP users: finish migrating Follower from string domains/ids to User keys
...
for #512
2023-06-07 19:06:44 -07:00
Ryan Barrett
71dadc2ba5
AP users: ignore webmention sending failures
...
since webmention support is optional for web users: https://fed.brid.gy/docs#error-handling
for #512
2023-06-04 15:11:52 -07:00
Ryan Barrett
daba73ce38
update a few user page links in the web UI, /user/ => /web/
...
for #512
2023-06-03 08:03:38 -07:00
Ryan Barrett
9d1dc652f9
Protocol.load: bug fix, handle Object.as1 going from non-None to None
...
fixes https://console.cloud.google.com/errors/detail/CI3L3MzXjPza9gE;time=P30D?project=bridgy-federated
2023-06-02 21:53:44 -07:00
Ryan Barrett
35060c172a
switch actor_id() and address90 back to User methods, to be implemented by subclasses
...
partially reverts 9e906f18e4
2023-05-31 10:10:14 -07:00
Ryan Barrett
9e906f18e4
move address, actor_id from User to activitypub.py, /web-site to web.py
...
for #512
2023-05-30 17:24:49 -07:00
Ryan Barrett
47b04f5574
rename Web.LABEL from 'webmention' to 'web'
2023-05-30 12:15:36 -07:00
Ryan Barrett
6e834713f1
when replying to Follow with Accept, include original Follow object verbatim
...
notably, including id. fixes #522 (again)
2023-05-29 19:04:26 -07:00
Ryan Barrett
c8b2103e13
rename Webmention class => Web, webmention.py => web.py
2023-05-26 17:40:29 -07:00
Ryan Barrett
eaa4e5333a
start to make User subclasses for each protocol
...
#512
2023-05-26 16:07:36 -07:00
Ryan Barrett
cf86f4d808
AP users: extract out Protocol.serve() method
...
#512
2023-05-23 21:30:57 -07:00
Ryan Barrett
892047a10c
add Protocol metaclass and protocol.protocols global for storing subclasses
2023-05-23 15:15:28 -07:00
Ryan Barrett
d2ab48b23e
switch circular imports to runtime imports; split out flask_app.py from app.py
...
runtime imports are just as bad, but...meh. eventually I'll untangle them for real. #486
2023-04-18 17:18:17 -07:00
Ryan Barrett
212f2b11ec
wm => AP: add delete support
...
fixes #30
2023-04-17 15:36:29 -07:00
Ryan Barrett
629c1a2bd4
unify Object.new/changed generation into Protocol.load
...
also:
* switch back to preserving fragments in URL ids
* webmention.fetch: if URL id redirects, preserve original id in Object
2023-04-03 07:53:15 -07:00
Ryan Barrett
3a97ba587d
noop: Protocol.load: switch from @cached decorator to manual cache
...
...so that I can add a refresh kwarg that bypasses the cache
2023-04-02 20:36:23 -07:00
Ryan Barrett
e41ce9216c
noop, rename Protocol.get_object => Protocol.load
2023-03-29 13:13:32 -07:00
Ryan Barrett
e6be9cabb8
incoming AP: when we can't load the keyId, store a deleted Object
...
prevents re-fetching the same failing keyId actor over and over when we get the same Delete actor activity sent to all of our inboxes
2023-03-29 12:51:37 -07:00
Ryan Barrett
5493e2f297
add 'activity' to Object.labels automatically in new _pre_put_hook
2023-03-28 11:14:08 -07:00
Ryan Barrett
68de408789
Protocol.get_object(): store object before returning
...
also flesh out FakeProtocol
hopefully helps with https://console.cloud.google.com/errors/detail/CKCN17fmoZHraw;time=P30D?project=bridgy-federated , don't really know though
2023-03-27 14:14:37 -07:00
Ryan Barrett
28e8baff6c
change Protocol.fetch() to return an Object instead of populating one
2023-03-22 20:49:28 -07:00
Ryan Barrett
acf474e2a9
standardize fetch(id, obj) args
2023-03-20 19:25:05 -07:00
Ryan Barrett
88dd51b05b
continue abstracting logic in Protocol class
...
lots more to do.
also convert Object.as1 to AS2 in ActivityPub.send if necessary.
2023-03-20 19:17:55 -07:00
Ryan Barrett
fb5f7b3fb0
move current user into Flask g request-global
2023-03-20 14:28:14 -07:00
Ryan Barrett
b2c60226b7
add Webmention.send, tweak method signature
2023-03-20 11:26:43 -07:00
Ryan Barrett
bf15f4ca95
fix wm => AP reposts
...
fixes #453
2023-03-19 16:21:44 -07:00
Ryan Barrett
5e3c623552
add User.actor_id()
2023-03-19 09:34:42 -07:00
Ryan Barrett
6ce9a83181
don't add notification label unless an activity involves the user
...
for #442 (ish)
2023-03-13 20:38:46 -07:00
Ryan Barrett
71174b69f9
don't deliver replies to followers
...
also start new test_protocol file. fixes #444 .
2023-03-13 17:25:10 -07:00
Ryan Barrett
01768fd58e
move accept_follow from activitypub to protocol
2023-03-11 13:01:23 -08:00
Ryan Barrett
9cc8451182
fix webmention endpoint discovery cache key
...
#423
2023-03-11 12:14:48 -08:00
Ryan Barrett
76e26a7c2c
cache webmention endpoint discovery for 2h
2023-03-10 22:24:58 -08:00
Ryan Barrett
deb4b12659
AS2: short circuit out on Delete actor that we don't have stored
...
...since when we try to fetch the actor to get their key to verify the signature, we get an HTTP 410 response, at least from Mastodon.
2023-03-10 07:36:50 -08:00
Ryan Barrett
ffd8810b44
start to separate logic from protocols with new Protocol/ActivityPub classes
...
for #388
2023-03-10 07:36:50 -08:00