Wykres commitów

168 Commity (main)

Autor SHA1 Wiadomość Data
Ryan Barrett 414fa5f197
Protocol.receive: resume existing create if it's not complete 2023-07-24 14:07:44 -07: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 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 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 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 e20ef91afe
uncomment remaining test_protocol receive tests so I don't forget them 2023-07-11 13:25:31 -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 9c62786f06
merging receive: delivery bug fix, stop suppressing webmention send errors
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 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 26a63e116b
merging Protocol/Web receive: test_send_error
for #529
2023-07-11 13:25:29 -07:00
Ryan Barrett 903f26bb0a
merging Protocol/Web receive: reposts, deletes
for #529
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 6157f3f3b5
merging Protocol/Web receive: improve logic for bare objects
for #529
2023-07-11 13:25:29 -07:00
Ryan Barrett ee4da3561c
merging Protocol/Web receive: tweak error handling, de-dupe target URLs
for #529
2023-07-11 13:25:28 -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 83f069ac0f
merging Protocol/Web receive: more follow tests
for #529
2023-07-11 13:25:28 -07:00
Ryan Barrett aeeea5590d
merging Protocol/Web receive: handle bare reply objects
for #529
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 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 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 65b4f1495f
Protocol.receive: fail "intra-BF" activities from ourselves
for #558
2023-06-23 11:20:29 -07:00
Ryan Barrett cba4845394
disable ndb in-memory cache
it has a bug/weird behavior that we want to avoid, at least for now.

https://github.com/googleapis/python-ndb/issues/888
https://github.com/snarfed/bridgy-fed/issues/558
2023-06-22 14:27:02 -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 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 6c0afb4d5c
test_protocol: add Protocol.load test for cache 2023-06-18 22:37:28 -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 bbcb8de44a
noop test refactoring: finally unify request context push/pop into testutil 2023-06-15 15:09:03 -07:00
Ryan Barrett 60a4a2bb9f
move domain non-TLD validation from webfinger into Web
fixes https://console.cloud.google.com/errors/detail/CMG7h4PJju67Og;time=P30D?project=bridgy-federated
2023-06-15 11:25:31 -07:00
Ryan Barrett 002c6a9740
add Protocol.subdomain_url()
for #512, #548
2023-06-14 14:57:59 -07:00
Ryan Barrett bfb462e414
Protocol.for_id: handle null Object.source_protocol 2023-06-13 21:36:56 -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 fed9e40145
AP users: generalize sending class in Protocol.receive
for #512
2023-06-12 20:52:42 -07:00
Ryan Barrett 0902994af0
webfinger: infer protocol from brid.gy subdomain in request or resource
first commit for inferring protocol. exciting! for #512
2023-06-12 15:50:00 -07:00
Ryan Barrett e7f8710cc4
noop test_protocol for_domain/for_request refactoring 2023-06-12 14:17:44 -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 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 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 9cb8c1f9f2
AP users: start migrating Follower from string domains/ids to User keys
for #512
2023-06-07 12:43:48 -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 29f1a1d4ac
AP users: start parameterizing URLs, including UI pages and AP endpoints
user pages now have /[protocol]/ prefix, AP endpoints have /ap/ prefix. for #512
2023-05-30 16:38:58 -07:00
Ryan Barrett 47b04f5574
rename Web.LABEL from 'webmention' to 'web' 2023-05-30 12:15:36 -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 892047a10c
add Protocol metaclass and protocol.protocols global for storing subclasses 2023-05-23 15:15:28 -07:00
Ryan Barrett f933c7e237
AP users: serve AS2 for external homepage URLs
#512
2023-05-22 23:17:42 -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 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 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 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 fb5f7b3fb0
move current user into Flask g request-global 2023-03-20 14:28:14 -07:00
Ryan Barrett aeb2fd480a
tests: rename remaining test data hostnames to clarify web vs fediverse
followup to f6e5727602
2023-03-19 15:43:55 -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