Wykres commitów

203 Commity (main)

Autor SHA1 Wiadomość Data
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 021df15f7e
Object.as1 from bsky: pass repo DID, handle, PDS to granary 2023-09-24 20:02:09 -07:00
Ryan Barrett c1880569b8
User.get_by_copy => get_by_copies 2023-09-19 21:12:53 -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 134416cd7b
genericize User.get_by_atproto_did to get_for_copy 2023-09-19 16:48:16 -07:00
Ryan Barrett dcbf16db6e
Object.as1 conversion from bsky, injecting actor/author
prefer user id to profile object id, default to AT URI repo DID
2023-09-18 11:52:17 -07:00
Ryan Barrett 5b16386fbc
User.get_by_atproto_did and Object.as1 from bsky: support native ATProto users 2023-09-18 11:41:01 -07:00
Ryan Barrett a723be660e
Object.as1: inject actor/author when converting from bsky objects
...since they imply actor/author in the AT URI's repo DID.
2023-09-18 11:23:11 -07:00
Ryan Barrett 48e47f5f7d
add User.get_by_atproto_did 2023-09-17 22:38:33 -07:00
Ryan Barrett 61b585e715
for Objects for ATProto records, require at:// URIs to have DID repos
don't allow handles. https://atproto.com/specs/at-uri-scheme
2023-09-13 12:51:34 -07:00
Ryan Barrett 165a403353
drop User.k256_pem, use arroba's AtpRepo.signing_key/rotation_key instead 2023-09-08 21:52:46 -07:00
Ryan Barrett abf583952c
first pass at ATProto.send 2023-09-01 12:07:21 -07:00
Ryan Barrett 3ff42f0cd4
User.p256_key = k256_key, for ATProto 2023-09-01 07:51:23 -07:00
Ryan Barrett fd4b40fe7c
implement default User.ap_actor() 2023-08-31 11:49:10 -07:00
Ryan Barrett 9211aa3cae
bug fixes for Object.clear and get_or_create
be more careful about clearing and preserving as2/mf2/bsky/our_as1 properties

discovered by @jamietanna, thanks for reporting Jamie!
2023-08-08 10:26:00 -07:00
Ryan Barrett 96e523d887
fix Object.proxy_url to use per-protocol subdomains
it should have already been using them!

for #600
2023-07-26 09:02:23 -07:00
Ryan Barrett b57c96d7d5
move AtpNode to arroba 2023-07-26 09:02:23 -07:00
Ryan Barrett 850e8a1dc8
switch convert URLs from ^^ back to #
for #581. the ^^s didn't help with WordPress, which was the original motivation, and they're confusing everyone else.
2023-07-24 14:31:07 -07: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 42bb4a765d
misc test fixes 2023-07-11 13:25:31 -07:00
Ryan Barrett 89ff89ef30
merging receive: Object.as1: postprocess mf2, if no id, use url
for #529
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 3f9ee02126
Object.get_or_create: populate .new and .changed 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 80e63e0fe9
add Object.get_or_create 2023-07-11 13:25:29 -07:00
Ryan Barrett ee52a7b1c6
User.load_multi bug fix: handle when obj_key points to nonexistent entity
fixes https://console.cloud.google.com/errors/detail/COGUnu_nvbzluwE;time=P30D?project=bridgy-federated
2023-06-29 13:47:16 -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 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 1821e90f36
add Object.as_as2() 2023-06-16 14:09:28 -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 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 65e1479d88
don't allow Followers from and to the same protocol
also make from and to required
2023-06-13 20:58:28 -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 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 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 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 ca64793fff
AP users: add User.name() and label_id(), ActivityPub.address computed property
for #512
2023-06-01 21:37:58 -07:00
Ryan Barrett 958f81ddd1
AP users: rename [is_]homepage => [is_]web_url, move into Protocol subclasses
for #512
2023-05-31 18:47:40 -07:00
Ryan Barrett 56f18f5d9a
AP users: make User.ap_actor/ap_address abstract, implement in subclasses
for #512
2023-05-31 10:47:09 -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 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 8d4228b811
AP users: change web UI user page paths from /user/... to /[protocol]/...
for #512
2023-05-30 14:08:47 -07:00
Ryan Barrett 47b04f5574
rename Web.LABEL from 'webmention' to 'web' 2023-05-30 12:15:36 -07:00
Ryan Barrett 93f621aaf5
AP users: start to replace external with indirect, starting with webfinger
#512
2023-05-29 20:16:15 -07:00
Ryan Barrett 624355d85a
AP users: add new User.direct property
direct users signed up or otherwise interacted with BF explicitly, indirect users didn't
2023-05-29 19:37:41 -07:00
Ryan Barrett eaa4e5333a
start to make User subclasses for each protocol
#512
2023-05-26 16:07:36 -07:00
Ryan Barrett 15e3daff5e
switch outbound webmention source URLs from /render?id=... to /convert/...
#512
2023-05-24 16:32:00 -07:00
Ryan Barrett f933c7e237
AP users: serve AS2 for external homepage URLs
#512
2023-05-22 23:17:42 -07:00
Ryan Barrett 0ab3698db7
Bluesky: move most ATProto code to separate arroba library
https://github.com/snarfed/arroba
2023-05-06 14:41:06 -07:00
Ryan Barrett 64f4f62ae9
bluesky: add models.AtpNode for storing repo blocks 2023-04-28 12:02:26 -07:00
Ryan Barrett e303f55fdf
models.User: generate and store an ECC P-256 keypair
for AT Proto
2023-04-25 14:04:29 -07:00
Ryan Barrett b39d673f12
add Object.expire property for datastore TTL to garbage collect old Objects
right now, auto-delete some ephemeral activities after 90d. for #456. https://cloud.google.com/datastore/docs/ttl
2023-04-18 09:16:16 -07:00
Ryan Barrett 01125d38d8
/render : escape #s in object id URLs to ^^
fixes #469
2023-04-05 16:23:49 -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 f4a86dcb82
update test for snarfed/granary@882426a9de 2023-03-31 20:28:25 -07:00
Ryan Barrett e41ce9216c
noop, rename Protocol.get_object => Protocol.load 2023-03-29 13:13:32 -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 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 5e3c623552
add User.actor_id() 2023-03-19 09:34:42 -07:00
Ryan Barrett d8932d4e76
add mf2 to user page dashboard to make a notifications feed
for #442
2023-03-14 11:27:10 -07:00
Ryan Barrett 106bbe623b
tests optimization: reuse same RSA key across Users
speeds up tests from ~22s to ~6s (!) on my laptop. for #398
2023-03-10 15:13:45 -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
Ryan Barrett aa483ded0b
Object.type and object_ids fixes to handle missing as1
fixes https://console.cloud.google.com/errors/detail/CJ-U7Zq_s4bxgwE;time=P30D?project=bridgy-federated
2023-02-24 21:59:12 -06:00
Ryan Barrett fd27dabe61
switch JSON properties to custom JSONProperty that works in web console UI
https://github.com/googleapis/python-ndb/issues/874#issuecomment-1442753255
2023-02-24 07:25:29 -06:00
Ryan Barrett 91a60c7e67
switch Object.as1 to be a ComputedProperty 2023-02-23 21:17:26 -06:00
Ryan Barrett d1691b65c5
Object post put hook: don't add fragment ids to the common.get_object cache 2023-02-16 12:21:27 -08:00
Ryan Barrett c540a8bee8
add test that Object put hook clears common.get_object cache 2023-02-16 08:21:56 -08:00
Ryan Barrett c12bb6db6d
serve AS2 /[domain] actors from datastore instead of refetching h-card
for #392. not pretty, but gets the job done. more code cleanup needed eventually.
2023-02-14 08:25:41 -08:00
Ryan Barrett f39c532ad3
add User.homepage, is_homepage() 2023-02-12 12:03:27 -08:00
Ryan Barrett f922ce89bb
user page: activities: render fediverse actor links as @-@
for #406
2023-02-06 21:08:52 -08:00
Ryan Barrett 2a1b199558
Activity => Object: user dashboard UI bug fixes, add missing Object index 2023-02-04 20:46:28 -08:00
Ryan Barrett 58e836b380
Activity => Object: update webmention.py
#286
2023-02-04 20:46:27 -08:00
Ryan Barrett cc453035c8
initial design of new Object model, implement it in render.py 2023-02-04 20:46:27 -08:00
Ryan Barrett 36349a5db9
add Follower.to_as2() 2023-01-19 06:49:39 -08:00
Ryan Barrett c3edf3a68e
make Follower.to_as1() handle both inbound and outbound last_follow
...and use it in followers and following UI pages
2023-01-18 22:31:13 -08:00
Ryan Barrett 72b8dea8a0
Model.verify: minor redirect error message tweak 2022-12-06 22:41:55 -08:00
Ryan Barrett f72b3abfa0
Model.verify: add error message for non-2xx redirects
for #337
2022-12-06 22:37:56 -08:00
Ryan Barrett 5249bb5a4f
special-case www subdomains, use root domain if it redirects to www
for #314
2022-12-02 10:48:16 -08:00
Ryan Barrett 0363db65fa
handle new multi-valued url field in AS2 objects
snarfed/granary@79c512402b
2022-11-30 21:04:41 -08:00
Ryan Barrett d4af114247
user verification: follow multiple redirects 2022-11-28 13:10:51 -08:00
Ryan Barrett c343164f5b
user page UI redirects warning: show diff of current vs expected
for #305
2022-11-27 17:45:23 -08:00
Ryan Barrett 85b1a400ff
user page UI: first pass at details for redirect check
for #305
2022-11-27 17:33:53 -08:00
Ryan Barrett 7d902ec616
bug fix for custom username in fediverse address on user page UI
should come from acct: actor URL, not preferredUsername field, which always has to be user's domain for AP interop.

in the process, refactored common.get_username() into User.username().

for #281
2022-11-26 16:05:02 -08:00
Ryan Barrett 660682c93e
fix preferredUsername regression, it needs to be domain for Webfinger
originally added in 65f3ef3cc7. fixes #302. props to @fancypantalons for debugging!
2022-11-22 14:47:15 -08:00
Ryan Barrett 65f3ef3cc7
show fediverse address on user page UI, including custom username
for #281
2022-11-20 11:46:05 -08:00
Ryan Barrett b854981497
UI edits: enter web site page, /docs, flashed messages, copy Bridgy's CSS 2022-11-18 22:30:07 -08:00
Ryan Barrett f384bf5529
add User.verify(), checks redirects and home page representative h-card
for #276
2022-11-18 18:49:41 -08:00
Ryan Barrett 50956c02b0
noop, rename Domain => User 2022-11-15 22:00:28 -08:00
Ryan Barrett e3f1431018
noop identifier renames, key => domain or entity 2022-11-15 19:12:20 -08:00
Ryan Barrett 4cc43f4c56
noop, rename resp => activity 2022-11-13 09:35:47 -08:00
Ryan Barrett 4f3dc03a3e
rename MagicKey => Domain, Response => Activity
the Python classes, but not (yet) the kinds in the datastore. maybe eventually.
2022-11-12 15:27:59 -08:00
Ryan Barrett 4a55739b91
flask: port /.well-known/host-meta*, other misc tweaks
all tests pass!
2021-07-11 16:50:44 -07:00
Ryan Barrett df6b0b58ba
unify request handler classes and handle_exception; move away from HOST[_URL]
fixes:
* https://console.cloud.google.com/errors/CN68rO-5sOK9cQ
* https://console.cloud.google.com/errors/CJWCu8b5_ureAg
* https://console.cloud.google.com/errors/CN6W4Zy7irzgOA
* https://console.cloud.google.com/errors/CN278MyjhZbtOQ
2020-01-31 14:40:11 -08:00
Ryan Barrett 02d36b3b1f
migrate to the app engine standard python 3 runtime!
https://cloud.google.com/appengine/docs/standard/python3/python-differences
https://cloud.google.com/appengine/docs/standard/python/migrate-to-python3/
2019-12-25 22:26:26 -08:00
Ryan Barrett b8d52b3dac
move test/ => tests/ to avoid shadowing python's built in test module
fixes confusing problems with dev_appserver starting in cloud sdk 219 (app-engine-python 1.9.76). background in https://issuetracker.google.com/issues/117145272#comment25 .
2018-10-11 16:07:53 -07:00