Wykres commitów

173 Commity (7e7556bb029f1aa00f6f5ea449af26f0187f3934)

Autor SHA1 Wiadomość Data
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 d33832be1c
add Web.ap_subdomain property, use it in webfinger
Originally, BF served Web users' AP actor ids on fed.brid.gy, eg
https://fed.brid.gy/snarfed.org . When we started adding new protocols, we
switched to per-protocol subdomains, eg https://web.brid.gy/snarfed.org .
However, we need to preserve the old users' actor ids as is. So, this property
tracks which subdomain a given Web user's AP actor uses.
2023-11-30 15:43:38 -08:00
Ryan Barrett 520b2fd3b0
User.ap_address() => handle_as(ActivityPub) 2023-11-29 21:06:55 -08:00
Ryan Barrett a5f9daa46f
change Web.ap_address to use has_redirects instead of direct
for #551
2023-11-29 16:41:11 -08:00
Ryan Barrett 911814dba2
Web.fetch: use util.parse_mf2's new metaformats support 2023-11-29 13:21:13 -08:00
Ryan Barrett 18f79d2626
Web: start adding metaformats support
for #551
2023-11-29 12:00:48 -08:00
Ryan Barrett b81fa2090b
Protocol.receive: handle opted out users 2023-11-27 06:53:22 -08:00
Ryan Barrett dc3b23f80b
Web.fetch: ignore uid if set; we use URL as id
props and thanks to @fluffy-critter for being my unintentional edge case QA department 😆🙏

fixes https://console.cloud.google.com/errors/detail/CKLuk-v4x8X0NQ;time=P30D?project=bridgy-federated
2023-11-26 16:31:29 -08:00
Ryan Barrett fae7769d2b
Web.get_or_create bug fix: handle opted out users
fixes https://console.cloud.google.com/errors/detail/CJ2U0_Hq6cHnUA;time=P30D?project=bridgy-federated
2023-11-26 15:37:39 -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 3c9744fab0
pass authed_as to Web.receive 2023-11-25 16:01:07 -08:00
Ryan Barrett 990ec47c89
stop using g.user in web, part of redirect
for #690
2023-11-19 21:53:39 -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 98bb29b333
drop Object.proxy_url, switch callers to ids.translate_object_id 2023-11-06 12:18:11 -08:00
Ryan Barrett 06275324fd
Web.convert: call translate_ids 2023-11-03 15:52:37 -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 d31f470178
Web.is_web_url: ignore www subdomain
for 3b88b0f
2023-10-19 16:25:04 -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 e66ca3fb7f
noop: expand a few log messages 2023-10-18 13:13:44 -07:00
Ryan Barrett 12375e0111
protect webmention and receive task handlers with @cloud_tasks_only 2023-10-18 11:03:21 -07:00
Ryan Barrett 787c64c674
remove a couple errant util.d's 2023-10-14 14:14:05 -07:00
Ryan Barrett 441c5aa29f
log_data bug fixes 2023-10-14 14:13:13 -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 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 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 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 a9fcc167f6
replace User.readable_id computed property with handle 2023-09-25 15:08:14 -07:00
Ryan Barrett c27404d681
/web-site: gracefully handle blocklisted domains
fixes https://console.cloud.google.com/errors/detail/CJbG4sGlnK7Jdw;time=P30D;refresh=true?project=bridgy-federated
2023-09-25 14:45:04 -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 6a951138dc
oops, need to implement Web.profile_id after all
Web user ids are domains, eg user.com, but "web id" of a user profile is a full homepage url, eg https://user.com/
2023-09-23 14:57:26 -07:00
Ryan Barrett e257d43f21
webfinger: if user part isn't an id, try resolving it as a handle 2023-09-22 15:14:15 -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 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 55f96c428e
common.create_task: run task inline if we're in a local server 2023-09-18 19:02:15 -07:00
Ryan Barrett 0723eca115
migrate webmention task to common.create_task
also bring back lexrpc logging, other minor docstring/comment updates
2023-09-11 16:21:03 -07:00
Ryan Barrett a57edf8038
Web user signup: remove leading and trailing dots from domains 2023-09-10 22:04:00 -07:00
Ryan Barrett 0e5d980111
incoming webmentions: skip backlink check when running locally 2023-09-09 15:47:38 -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 de5191a10e
bug fix for web user updat profile button
for synthesized update/create/delete activities, switch actor id from protocol-specific AP to protocol-agnostic web URL.

thanks @capjamesg for reporting!
2023-08-02 19:12:09 -07:00
Ryan Barrett e389690276
Web.fetch: handle author missing u-url
originally from https://r0ss.me/notes/20230727-starfield-animated-videos.html
2023-07-28 19:13:59 -07:00
Ryan Barrett aa124413f6
Web: set author to user homepage more carefully
for when h-entry author points to non-homepage, eg @techlifeweb's https://techlifeweb.com/blog/2023/07/2023-07-25-post-025/ 's author url is https://techlifeweb.com/hcard
2023-07-24 21:28:37 -07:00
Ryan Barrett 95cbfba31c
Web: default missing author to homepage, not fed.brid.gy AP actor URL
for #599
2023-07-24 12:17:03 -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 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 4b66e68232
Web.send: improve logic for skipping sends to followers
should stop the unrelated webmentions going to @gRegorLove et al
2023-07-15 14:33:54 -07:00
Ryan Barrett 8903273c2a
merging receive: Web: skip sending wms for normal posts (ie not replies etc)
for #529
2023-07-14 17:22:59 -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 15557dc78f
merging receive: Web: handle ValueError raised by protocol.receive
for #529
2023-07-11 13:25:31 -07:00
Ryan Barrett cfa43135a5
Web.fetch default author bug fix, only add if URL is not homepage 2023-07-11 13:25:31 -07:00
Ryan Barrett a2ed0afda8
merging receive: Web.fetch: default actor/author to home page URL
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 56ebdba049
merging receive: propagate new/changed from receive into new Object
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 ee3a596dbb
Summary merging Protocol/Web receive: change receive to take Object
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 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 ecbc76dd94
minor, use common.add a few more places 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 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 a5466e34ca
minor noop refactoring to web._targets() to make it use Target directly 2023-06-28 14:45:14 -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 f0a54b09c5
wm => AP optimization for delivering to followers, bulk load from datastore
noop otherwise, shouldn't change any logic
2023-06-23 14:26:03 -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 ba419e818b
Revert "fix log links to only search /_ah/queue/webmention"
oops, didn't mean to commit/push that :(

This reverts commit 89d8393a2e.
2023-06-21 14:07:20 -07:00
Ryan Barrett 89d8393a2e
fix log links to only search /_ah/queue/webmention
fixes #541
2023-06-21 14:04:12 -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 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 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 8e14ce003f
Web: relax domain validation, allow underscores in all segments except TLD
we already have one Web user with an underscore, brandon_swoop.ngrok.io
2023-06-16 12:05:55 -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 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 435389d0b9
move User.has_redirects, .redirects_error, and .has_hcard to Web
confirmed that no prod ActivityPub entities have values for any of these properties
2023-06-14 14:36:30 -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 974fa71443
Web.username: handle bad acct: URIs
fixes https://console.cloud.google.com/errors/detail/CPLmrpzFs4qTUA;time=P30D?project=bridgy-federated
2023-06-14 13:34:29 -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 48c40c10a8
add Protocol.for_id and .owns_id
fixes #548
2023-06-13 13:21:30 -07:00
Ryan Barrett 436595c2a2
AP users: generalize protocol in Protocol.deliver
for #512
2023-06-12 21:43:08 -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 6796b47a9f
noop: move web.NoMicroformats to common, misc other minor cleanup 2023-06-10 07:53:07 -07:00
Ryan Barrett 9ee616b4c2
update profile bug fix, update local user as well as sending fediverse Update
thanks for reporting @KR4DIO!
2023-06-10 07:16:54 -07:00