Ryan Barrett
70dd6d3ceb
minor logging optimizations
...
for https://github.com/snarfed/bridgy-fed/issues/1149
2024-08-02 08:03:44 -07:00
Ryan Barrett
5679d696a4
cache models.get_originals in memory
...
for #1149
2024-08-01 16:20:13 -07:00
Ryan Barrett
e9dc38c75c
actually turn on ndb global cache with global_cache_policy
...
🤦
2024-08-01 12:42:13 -07:00
Ryan Barrett
c193a4634b
common.cache_policy, global_cache_timeout_policy: handle both types of keys
...
google.cloud.datastore.key.Key or google.cloud.ndb.key.Key. see https://github.com/googleapis/python-ndb/issues/987
2024-08-01 12:32:28 -07:00
Ryan Barrett
4097fe71fb
use ndb in-memory context cache for DID doc Objects
...
for #1149
2024-08-01 12:09:37 -07:00
Ryan Barrett
3529216e5d
disable caching get_originals ( 88cbe3b
) until bugs are fixed
...
for #1149
2024-07-31 09:14:31 -07:00
Ryan Barrett
88cbe3b7b4
cache models.get_originals in memcache with new memcache_memoize decorator
...
for #1149
2024-07-30 14:50:33 -07:00
Ryan Barrett
33e0d0b14a
common.memcache_key: encode Unicode chars as UTF-8
2024-07-30 14:49:50 -07:00
Ryan Barrett
075c33cade
memcache: encode spaces in keys as %20
...
fixes https://console.cloud.google.com/errors/detail/CNPzqYzWg4_TyQE;time=P7D?project=bridgy-federated
2024-07-16 13:48:52 -07:00
Ryan Barrett
7b0151b0cf
memcache: truncate keys at 250 chars
...
max memcache key len:
https://github.com/memcached/memcached/wiki/Commands#standard-protocol
https://pymemcache.readthedocs.io/en/latest/apidoc/pymemcache.client.base.html
fixes https://console.cloud.google.com/errors/detail/CNPzqYzWg4_TyQE;time=P30D?project=bridgy-federated
2024-07-12 07:50:54 -07:00
Ryan Barrett
98d21ae0d9
common.report_error/exception bug fix, handle running outside request context
2024-07-05 12:15:06 -07:00
Ryan Barrett
866f6593e3
add a few domains to the blocklist
2024-06-27 13:20:07 -07:00
Ryan Barrett
550e1030c4
drop unused TLD_BLOCKLIST
...
subsumed by using brevity.TLDs in 84949f265b
2024-06-23 09:22:50 -07:00
Ryan Barrett
fc0cc1118a
activitypub.inbox: short circuit on activity or actor id on opted out domain
2024-06-23 09:20:22 -07:00
Ryan Barrett
b20bbf0564
memcache config: try to only use prod Memorystore on prod GAE
2024-06-19 11:01:46 -07:00
Ryan Barrett
4e489a4ee0
activitypub.inbox: store seen activity ids in memcache, short circuit on seen ids earlier
2024-06-13 13:54:37 -07:00
Ryan Barrett
3c06739889
common.report_exception bug fix
2024-06-13 12:02:54 -07:00
Ryan Barrett
ba00850840
turn on memorystore ndb global cache in hub and atproto_firehose
2024-06-04 19:27:52 -07:00
Ryan Barrett
3ccce1bc89
start using memorystore memcached for ndb global cache
2024-06-04 15:40:32 -07:00
Ryan Barrett
07517f1685
ndb global cache: limit to users and profile objects, not other objects/activities
2024-06-04 14:27:04 -07:00
Ryan Barrett
83893d0ea7
HTTP caching headers: switch to flask_util.headers
...
for #432 , fixes https://console.cloud.google.com/errors/detail/CMK10__x4ZbgbQ;time=P7D;refresh=true?project=bridgy-federated
2024-06-04 14:19:39 -07:00
Ryan Barrett
712da61181
auth error reporting: standardize messages, include HTTP context
...
trying to collect them into two top-level Error Reporting errors, with details for each one in the user field
for #566
2024-06-04 11:27:17 -07:00
Ryan Barrett
e8e2c9692d
common.report_error bug fix
...
fixes https://console.cloud.google.com/errors/detail/COyxtrLf5r2XowE;time=P30D?project=bridgy-federated
2024-06-03 16:20:53 -07:00
Ryan Barrett
cc564a2b19
turn on authorization checks! HTTP sig matches actor, actor is allowed to modify object
...
for #566
2024-06-03 14:12:08 -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
6ffc4a3c3b
infra: add new router flex service, switch tasks to run on it
...
receive, send, webmention, and poll-feed
2024-05-23 20:40:54 -07:00
Ryan Barrett
348987f0b4
add Protocol.REQUIRES_OLD_ACCOUNT, enable for ActivityPub
2024-05-11 19:20:33 -07:00
Ryan Barrett
f2b5f79489
ATProto firehose: add handle wrapper that catches exceptions
...
also refactor and simplify load_dids, error reporting. #978
2024-05-10 19:59:12 -07:00
Ryan Barrett
b49fe13e59
ATProto firehose: use report_exception() so we get stack traces
2024-05-09 21:31:41 -07:00
Ryan Barrett
940c0e8cae
ATProto firehose: don't assume required fields, handle error reporting errors
...
for #978
2024-05-09 13:26:24 -07:00
Ryan Barrett
a690bc0115
add bsky.social, x.com to domain blocklist
...
for https://github.com/snarfed/bridgy-fed/discussions/1035 . thanks for the nudge @lucajet!
2024-05-09 07:08:34 -07:00
Ryan Barrett
0f35a2e1a1
ATProto firehose: convert to function we can run in a thread
...
for #978
2024-05-07 16:58:52 -07:00
Ryan Barrett
c608ecaa36
noop: misc constants cleanup
2024-05-05 16:35:23 -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
b6845246e9
fix protocol bot users' image URLs
...
re: #967
2024-04-28 08:14:55 -07:00
Ryan Barrett
3c62f7cfcc
give up on email for now, still can't get SMTP to work
...
Gmail SMTP is unhappy with auth, even though I got it to work on https://shell-py3.appspot.com/ , and Gandi SMTP seems to block Google Cloud IPs. sigh.
2024-04-24 15:30:20 -07:00
Ryan Barrett
a79dc45b28
email: update from address
2024-04-24 15:07:42 -07:00
Ryan Barrett
b543fdb1d5
switch to Gmail SMTP, other minor tweaks
2024-04-24 14:26:20 -07:00
Ryan Barrett
ece168fac1
email me when someone enables or disables a protocol
2024-04-24 11:15:28 -07:00
Ryan Barrett
11eb082190
tighten common.unwrap so it doesn't remove protocol bot user URLs
...
...like https://bsky.brid.gy/ . this hopefully fixes following bot users in eg AP to enable protocols.
2024-04-23 12:00:39 -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
f357ea1698
ActivityPub: accept non-public DMs to protocol bot users
...
for #880
2024-04-21 08:36:03 -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
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
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
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
d2865fdb86
add common.ENABLED_BRIDGES, check before conversion and /bridge-user
2024-02-28 12:07:06 -08:00