Wykres commitów

377 Commity (9d135880d76171231f46c6752d3dee6d025902a1)

Autor SHA1 Wiadomość Data
Ryan Barrett 7e77d7a463
start using an ndb in memory global cache in the frontends and router
lol yolo 982f8a70df/google/cloud/ndb/global_cache.py (L200-L202)

> Not intended for production use. Uses a single process wide dictionary to
> keep an in memory cache. For use in testing and to have an easily grokkable
> reference implementation. Thread safety is potentially a little sketchy.
2024-05-31 13:08:25 -07:00
Ryan Barrett d0ca690dc4
HTTP Cache-Control header bug fix, use integer seconds for max-age, not float
for #432
2024-05-30 17:12:45 -07:00
Ryan Barrett 9c4888b02e
switch from flask_util.cached to HTTP caching, suppress some verbose logging 2024-05-30 14:55:35 -07:00
Ryan Barrett 7e594e3227
authz: move NO_AUTH_DOMAINS (a.gup.pe) from Protocol.receive to activitypub.inbox
for #566
2024-05-30 13:34:14 -07:00
Ryan Barrett fda7a79437
authz: on delete of actor signed by actor, pass authed_as to Object.get_or_create
for #566
2024-05-30 11:39:07 -07:00
Ryan Barrett 9f33767f33
authz: move LD Sig check from Protocol.receive to activitypub.inbox
for #566
2024-05-29 21:17:38 -07:00
Ryan Barrett 8f5d8221a9
add ids.profile_id, use everywhere
for #566
2024-05-29 16:18:15 -07:00
Ryan Barrett f2a64c8b5c
Object.get_or_create: rename actor => authed_as, add to all calls
for #566
2024-05-28 16:07:32 -07:00
Ryan Barrett 916421c033
activitypub authz logging, preserve original keyId, including fragment
for #566
2024-05-28 16:00:21 -07:00
Ryan Barrett 22760f5017
ActivityPub.verify_signature: follow controller/owner if different from keyId
for https://github.com/snarfed/bridgy-fed/issues/566#issuecomment-2130728082

https://swicg.github.io/activitypub-http-signature/#how-to-obtain-a-signature-s-public-key
2024-05-28 13:48:03 -07:00
Ryan Barrett 3ec5e57136
activitypub.signed_request: limit redirects
for #1085, #1087
2024-05-27 21:02:59 -07:00
Ryan Barrett 03672679b9
activitypub, protocol: misc noop logging and code style tweaks 2024-05-27 20:38:49 -07:00
Ryan Barrett d789fd10b6
ActivityPub.inbox: run receive in task instead of inline
for #1040
2024-05-23 15:02:49 -07:00
Ryan Barrett 769dadb882
ATProto: arroba: send_new_commits => send_events
snarfed/arroba@aad0d9da63
2024-05-22 16:47:09 -07:00
Ryan Barrett b4124bd23f
AP: wrap content in <p> tag to preserve whitespace
for #990

this assumes an implementation detail of fediverse servers: that they apply a white-space: pre-wrap style to <p>s inside content. awkward overreach, but useful since white-space: pre-wrap preserves more whitespace (eg leading spaces on a line, multiple spaces, etc) than just converting newlines to <br>s.
2024-05-20 12:18:41 -07:00
Ryan Barrett edf3b5894e
activitypub.postprocess_as2: linkify indexed tags in content
makes Mastodon etc link them correctly to the local instance's UI in its rendering
2024-05-19 20:38:34 -07:00
Ryan Barrett 9243e18a4f
activitypub.postprocess_as2: hashtags: use activity id's domain for href
for https://github.com/snarfed/bridgy-fed/issues/1013
2024-05-19 17:56:26 -07:00
Ryan Barrett ec350e7fa6
activitypub.postprocess_as2: fix de-duping image attachments
for https://github.com/snarfed/bridgy-fed/issues/1000#issuecomment-2119106644
2024-05-19 15:38:13 -07:00
Ryan Barrett 7cf8a77a73
ActivityPub.postprocess_as2: always populate images into attachments as objects
hopefully for https://github.com/snarfed/bridgy-fed/issues/1000#issuecomment-2119106644, ATProto images without alt text not showing up in AP
2024-05-19 14:44:54 -07:00
Ryan Barrett f6798f2725
abstract "bridged from Bridgy Fed" profile label across protocols
for #976
2024-05-14 16:03:42 -07:00
Ryan Barrett b7a55d2f5e
ActivityPub.signed_request: pass from_user through on redirects
re https://akkoma.dev/AkkomaGang/akkoma/issues/438#issuecomment-12042 . thanks https://akkoma.dev/Oneric !
2024-05-14 10:42:11 -07:00
Ryan Barrett 348987f0b4
add Protocol.REQUIRES_OLD_ACCOUNT, enable for ActivityPub 2024-05-11 19:20:33 -07:00
Ryan Barrett 078bef041e
turn on REQUIRES_AVATAR/NAME for ActivityPub, Bluesky 2024-05-11 16:50:57 -07:00
Ryan Barrett de0af66979
basic anti-spam: add new Protocol.REQUIRES_AVATAR/NAME constants
...and start returning `blocked` from User.status for them
2024-05-11 16:03:07 -07:00
Ryan Barrett 034236f4cf
AP: don't duplicate security context in @context in bot users
fixes #1003. thanks @grishka!
2024-05-05 08:29:47 -07:00
Ryan Barrett 0781a4c695
AP inbox delivery: return 422 when a user with a bad handle follows the bot user
for #982
2024-05-04 13:39:39 -07:00
Ryan Barrett 2bf526ab7c
refactor validating handles in ATProto and elsewhere
for https://github.com/snarfed/bridgy-fed/issues/982
2024-05-03 15:18:16 -07:00
Ryan Barrett 073ce475e5
Protocol.receive: bridge replies to followers where in-reply-to already is
...ie if it's on the follower's protocol, either native or bridged.

for #981, #950, #949

not confident in this, despite the tests. worried it will either over- or under-deliver. guess we'll see.
2024-05-01 17:45:48 -07:00
Ryan Barrett c8ca31554b
AP: strip Link attachments since fedi instances generate their own link previews
hopefully fixes #958
2024-04-29 15:13:12 -07:00
Ryan Barrett cbe4b59206
convert Protocol.is_enabled_to to an instance method
next commit will move it to User
2024-04-27 20:27:33 -07:00
Ryan Barrett 0b00e6eb4b
AP: serve protocol bot users on their own subdomains 2024-04-22 16:07:54 -07:00
Ryan Barrett 10023d17fd
Protocol.enable_protocol: create copy user if necessary 2024-04-21 12:18:12 -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 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 f840c8b784
temporarily disable is_enabled checks in ATProto/ActivityPub.convert
for manual testing
2024-04-14 14:50:02 -07:00
Ryan Barrett 133d640f1d
improve rendering of ATProto interactions on user pages
for #825
2024-04-11 15:02:15 -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 f1531b44e7
bug fix for bad profile link on followers page
fixes #934
2024-04-01 23:06:57 -07:00
Ryan Barrett 5c470a4647
consider opted out Web domains in ActivityPub.status, not is_blocklisted
follow-up to df321234c0
2024-03-31 18:50:01 -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 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 4f239c92e5
activitypub: drop japanese spam flood mitigation
this stopped (at least to BF) as of 2/24
2024-03-01 12:15:45 -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 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