Ryan Barrett
561c763fd4
atproto handle resolution: test, comments, minor refactoring
...
for snarfed/granary@d4bff45637
2024-04-10 16:34:50 -07:00
Ryan Barrett
bf296802d8
pass from_user through to convert() in a few more places
2024-04-10 15:16:37 -07:00
Ryan Barrett
7009267bb0
use new handle_or_id kwarg in common.is_enabled calls
2024-04-10 11:49:53 -07:00
Ryan Barrett
056644d19e
add handle_or_id kwarg to common.is_enabled
...
for allowlist of test users while testing a given pair of protocols
2024-04-10 11:40:17 -07:00
Ryan Barrett
4ed45e5af5
atproto: pass new ndb_client kwarg to DatastoreStorage constructor
...
for snarfed/lexrpc#8
2024-03-31 18:50:01 -07:00
Ryan Barrett
5a1dda151c
ATProto.create_for: better support for local testing
2024-03-24 08:59:54 -04:00
Ryan Barrett
048cd17ba5
bug fix for pds_for change in e86763f: don't use Object.as1 since that infinite loops
2024-03-14 21:16:09 -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
69e4b039e9
atproto: update authed_as, actor authz checks in poll_*
2024-03-13 15:41:03 -07:00
Ryan Barrett
bad7052663
atproto: add delete support
2024-03-13 14:47:48 -07:00
Ryan Barrett
d667c8ece4
atproto: add update support
2024-03-13 14:40:31 -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
be56539eb2
ATProto.send: explicitly ignore accepts, undos
2024-03-12 20:48:23 -07:00
Ryan Barrett
aea4880e6f
ATProto.convert: fill in strongRef URIs with DIDs as well as CID
...
also error handling in ATProto.fetch for failed getRecord requests
2024-03-12 14:45:48 -07:00
Ryan Barrett
cf4d105c3e
atproto: when creating new commits, fetch remote objects' CIDs if necessary
...
fixes sending likes, reposts, etc to ATProto
2024-03-12 11:12:34 -07:00
Ryan Barrett
51254f67de
atproto: tweak profile label, add bridgy-fed-
2024-03-11 15:31:31 -07:00
Ryan Barrett
95e46c5ebb
Revert "cache outbound HTTP request responses, locally to each inbound request"
...
This reverts commit 30debfc8fa
.
seemed promising, but broke in production. Saw a lot of `IncompleteRead`s on both GETs and POSTs. Rolled back for now.
```
('Connection broken: IncompleteRead(9172 bytes read, -4586 more expected)', IncompleteRead(9172 bytes read, -4586 more expected))
...
File "oauth_dropins/webutil/util.py", line 1673, in call
resp = getattr((session or requests), fn)(url, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/session.py", line 102, in get
return self.request('GET', url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/session.py", line 158, in request
return super().request(method, url, *args, headers=headers, **kwargs) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/session.py", line 205, in send
response = self._send_and_cache(request, actions, cached_response, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/session.py", line 233, in _send_and_cache
self.cache.save_response(response, actions.cache_key, actions.expires)
File "requests_cache/backends/base.py", line 89, in save_response
cached_response = CachedResponse.from_response(response, expires=expires)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/models/response.py", line 102, in from_response
obj.raw = CachedHTTPResponse.from_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests_cache/models/raw_response.py", line 69, in from_response
_ = response.content # This property reads, decodes, and stores response content
^^^^^^^^^^^^^^^^
File "requests/models.py", line 899, in content
self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "requests/models.py", line 818, in generate
raise ChunkedEncodingError(e)
```
2024-03-11 15:31:30 -07:00
Ryan Barrett
30debfc8fa
cache outbound HTTP request responses, locally to each inbound request
...
using requests-cache. pretty straightforward! for #588
2024-03-08 12:34:49 -08:00
Ryan Barrett
0101cf04ea
atproto: fetch records from AppView (api.bsky.app) instead of PDSes
...
fixes #688
2024-03-04 16:35:31 -08:00
Ryan Barrett
396c3a64f3
ATProto.fetch: support bsky.app URLs
2024-03-02 16:50:01 -08:00
Ryan Barrett
c2b8db8687
atproto: self label profiles with 'bridged-from-[protocol]'
...
fixes #827
2024-03-01 13:31:59 -08:00
Ryan Barrett
d2865fdb86
add common.ENABLED_BRIDGES, check before conversion and /bridge-user
2024-02-28 12:07:06 -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
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
db2668ffab
activitypub.postprocess_as2_actor: handle user without handle
...
fixes https://console.cloud.google.com/errors/detail/CIT9-r3d-MKW5AE;time=P30D?project=bridgy-federated
2023-11-23 22:09:11 -08:00
Ryan Barrett
bee313fb67
drop User.atproto_did, switch to using copies
2023-11-15 19:08:06 -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
5d1aadb869
ATProto.send: use type as collection, convert to record early to catch errors
2023-11-14 19:55:20 -08:00
Ryan Barrett
d237d9611c
atproto: store extra `cid` field in Object.bsky, populate in record strongRefs
2023-11-14 19:24:37 -08:00
Ryan Barrett
95631396b7
atproto: fill in createdAt
...
for snarfed/granary@a0795b8c34
2023-11-14 15:24:51 -08:00
Ryan Barrett
81838df113
atproto.poll_posts: store record, not #postView
2023-11-14 14:21:22 -08:00
Ryan Barrett
a5b5078729
ATProto: first pass at polling posts (timelines)
...
for #694
2023-11-14 12:30:14 -08:00
Ryan Barrett
9c5adab4f4
ATProto.send: support likes, reposts, follows
...
snarfed/bridgy-fed#717
2023-11-14 10:56:52 -08:00
Ryan Barrett
00fb4dd14d
move test_atproto.KEY to testutil.ATPROTO_KEY
2023-11-13 14:08:21 -08:00
Ryan Barrett
a08a76c672
Object.resolve_ids bug fix: handle both protocol LABEL and ABBREV
2023-11-12 10:33:08 -08:00
Ryan Barrett
2be1229488
ATProto.send: store copy id in base object
2023-11-09 14:09:45 -08:00
Ryan Barrett
4d44363693
fold Object.as_bsky into ATProto.convert, translate ids
2023-11-02 17:41:31 -07:00
Ryan Barrett
def5638a64
Protocol.translate: distinguish between object and user ids
2023-11-02 13:08:24 -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
672949e217
fix atproto lexrpc client test for new access token handling
...
for snarfed/lexrpc@98b61eb383
2023-10-29 11:55: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
39c0d0e734
atproto: hard code our PDS URL to atproto.brid.gy
...
even on localhost
2023-10-20 11:16:23 -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
7e3613ab6c
fix ATProto.target_for: it should always return our base URL as the PDS
2023-10-18 12:01:17 -07:00
Ryan Barrett
fc96959383
tone down logging, especially for polling ATProto notifs
2023-10-18 11:03:21 -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
f3039fc87a
Protocol.send: bring back log_data kwarg
2023-10-13 18:29:28 -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
5efd97d867
add Object.lock and new add, remove, and put methods
2023-10-07 13:51:59 -07:00
Ryan Barrett
dfff201c6f
ATProto: log profile and post records that we store
2023-10-07 13:01:29 -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
e00a4b52ba
ATProto: don't create DNS records if DEBUG is on
2023-10-05 15:55:31 -07:00
Ryan Barrett
7d8b1ba2e8
add fetch_blobs kwarg to Object.as_bsky
2023-10-05 15:47:04 -07:00
Ryan Barrett
000b08f9b2
when creating a new ATProto user, add a DNS _atproto TXT record for their handle
2023-10-04 13:54:20 -07:00
Ryan Barrett
e96ab4654f
move creating ATProto users from User.get_or_create to new ATProto.create_for
2023-10-04 12:44:14 -07:00
Ryan Barrett
b4d5ab15ef
ATProto: assert that we only store record type objects in the repo
2023-10-03 16:56:06 -07:00
Ryan Barrett
318ba554d5
misc hub setup, testing live
2023-09-29 11:32:29 -07:00
Ryan Barrett
bfabfabea7
move creating a new ATProto user from ATProto.send to User.get_or_create
...
in progress, still need to load user profile object and write it to ATProto repo
2023-09-29 11:32:28 -07:00
Ryan Barrett
ef44dae317
ATProto: when storing user, always try to fetch DID doc if we don't have it
2023-09-26 14:47:26 -07:00
Ryan Barrett
068dcdeb86
ATProto.send: ignore accepts and undos
2023-09-26 14:47:26 -07:00
Ryan Barrett
a9fcc167f6
replace User.readable_id computed property with handle
2023-09-25 15:08: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
6ae57bfd94
atproto: bug fix for getRecord call
2023-09-23 13:52:49 -07:00
Ryan Barrett
452e49134d
add User.profile_id, implement in ATProto
2023-09-22 15:40:22 -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
5107d003fe
Object.as1: genericize converting actor/author id from copy to original
2023-09-19 19:59:28 -07:00
Ryan Barrett
bb18b5ee0d
add new User.copies property
2023-09-19 16:07:11 -07:00
Ryan Barrett
abde77e7eb
noop: more comments in ATProto.poll_notifications
2023-09-19 12:21:34 -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
7c35fe4b1b
atproto.poll_notifications: generate and send AppView JWT
2023-09-18 15:04:00 -07:00
Ryan Barrett
b45635b125
noop: move canonicalizing AT URIs TODO from ATProto to Object
2023-09-14 16:52:22 -07:00
Ryan Barrett
077b5a97bc
ATProto.send: populate Object.copies with local record's AT URI
2023-09-14 10:20:04 -07:00
Ryan Barrett
d3b3ff47f5
atproto: start on polling notifications
...
lots more to do here, 8 new TODOs in this commit 😆
2023-09-14 09:42:11 -07:00
Ryan Barrett
2bb5db826c
atproto: support bsky.app URLs as targets
2023-09-12 21:52:21 -07:00
Ryan Barrett
bd09af9c24
atproto: use proper DID docs instead of PLC operations
...
corresponds to snarfed/arroba@d52cb4d . also fix verifying signature in PLC genesis operation.
2023-09-12 11:57:08 -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
d2bb9108c7
atproto: switch to new simpler atproto-commit task without seq
2023-09-10 16:44:05 -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
ee3b72fb1e
atproto: enqueue atproto-commit task for first commit on new repo
2023-09-09 07:50:53 -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
ac06e0fef3
atproto: update for arroba rotation key, always create did:plc and repo together
2023-09-08 21:08:12 -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
f91486db75
add new atproto-commit task queue, enqueue tasks for new commits
...
hub will consume these and emit them to subscribeRepos subscribers
2023-09-05 20:10:11 -07:00
Ryan Barrett
73f8bf29b3
switch from arroba's bundled com.atproto lexicons to lexrpc's
2023-09-04 19:26:20 -07:00
Ryan Barrett
f03b97e44a
delete XRPC method handlers, they're unused
2023-09-04 08:12:17 -07:00
Ryan Barrett
70edf4173e
ATProto: when creating new repo, add user profile record if available
2023-09-01 14:18:50 -07:00
Ryan Barrett
7949dd0da7
ATProto: update target_for to handle non-ATProto users
2023-09-01 13:59:28 -07:00
Ryan Barrett
abf583952c
first pass at ATProto.send
2023-09-01 12:07:21 -07:00
Ryan Barrett
3cb1fea53f
ATProto: use handle in web_url()
2023-08-31 11:50:36 -07:00
Ryan Barrett
fd4b40fe7c
implement default User.ap_actor()
2023-08-31 11:49:10 -07:00
Ryan Barrett
5c1032a7e7
implement ATProto.ap_address
2023-08-31 11:19:57 -07:00
Ryan Barrett
36be6b9dd2
implement ATProto.readable_id
2023-08-31 10:58:24 -07:00
Ryan Barrett
e18dabf510
implement ATProto.target_for, .fetch for at:// URIs
2023-08-31 10:48:28 -07:00
Ryan Barrett
96b63487fa
implement ATProto.fetch for DIDs
2023-08-30 20:59:53 -07:00
Ryan Barrett
6ac1193171
implement ATProto.serve
2023-08-29 12:35:20 -07:00
Ryan Barrett
2742904468
ATProto: implement first pass at web_url
2023-08-23 21:04:17 -07:00
Ryan Barrett
16bbd66d91
ATProto: validate that key id is did:plc or did:web
2023-08-23 20:44:42 -07:00
Ryan Barrett
0c4f23dc18
start on ATProto!
...
for #381
2023-08-23 20:34:32 -07:00
Ryan Barrett
259e982986
bluesky: remove sync XRPC method implementations
...
they're moving to arroba
2023-05-22 12:56:21 -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
ad8d710cd8
atproto: move signature handling into atproto_util
2023-04-29 15:46:08 -07:00
Ryan Barrett
ff7f52fb5a
bluesky: move a few utils to new atproto_util module
2023-04-28 15:29:40 -07:00
Ryan Barrett
412f3416a4
big steps toward getting getRepo working
...
* generate commits
* sign commits
* serialize and include MST after each commit, not just at the end
phew!
2023-04-27 16:48:25 -07:00
Ryan Barrett
e9555b4c4b
atproto: fix TID generation
...
bluesky team's base32 isn't base32, it's their own thing that preserves lexicographic sort order.
* atproto/packages/common-web/src/util.ts
* atproto/packages/common-web/src/tid.ts
2023-04-26 21:40:43 -07:00
Ryan Barrett
3985b2bea6
bluesky: implement com.atproto.sync.listRepos
2023-04-21 15:44:22 -07:00
Ryan Barrett
51b587cff4
bluesky: implement com.atproto.sync.getHead
...
also now getRepo test is failing with "Not a valid node: two subtrees next to each other," not sure why, I think this was latent and the new random seeds are triggering it.
2023-04-21 14:31:39 -07:00
Ryan Barrett
5b59baa88f
bluesky: implement com.atproto.sync.getBlocks
2023-04-20 21:34:16 -07:00
Ryan Barrett
df7b919161
bluesky: implement getRepo earliest and latest
2023-04-20 19:28:39 -07:00
Ryan Barrett
3493aafca8
Bluesky: implement com.atproto.sync.getRepo
...
first com.atproto.sync XRPC! 🎉
2023-04-20 19:28:39 -07:00