1
1
mirror of https://github.com/go-gitea/gitea synced 2024-06-01 08:55:47 +00:00
Commit Graph

29 Commits

Author SHA1 Message Date
Anthony Wang
f53e46c721
If httpsig verification fails, fix Host header and try again
This fixes a very rare bug when Gitea and another AP server (confirmed to happen with Mastodon) are running on the same machine, Gitea fails to verify incoming HTTP signatures. This is because the other AP server creates the sig with the public Gitea domain as the Host. However, when Gitea receives the request, the Host header is instead localhost, so the signature verification fails. Manually changing the host header to the correct value and trying the verification again fixes the bug.
2022-06-14 16:23:08 -05:00
Anthony Wang
a3120079a5
Make sure Person IRIs are generated correctly
This commit ensures that if the setting.AppURL is something like "http://127.0.0.1:42567" (like in the integration tests), a trailing slash will be added after that URL.
2022-06-14 12:30:36 -05:00
Anthony Wang
d06772b376
Return if marshalling error 2022-06-14 12:26:06 -05:00
Anthony Wang
e60158c70b
Make sure API responses always refer to username in original case
Copied from what I wrote on #19133 discussion: Handling username case is a very tricky issue and I've already encountered a Mastodon <-> Gitea federation bug due to Gitea considering Ta180m and ta180m to be the same user while Mastodon thinks they are two different users. I think the best way forward is for Gitea to only use the original case version of the username for federation so other AP software don't get confused.
2022-06-14 12:01:41 -05:00
Anthony Wang
add8469813
Merge branch 'feature-activitypub' of github.com:Ta180m/Gitea into feature-activitypub 2022-06-14 10:54:19 -05:00
6543
3f2d8b015f
dont drop err 2022-06-14 14:26:41 +02:00
6543
900ceb2dfd
make fmt 2022-06-14 14:12:00 +02:00
Anthony Wang
08eebffb0e
Make sure HTTP request Date in GMT 2022-06-13 23:10:36 -05:00
Anthony Wang
d749f8ff4f
Rename pkey to pubKey 2022-06-13 20:51:49 -05:00
Anthony Wang
f88979326c
Make sure Person endpoint has Content-Type application/activity+json and includes PreferredUsername, URL, and Icon
Setting the correct Content-Type is essential for federating with Mastodon
2022-06-13 17:14:41 -05:00
Anthony Wang
6074222377
Code cleanup 2022-06-11 21:15:45 -05:00
Anthony Wang
528c282d68
Correctly add inbox/outbox IRIs to person 2022-06-11 12:40:10 -05:00
Anthony Wang
cf6aed386d
Use @mariusor's suggestions for idiomatic go-ap usage 2022-06-11 11:00:45 -05:00
Anthony Wang
86a3221563
Fix CI errors by adding @context to Person() and making sure types match 2022-06-10 11:04:07 -05:00
Anthony Wang
46cab80ef4
Fix JSON unmarshall error 2022-06-10 10:37:55 -05:00
Anthony Wang
a8cb4a80bf
Convert remaining code to go-ap 2022-06-09 17:59:43 -05:00
Anthony Wang
57e6b67095
make fmt 2022-06-09 17:43:54 -05:00
Anthony Wang
becdf5e1f1
Use go-ap instead of go-fed 2022-05-23 11:43:59 -05:00
Anthony Wang
364838c11b
Fix lint errors 2022-05-09 19:11:08 -05:00
Anthony Wang
7931e210e5
Make pubKey IRI #main-key instead of /#main-key 2022-04-13 11:19:17 -05:00
Anthony Wang
1da0d49de7
Clean up some variable declarations 2022-03-30 15:52:52 -05:00
Anthony Wang
373a84a8e2
Clean up whitespace with make fmt 2022-03-27 12:25:56 -05:00
Anthony Wang
21c56f8e94
Use the httplib module instead of http for GET requests 2022-03-27 12:25:27 -05:00
Anthony Wang
46973f99fa
Cleanup, handle invalid usernames for ActivityPub person GET request
Signed-off-by: Anthony Wang <ta180m@pm.me>
2022-03-24 18:44:44 -05:00
Anthony Wang
f9e33d97cc
Run make fmt and make generate-swagger
Signed-off-by: Anthony Wang <ta180m@pm.me>
2022-03-19 09:14:08 -05:00
Anthony Wang
b480c52f60
Change 2021 to 2022, properly format package imports
Signed-off-by: Anthony Wang <ta180m@pm.me>
2022-03-19 08:55:58 -05:00
Loïc Dachary
97fedf2616
activitypub: implement the ReqSignature middleware
Signed-off-by: Loïc Dachary <loic@dachary.org>
2022-03-18 17:34:09 -05:00
Loïc Dachary
678a56fbf8
activitypub: add the public key to Person (#14186)
Refs: https://github.com/go-gitea/gitea/issues/14186

Signed-off-by: Loïc Dachary <loic@dachary.org>
2022-03-18 17:34:09 -05:00
Loïc Dachary
4951af4d99
activitypub: implement /api/v1/activitypub/user/{username} (#14186)
Return informations regarding a Person (as defined in ActivityStreams
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person).

Refs: https://github.com/go-gitea/gitea/issues/14186

Signed-off-by: Loïc Dachary <loic@dachary.org>
2022-03-18 17:33:29 -05:00