Wykres commitów

991 Commity (main)

Autor SHA1 Wiadomość Data
Ryan Barrett 03b0f54cfe
Protocol.receive: wrap bare actor object in update activity 2024-04-22 18:39:27 -07:00
Ryan Barrett 0b00e6eb4b
AP: serve protocol bot users on their own subdomains 2024-04-22 16:07:54 -07:00
Ryan Barrett c87e69d354
bug fix for ids.web_ap_base_domain
...and test it properly instead of mocking out the constant
2024-04-22 15:15:27 -07:00
Ryan Barrett 34692abc60
handle protocol bot users in webfinger, ids.translate_handle, Web.owns_handle
for #880
2024-04-22 14:01:09 -07:00
Ryan Barrett b9551c4de7
adjust Web.owns_id to say it owns protocol bot user domains but not their pages
eg bsky.brid.gy True, https://bsky.brid.gy/ True, https://bsky.brid.gy/foo False.

also move our internal synthetic UI-initiated follow ids from https://fed.brid.gy/web/... to under the user's own domain. hopefully this won't break anything 🤞
2024-04-22 11:58:01 -07:00
Ryan Barrett ed78090d2c
expand User.ap_subdomain to allow protocol subdomains like bsky
part of setting up per-protocol bot users for #880
2024-04-22 11:12:03 -07:00
Ryan Barrett e1f9021696
AP instance actor: move AS2 JSON files, start adding per-protocol bot users 2024-04-21 16:35:17 -07:00
Ryan Barrett 18b1a33d22
testutil.setUp() noop tweak for adding Fake classes to common.*_DOMAINS 2024-04-21 16:22:33 -07:00
Ryan Barrett 10023d17fd
Protocol.enable_protocol: create copy user if necessary 2024-04-21 12:18:12 -07:00
Ryan Barrett 6b597c90c3
User.get_or_create: abstract propagate and create_for across protocols 2024-04-21 11:40:13 -07:00
Ryan Barrett f357ea1698
ActivityPub: accept non-public DMs to protocol bot users
for #880
2024-04-21 08:36:03 -07:00
Ryan Barrett 1686a2ba91
opt in/out prompt: accept yes/no DMs to bot users to enable/disable protocols
for #880
2024-04-21 08:08:12 -07:00
Ryan Barrett 0c37d94191
ids.translate_* noop refactoring: from_proto => from_, to_proto => to 2024-04-20 21:03:06 -07:00
Ryan Barrett 70da21a7f3
Protocol.receive: send accepts for bot user follows 2024-04-20 21:02:14 -07:00
Ryan Barrett 20e061f476
Protocol.receive: extract out maybe_accept_follow method
for #880
2024-04-19 12:53:44 -07:00
Ryan Barrett 2886ae180d
remove common.ENABLED_PROTOCOLS, use Protocol.DEFAULT_ENABLED_PROTOCOLS instead
also use is_enabled_to in user page template
2024-04-18 16:39:15 -07:00
Ryan Barrett 8bcae4c09d
Protocol.receive: following protocol user enables that protocol
for #880
2024-04-18 16:09:09 -07:00
Ryan Barrett d36885728f
Protocol.receive: blocking protocol user disables that protocol
for #880
2024-04-18 16:03:51 -07:00
Ryan Barrett 39a641e000
remove USER_ALLOWLIST in favor of User.enabled_protocols 2024-04-17 17:02:17 -07:00
Ryan Barrett 259b7d72dd
start on conditional opt in
* add Protocol.DEFAULT_ENABLED_PROTOCOLS
* add User.enabled_protocols
* move common.is_enabled to Protocol.is_enabled_to, include opt out/in
2024-04-17 16:43:10 -07:00
Ryan Barrett f02ba80304
switch from gcloud datastore emulator to firestore emulator
...since the datastore emulator evidently doesn't support != query filters: https://github.com/googleapis/python-ndb/issues/962
2024-04-17 11:36:28 -07:00
Ryan Barrett 393605bde9
change ATProto.ABBREV to bsky
🤞, for #961
2024-04-17 06:54:16 -07:00
Ryan Barrett e913ad1f53
ATProto.convert: refetch subject for cid if we don't have it 2024-04-15 07:31:05 -07:00
Ryan Barrett 2ec22de09f
abstract redirect.py to be multi-protocol
...mostly. creating the underlying user opportunistically is still Web-only.
2024-04-14 18:26:34 -07:00
Ryan Barrett 5b5ed4173a
fix tests for f840c8b784 2024-04-14 14:57:00 -07:00
Ryan Barrett cf633efecf
update tests for snarfed/granary@75a8f45825 2024-04-12 15:11:57 -07:00
Ryan Barrett 5ec2159546
user page: link to bridged Bluesky profile
for #825
2024-04-12 08:46:59 -07:00
Ryan Barrett 817ef1d5d6
user pages: only hide indirect AP users, not ATProto 2024-04-11 14:24:18 -07:00
Ryan Barrett 561c763fd4
atproto handle resolution: test, comments, minor refactoring
for snarfed/granary@d4bff45637
2024-04-10 16:34:50 -07:00
Ryan Barrett c1acec1a3f
clear did.resolve_* caches in tests
for snarfed/arroba@f95365d7c3
2024-04-10 15:20:28 -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 5767ffabb5
add new Object.normalize_ids method, use in Protocol.receive
eg https://bsky.app/... URLs to DIDs for actors or at:// URIs for objects

this hopefully fixes web => ATProto follows of https://bsky.app/... profile URLs.
2024-04-09 13:07:57 -07:00
Ryan Barrett 131cbd9eb6
add web => ATProto follow integration test 2024-04-09 10:49:14 -07:00
Ryan Barrett c57e905204
Protocol.for_id: add remote kwarg 2024-04-09 10:48:05 -07:00
Ryan Barrett a45917cec8
ids.translate_object_id: normalize bsky.app profile URLs to DIDs 2024-04-09 10:04:16 -07:00
Ryan Barrett e3f2c2e0bc
ids.translate_user_id: normalize bsky.app profile URLs to DIDs 2024-04-09 09:48:16 -07:00
Ryan Barrett 2b7598cf94
update test_atproto for snarfed/granary@8dd5e470b2 2024-04-08 15:33:21 -07:00
Ryan Barrett f1531b44e7
bug fix for bad profile link on followers page
fixes #934
2024-04-01 23:06:57 -07:00
Ryan Barrett 10e5b00dd6
ActivityPubUtilsTest.test_convert_follow_as1_no_from_user: avoid network fetches 2024-04-01 23:06:57 -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 e86763f654
Object.as1 from bsky: bug fix for PDS in getBlob image URLs 2024-03-14 20:26:46 -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 6325f0e94c
temporarily disable /bridge-user tests, for 245ef44 2024-03-13 13:53:30 -07:00
Ryan Barrett 663063e06c
test_integrations: add ATProto => Web follow 2024-03-12 21:41:05 -07:00
Ryan Barrett 7e7556bb02
Web.load: support domain ids, convert to homepage URLs 2024-03-12 21:09:34 -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 c0b75e4fbd
Protocol.load: return None if the entity is too big
fixes https://console.cloud.google.com/errors/detail/CO-fpZfMq_6ktgE;time=P30D?project=bridgy-federated
2024-03-11 15:31:31 -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 01e5ac51ab
fix crash in Web.owns_id
fixes https://console.cloud.google.com/errors/detail/CPOsl7usgr3VUQ;time=P30D?project=bridgy-federated
2024-03-06 14:04:44 -08:00
Ryan Barrett 7c5496113f
fix a few tests that were using the network 2024-03-04 16:35:38 -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 e765eaa710
update tests for snarfed/arroba@375bf19 2024-02-29 15:30:04 -08:00
Ryan Barrett f647afe70f
atproto: update labels test for snarfed/granary@3057631 2024-02-29 12:52:49 -08:00
Ryan Barrett 0610c3c175
activitypub.actor: check enabled protocols 2024-02-29 12:52:49 -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 942452f176
AP: ignore unlisted posts
for #832
2024-02-27 12:05:18 -08:00
Ryan Barrett 9489204d64
AP: add profile to Content-Type: application/ld+json
for #895
2024-02-27 11:38:00 -08:00
Ryan Barrett fce24c0645
/web-site: don't allow URLs with paths
for #882
2024-02-27 11:19:14 -08:00
Ryan Barrett 8288390cfd
AP inbox delivery, Protocol.receive: error on blocklisted ids
fixes https://console.cloud.google.com/errors/detail/CN278MyjhZbtOQ;time=P30D?project=bridgy-federated , https://console.cloud.google.com/errors/detail/CLSnttKfy4v90wE;time=P30D?project=bridgy-federated
2024-02-27 06:42:19 -08:00
Ryan Barrett 42b4541c8d
Web.get_or_create: bug fix for normalizing domain case
fixes https://console.cloud.google.com/errors/detail/CKOs59zx0rSXQg;time=P30D?project=bridgy-federated
2024-02-26 19:26:47 -08:00
Ryan Barrett 56a3c0e34b
bluesky: opt out users who have disabled logged out view on bsky.app
ie "Discourage apps from showing my account to logged-out users" on https://bsky.app/moderation

fixes #828

https://docs.bsky.app/docs/advanced-guides/resolving-identities#for-backend-services
https://github.com/bluesky-social/atproto/blob/main/packages/api/docs/labels.md#label-behaviors
2024-02-23 10:33:34 -08:00
Ryan Barrett ac4b7fb4e5
web.poll_feed_task: handle more HTTP and parse errors
fixes https://console.cloud.google.com/errors/detail/CNj81tKbzNSzwAE;time=P30D?project=bridgy-federated
2024-02-20 12:23:20 -08:00
Ryan Barrett 675e39809e
web UI: tweak user links in user page header 2024-02-11 14:39:09 -08:00
Ryan Barrett 855efa04f3
test_atproto: update tests for snarfed/granary@ac0bc429e5 2024-02-10 22:13:40 -08:00
Ryan Barrett 484c637219
authorization check: handle domain vs homepage for web users
for #566
2024-02-10 10:30:25 -08:00
Ryan Barrett 95e5f6d596
test_activitypub noop, prune mock responses 2024-02-10 10:30:24 -08:00
Ryan Barrett 6a63820cd8
tighten Object.owns_id to reject blocklisted domains
fixes https://console.cloud.google.com/errors/detail/CLSnttKfy4v90wE;time=P30D?project=bridgy-federated
2024-02-08 14:41:15 -08:00
Ryan Barrett c966090912
Protocol.load: reload objects if our copy is over 30d old
fixes #628

no clue how much this will impact our outbound request load. we'll see!
2024-02-08 11:23:09 -08:00
Ryan Barrett 0cfa9a4ef8
update tests for snarfed/granary@e7778f3 2024-02-02 07:38:07 -08:00
Ryan Barrett 21ba279b31
ActivityPub.convert: fill in context in obj.as2 2024-01-28 18:15:37 -08:00
Ryan Barrett f9d94522d0
/r/: return 404 for opted out users' URLs 2024-01-28 08:54:35 -08:00
Ryan Barrett 9818b39b16
Web.owns_id bug fix: return None for opted out domain, not False 2024-01-27 13:45:02 -08:00
Ryan Barrett fcef6c21ab
Revert "heuristic: assume no AP actor id is the root path on its host"
This reverts commit b7e890b4bb.

it was a nice idea, but we're now hitting AP actor ids that are the root path on their host. this is evidently how microblog.pub does AP; 0x3b0b's site https://bw3.dev/ is an example. general info on https://docs.microblog.pub/user_guide.html#activitypub but not this specifically.

fixes https://console.cloud.google.com/errors/detail/CLSnttKfy4v90wE;time=P30D?project=bridgy-federated
2024-01-26 12:59:54 -08:00
Ryan Barrett 8ab09511bd
bug fix for following from web UI with custom username
thanks again for reporting @campegg!
2024-01-26 06:52:03 -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 114ba69d3b
test fix for 86079c3684 2024-01-22 13:20:03 -08:00
Ryan Barrett 907e6e7aeb
show Web user page even when direct is False
not other protocols though
2024-01-22 13:12:20 -08:00
Ryan Barrett 4bcf6b463f
web follow bug fix: error gracefully on BF user addresses
fixes https://console.cloud.google.com/errors/detail/CLSnttKfy4v90wE;time=P30D?project=bridgy-federated
2024-01-22 08:43:33 -08:00
Ryan Barrett 4e5021e2b0
/web-site bug fix, handle opted out users
fixes https://console.cloud.google.com/errors/detail/CN7a9KGAicelyAE;time=P30D?project=bridgy-federated
2024-01-22 08:43:33 -08:00
Ryan Barrett 3a8d33ee52
web feed polling: start using ETag/If-None-Match and Last-Modified/If-Modified-Since
for #791
2024-01-19 21:07:48 -08:00
Ryan Barrett 3e49fafd0a
unfollow UI: bug fix for when indieauth home page fetch fails
fixes https://console.cloud.google.com/errors/detail/CIb-6vLIioHJaw;time=P30D?project=bridgy-federated
2024-01-19 11:33:58 -08:00
Ryan Barrett 09dcabc708
feed polling: bug fix, calculate posting frequency independent of order 2024-01-19 11:33:58 -08:00
Ryan Barrett 7fcbf89d97
feed polling: add Web.feed_last_item, skip parts of feeds we've already seen
for #791
2024-01-19 11:33:58 -08:00
Ryan Barrett a832a4edf6
follow UI: error on bridged accounts
also make ActivityPub.owns_handle return False for bridged accounts

fixes https://console.cloud.google.com/errors/detail/CLSnttKfy4v90wE;time=P30D?project=bridgy-federated
2024-01-15 07:57:03 -08:00
Ryan Barrett 4529f30dce
switch from opt_outs.txt to new User.manual_opt_out property
opt_outs.txt wasn't included in continuous deploy from Circle, so those deploys were ignoring ids in that file :/
2024-01-14 21:02:39 -08:00
Ryan Barrett b6989a4f2e
if a web user has the webfinger redirects, use AS2 type Person, not Application 2024-01-14 13:53:28 -08:00
Ryan Barrett 7941b632ca
Object._pre_put_hook: require that protocol owns id 2024-01-12 19:53:01 -08:00
Ryan Barrett e9194b0a66
AP: default actors to type Application, add disclaimer with links to profile bio
thanks for the nudge @fromjasonstuff!
2024-01-11 16:37:10 -08:00
Ryan Barrett c8e2fafba4
web.poll_feed_task: use URL as id since some feeds use non-URL (eg tag URI) ids
example: https://www.producthunt.com/feed, Atom. excerpt:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:www.producthunt.com,2005:/feed</id>
  <link rel="alternate" type="text/html" href="https://www.producthunt.com"/>
  <link rel="self" type="application/atom+xml" href="https://www.producthunt.com/feed"/>
  <title>Product Hunt — The best new products, every day</title>
  <updated>2024-01-10T02:57:06-08:00</updated>
  <entry>
    <id>tag:www.producthunt.com,2005:Post/432225</id>
    <published>2023-12-31T18:15:55-08:00</published>
    <updated>2024-01-10T12:54:42-08:00</updated>
    <link rel="alternate" type="text/html" href="https://www.producthunt.com/posts/seemless"/>
    <title>Seemless</title>
    ...
```

fixes https://console.cloud.google.com/errors/detail/CKLuk-v4x8X0NQ;time=P30D?project=bridgy-federated
2024-01-11 13:01:45 -08:00