Wykres commitów

342 Commity (f02ba8030491f8851c79563eebed89f8411d9aa5)

Autor SHA1 Wiadomość Data
Ryan Barrett 22b80e4eaf
bug fix for e5abdc0: set g.user before activitypub.postprocess_as2
for #383
2023-11-23 07:57:39 -08:00
Ryan Barrett e5abdc097f
implement outbox
only first page. for #383
2023-11-22 21:40:36 -08:00
Ryan Barrett b255962fde
activitypub: genericize preferredUsername across protocols 2023-11-22 17:24:08 -08:00
Ryan Barrett 9b67d5273f
remove g.user in a few more places in activitypub
for #690
2023-11-20 16:21:20 -08:00
Ryan Barrett eb7da31873
minimize g.user in activitypub.actor
for #690
2023-11-19 21:53:39 -08:00
Ryan Barrett 8b3881dfe3
stop using g.user in pages, activitypub followers/ing collections
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 4c61770017
activitypub: drop circular import of web
for #486
2023-11-15 13:33:39 -08:00
Ryan Barrett 59c6d44f6d
AP: stop using PROTOCOLS in inbox URL routes
for #486
2023-11-15 13:33:39 -08:00
Ryan Barrett 2d4e4afbaa
stop logging headers during sig verification 2023-11-13 21:01:38 -08:00
Ryan Barrett 6498c24d98
AP sig verification bug fix: support lower case sha-256= Digest prefix
found with https://verify.funfedi.dev/?actor_uri=https%3A%2F%2Ffed.brid.gy%2Fsnarfed.org . thanks @HelgeKrueger!
2023-11-12 07:48:48 -08:00
Ryan Barrett d576d2b2e4
move pages.count_followers to User, use it in activitypub.actor 2023-11-08 11:56:01 -08:00
Ryan Barrett ae2cb2825b
activitypub.postprocess_as2: use real AP actor id in key id 2023-11-08 11:28:17 -08:00
Ryan Barrett d2dee8752f
/convert/: if dest protocol is AP, don't assume source protocol is Web 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 aa5c6a396e
ActivityPub: translate ids in convert 2023-11-03 15:11:21 -07:00
Ryan Barrett 625eb66d53
AP actor ids: redirect web and fed.brid.gy/ap/[domain] to fed.brid.gy/[domain] 2023-11-03 06:53:33 -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 b7e890b4bb
heuristic: assume no AP actor id is the root path on its host
this lets us assume home pages are Web users without making any network requests
2023-10-26 17:58:10 -07:00
Ryan Barrett e214e4986b
activitypub.postprocess_as2: remove redundant wrap for Deletes 2023-10-26 13:53:31 -07:00
Ryan Barrett ca8b7484c0
drop User.as2, Object.as_as2, switch callers to Protocol.convert 2023-10-25 13:28:01 -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 6a867ca2c4
update for granary.as2's new PropertyValue attachment handling
snarfed/granary@20d6c3f065
2023-10-24 16:02:16 -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 b32045d494
postprocess_as2: duplicate content into contentMap.en
for #681. this suppresses Mastodon's Translate link. longer term "right" fix is to actually detect the source's language, if available, and use it instead.
2023-10-20 13:37:54 -07:00
Ryan Barrett 6f1bf8a5ef
activitypub: handle query params in URL when checking HTTP Sig 2023-10-19 22:15:39 -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 fe3a9b693c
User.get_or_create: load user profile object, fetch if it doesn't exist 2023-10-19 15:01:19 -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 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 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 3046d2b28c
drop 1k followers limit in UI
fixes #670, at least for now. counting 1200 followers in prod was taking ~200ms; not great, but not horrible. should cache this eventually though!
2023-10-13 09:46:36 -07:00
Ryan Barrett 9808bed1b4
ActivityPub.postprocess_as2: add Mention tags to cc 2023-10-12 16:22:57 -07:00
Ryan Barrett 15a325c928
AP: compact outgoing actor, author, and attributedTo fields to string ids
hope this improves compatibility with many other AP implementations that choke on objects instead of ids. fixes #658
2023-10-11 16:17:43 -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 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 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 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 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 59e9895ab4
activitypub actor and inbox: error on bad ids
eg status.php, looks like a domain but isn't

fixes https://console.cloud.google.com/errors/detail/CMyE7OD8zd6SnwE;time=P30D?project=bridgy-federated
2023-09-27 10:29:40 -07:00
Ryan Barrett 8cd1bf809b
standardize AP endpoints mostly onto protocol subdomains
fixes #611
2023-09-26 20:04:57 -07:00
Ryan Barrett ad0a942034
switch webfinger and AP actors to mostly protocol subdomains
except Web, it still mostly serves on fed.brid.gy for backcompat, don't want to change existing Web users' AP actor ids.
2023-09-26 16:43:48 -07:00
Ryan Barrett a9fcc167f6
replace User.readable_id computed property with handle 2023-09-25 15:08:14 -07:00
Ryan Barrett 1a003c8c5b
refactor User.ap_address implementations to highlight similarities 2023-09-25 14:16:14 -07:00
Ryan Barrett 9b8b02e99f
consolidate ap_address in ATProto, Fake, Web (partially) into User 2023-09-25 12:45:47 -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 6cdb04b53f
replace User.atproto_handle with handle_as('atproto') 2023-09-25 10:58:05 -07:00
Ryan Barrett 40ba007e9e
add User.handle() 2023-09-25 10:58:05 -07:00
Ryan Barrett d8f2bbbeed
special-case Web in a few places in postprocess_as2 and actor handler 2023-09-24 20:06:18 -07:00
Ryan Barrett 325f8b3931
AP actor serving: resolve handles 2023-09-23 14:57:26 -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 0d2e4fb66a
noop: protocol: label classmethod cls identifiers with from/to 2023-09-09 14:19:27 -07:00
Ryan Barrett f116dbfa26
implement atproto_handle() in Web, ActivityPub, ATProto 2023-09-06 19:52:09 -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 4f7e394c6e
AP: add #key fragment to publicKey.id so it's not the same as actor id
thanks for the nudge @HelgeKrueger!
2023-08-26 09:21:53 -07:00
Ryan Barrett 6cddd95686
AP: always populate inbox and outbox in actors
required by AP! https://www.w3.org/TR/activitypub/#actor-objects

for #614
2023-08-19 15:12:46 -07:00
Ryan Barrett 53518a3e4d
AP: handle Follow activities sent to shared inbox
fixes https://console.cloud.google.com/errors/detail/CKCyj4Cml--vUw;time=P30D?project=bridgy-federated
2023-08-09 11:26:36 -07:00
Ryan Barrett 8850e27374
Activity.target_for: fix infinite loop when author is object id
fixes #603 and https://console.cloud.google.com/errors/detail/CLPmoOqegtfm0AE;time=P30D?project=bridgy-federated
2023-07-27 15:06:56 -07:00
Ryan Barrett 77812b1b61
AP: fix sig verification bug, handle Objects with non-as2 data
fixes https://console.cloud.google.com/errors/detail/CKCN17fmoZHraw;time=P30D?project=bridgy-federated
2023-07-24 18:16:50 -07:00
Ryan Barrett 9a7597b365
don't allow blocklisted domains in Web, ActivityPub ids
for #597
2023-07-22 20:09:16 -10:00
Ryan Barrett 405ca4145f
Web.send, ActivityPub.send: skip sending to blocklisted URLs
for #597
2023-07-22 20:02:12 -10:00
Ryan Barrett 80d1ec745e
ActivityPub.signed_request: handle redirects to relative URLs
fixes https://console.cloud.google.com/errors/detail/COLi8YPesYOztwE;time=P30D?project=bridgy-federated
2023-07-14 18:16:10 -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 dcc9b772b1
ActivityPub.send: handle unset g.user, missing actor 2023-07-14 12:58:46 -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 ee3a596dbb
Summary merging Protocol/Web receive: change receive to take Object
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 44fee79838
incoming AP: allow missing HTTP Sig when DEBUG is on 2023-06-27 22:35:42 -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 cae406e6c4
don't allow BF domains in ActivityPub or Web ids
also other ActivityPub id validation. #558
2023-06-23 12:22:37 -07:00
Ryan Barrett d73206c7c5
*.target_for() bug fix: don't assert that source_protocol matches
ugh. ideally we should keep these, but we have existing entities in prod that don't match, eg ActivityPub https://indieweb.social/users/bismark has source_protocol webmention.

fixes https://console.cloud.google.com/errors/detail/CMT-oN6iy7DMwwE;time=P30D?project=bridgy-federated
2023-06-21 07:38:36 -07:00
Ryan Barrett 9467f38180
generalize wm => AP delivery logic across protocols!
phew! another tough one. #529
2023-06-20 20:59:32 -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 8b9d0147db
postprocess_as2() bug fix for Accepts 2023-06-16 14:27:46 -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 e6f72f33b6
Web.load: default check_backlink kwarg to False, pass it through to fetch 2023-06-13 20:24:42 -07:00
Ryan Barrett 48c40c10a8
add Protocol.for_id and .owns_id
fixes #548
2023-06-13 13:21:30 -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 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 6796b47a9f
noop: move web.NoMicroformats to common, misc other minor cleanup 2023-06-10 07:53:07 -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 51c2773594
AP users: /r/: switch external user to indirect user
for #512
2023-06-04 20:58:21 -07:00
Ryan Barrett 47b3dd29d0
AP users: minor tweak, include full @context in indirect users' actors
for #512
2023-06-04 07:33:30 -07:00
Ryan Barrett fe27742b80
AP users: promote ActivityPub.label_id computed prop to User.readable_id
and drop ActivityPub.get_by_id() override, move logic to user() page handler. fixes 'Only ancestor queries are allowed inside transactions.'

for #512
2023-06-03 21:48:15 -07:00
Ryan Barrett cf68c1ebc7
AP users: fill in more fields in base actor objects
working on Mastodon account discovery interop. for #512
2023-06-03 08:36:55 -07:00
Ryan Barrett c41b55a199
Web.fetch: switch back to raising instead of returning empty Object
raise new custom NoMicroformats exception
2023-06-03 07:28:01 -07:00
Ryan Barrett d9cd5d14b9
AP users: fetch user on demand on /[actor] if we don't already have it
also change Web.fetch() to allow missing mf2 instead of raising exception. we now create Web users with None for mf2 property if the site has no mf2.

for #512
2023-06-02 12:55:07 -07:00