Ryan Barrett
c8b2103e13
rename Webmention class => Web, webmention.py => web.py
2023-05-26 17:40:29 -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
cf86f4d808
AP users: extract out Protocol.serve() method
...
#512
2023-05-23 21:30:57 -07:00
Ryan Barrett
f933c7e237
AP users: serve AS2 for external homepage URLs
...
#512
2023-05-22 23:17:42 -07:00
Ryan Barrett
d2ab48b23e
switch circular imports to runtime imports; split out flask_app.py from app.py
...
runtime imports are just as bad, but...meh. eventually I'll untangle them for real. #486
2023-04-18 17:18:17 -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
4c9744cd65
common.error bug fix, accept exc_info kwarg
2023-04-04 07:14:31 -07:00
Ryan Barrett
629c1a2bd4
unify Object.new/changed generation into Protocol.load
...
also:
* switch back to preserving fragments in URL ids
* webmention.fetch: if URL id redirects, preserve original id in Object
2023-04-03 07:53:15 -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
f836762b0f
big webmention.py refactoring
...
* use Objects properly
* use Object's mf2/AS2/AS1 conversion
* drop resuming partially completed deliveries
* use load, fetch, send
* get closer to unifying all activity handling into Protocol.receive
2023-04-01 19:13:51 -07:00
Ryan Barrett
61a6b5bbd2
add test that activitypub.postprocess_as2 is idempotent
...
ie calling it twice results in the same output object. true almost all the time!...but not uite all yet.
2023-04-01 13:08:04 -07:00
Ryan Barrett
e41ce9216c
noop, rename Protocol.get_object => Protocol.load
2023-03-29 13:13:32 -07:00
Ryan Barrett
e6be9cabb8
incoming AP: when we can't load the keyId, store a deleted Object
...
prevents re-fetching the same failing keyId actor over and over when we get the same Delete actor activity sent to all of our inboxes
2023-03-29 12:51:37 -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
754a6eb651
minor noop tweaks: dupe test, test name, docstring
2023-03-27 14:18:24 -07:00
Ryan Barrett
28e8baff6c
change Protocol.fetch() to return an Object instead of populating one
2023-03-22 20:49:28 -07:00
Ryan Barrett
88dd51b05b
continue abstracting logic in Protocol class
...
lots more to do.
also convert Object.as1 to AS2 in ActivityPub.send if necessary.
2023-03-20 19:17:55 -07:00
Ryan Barrett
fb5f7b3fb0
move current user into Flask g request-global
2023-03-20 14:28:14 -07:00
Ryan Barrett
bf15f4ca95
fix wm => AP reposts
...
fixes #453
2023-03-19 16:21:44 -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
d433dd3abe
wm => AP: switch actors in outgoing activities from objects to string ids
...
mostly. also inlines single-element attributedTo lists to just the element, without the list.
2023-03-19 09:34:42 -07:00
Ryan Barrett
ce37dd8637
process hashtags in tab objects with Mastodon-specific logic
...
lots of background in #45 . also https://docs.joinmastodon.org/spec/activitypub/#properties-used
2023-03-14 14:59:28 -07:00
Ryan Barrett
6ce9a83181
don't add notification label unless an activity involves the user
...
for #442 (ish)
2023-03-13 20:38:46 -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
bd748f5db1
bug fix for deb4b12659
...
fixes https://console.cloud.google.com/errors/detail/CNrPlPDIlZ-CUA;time=P30D?project=bridgy-federated
2023-03-10 07:49:41 -08:00
Ryan Barrett
deb4b12659
AS2: short circuit out on Delete actor that we don't have stored
...
...since when we try to fetch the actor to get their key to verify the signature, we get an HTTP 410 response, at least from Mastodon.
2023-03-10 07:36:50 -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
bc15902bed
bug fix, don't deliver activities to users if their Follower is inactive
2023-03-04 12:12:45 -08:00
Ryan Barrett
fa2a9a1afe
activitypub: store Create inner objects in their own Objects
2023-03-03 15:12:51 -08:00
Ryan Barrett
2dfddec2ef
convert activitypub.py logic to use all AS1
2023-03-03 09:28:40 -08:00
Ryan Barrett
116cd55ddb
finally start actually requiring HTTP Signatures
...
fixes #315
2023-02-26 07:34:15 -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
1f3bd41dc5
common.redirect_unwrap: stop following redirects when unwrapping actor URLs
2023-02-23 08:35:06 -06:00
Ryan Barrett
74b3b3b689
refactoring, move Object creation out of common.send_webmentions
...
ugh this was painful
2023-02-23 07:44:54 -06:00
Ryan Barrett
3d3335e860
AP => webmention repost bug fix, merge follower and wm domains
2023-02-23 07:39:26 -06:00
Ryan Barrett
4982906ed8
AP => webmention, reposts: handle loading original federated posts
...
bug fix for 72eb26e248
2023-02-21 21:57:38 -06:00
Ryan Barrett
72eb26e248
AP => webmention, bug fix for sending webmentions for reposts
...
thanks to @tantek for reporting!
2023-02-21 21:19:56 -06:00
Ryan Barrett
65bbc6751e
HTTP Signature verification: bug fix, use actual HTTP method
2023-02-16 07:34:12 -08:00
Ryan Barrett
d505b3859a
HTTP Signature verification: fetch and use keyId from signature
...
#315
2023-02-15 20:10:17 -08:00
Ryan Barrett
a7e96f585c
HTTP sig verification test: switch from assertLogs to mock
...
assertLogs was great, but didn't work when logging was disabled, eg by oauth_dropins.webutil.tests.__init__.py for python -m unittest discover.
I tried hard to override that and make it work, example code below, but couldn't get it to work. assertLogs() evidently needs a real handler, eg not NullHandler, but the default stderr stream handler that basicConfig() adds obviously emits to stderr.
print('@', logging.getLogger().hasHandlers())
logging_handlers = list(logging.getLogger().handlers)
logging.getLogger().handlers = []
logging_suppressed = logging.getLogger().isEnabledFor(logging.INFO)
logging.disable(logging.NOTSET)
handler = logging.NullHandler()
logging.getLogger().addHandler(handler)
activitypub.logger.disable(logging.NOTSET)
logging.getLogger().handlers = logging_handlers
logging.getLogger().removeHandler(handler)
if not logging_suppressed:
logging.disable(logging.CRITICAL + 1)
2023-02-15 14:10:25 -08:00
Ryan Barrett
e5d3f94b3e
AP signature verification: just log for now, don't fail
...
for #315
2023-02-15 14:10:25 -08:00
Ryan Barrett
63d0e59c2c
AP: verify incoming signatures!
...
for #315
2023-02-15 14:10:25 -08:00
Ryan Barrett
c2e6174330
add common.get_object()
2023-02-14 14:30:00 -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
46ab1cfdf7
AP inbox: simplify already-seen-id handling
2023-02-13 19:10:01 -08:00
Ryan Barrett
c305dcc8d5
AP inbox delivery: cache activity ids that we've already seen in memory
...
for #411
2023-02-12 22:17:04 -08:00
Ryan Barrett
7a625c5a02
AP inbox delivery: short circuit out if we've already seen the activity id
...
for #411 . next is caching in memory.
2023-02-12 21:58:59 -08:00
Ryan Barrett
bf97c1af4f
store all incoming AP activities in Objects
2023-02-11 22:53:50 -08:00