Anthony Wang
95aad98897
Use ctx.JSON in Person response to make code cleaner
2022-06-15 20:22:05 -05:00
Anthony Wang
e5ed91d986
Merge remote-tracking branch 'github/feature-activitypub' into feature-activitypub
2022-06-15 10:56:14 -05:00
Anthony Wang
f48115f5f0
Go back to using ap.IRI to generate inbox and outbox IRIs
2022-06-14 21:34:37 -05:00
Anthony Wang
1da4849ad7
Merge remote-tracking branch 'github/feature-activitypub' into feature-activitypub
2022-06-14 21:33:31 -05:00
Anthony Wang
14cfd8de23
Revert "If httpsig verification fails, fix Host header and try again"
...
This reverts commit f53e46c721 .
The bug was actually caused by nginx messing up the Host header when reverse-proxying since I didn't have the line `proxy_set_header Host $host;` in my nginx config for Gitea.
2022-06-14 21:11:55 -05:00
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
faf2855244
Add new federation settings to app.example.ini and config-cheat-sheet
2022-06-14 12:23:20 -05:00
Anthony Wang
a4403e4e80
Move httpsig algs constant slice to modules/setting/federation.go
2022-06-14 12:16:32 -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
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
3e9a69c8d3
Use UTC instead of GMT
2022-06-13 19:09:09 -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
ed2a6f5348
make lint-backend
2022-06-13 16:53:17 -05:00
Anthony Wang
718f35aab6
Merge remote-tracking branch 'upstream/main' into feature-activitypub
2022-06-13 16:49:36 -05:00
Anthony Wang
b6b7fe27b6
WebFinger: Add CORS header and fix Href -> Template for remote interactions
...
The CORS header is needed due to https://datatracker.ietf.org/doc/html/rfc7033#section-5 and fixes some Peertube <-> Gitea federation issues
2022-06-13 15:40:26 -05:00
Anthony Wang
a5b00ec4a5
Force CI rerun
2022-06-13 09:16:42 -05:00
Anthony Wang
d7b81f551d
make fmt
2022-06-13 09:03:10 -05:00
Anthony Wang
d91c61f8fa
Update TestWebFinger to check for ActivityPub IRI in aliases
2022-06-12 21:11:14 -05:00
Anthony Wang
5823d8150a
Add actor IRI and remote interaction URL to WebFinger response
2022-06-12 17:01:30 -05:00
Anthony Wang
191919e7fa
Merge remote-tracking branch 'upstream/main' into feature-activitypub
2022-06-12 14:25:41 -05:00
Anthony Wang
d1f14ff2c7
Move httpsig algos slice to an init() function
2022-06-12 14:24:47 -05:00
Anthony Wang
76f06cee31
Remove another LogSQL from ActivityPub person test
2022-06-11 21:18:15 -05:00
Anthony Wang
6074222377
Code cleanup
2022-06-11 21:15:45 -05:00
Anthony Wang
7658649d61
Merge remote-tracking branch 'upstream/main' into feature-activitypub
2022-06-11 18:36:41 -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
66b1761738
Fix lint error
2022-06-10 13:28:50 -05:00
Anthony Wang
7428ff0736
Fix TestActivityPubPersonInbox segfault
2022-06-10 12:30:13 -05:00
Anthony Wang
fc58ab6b25
Force CI rerun
2022-06-10 11:29:39 -05:00
Anthony Wang
d487a76572
Correctly decode JSON in api_activitypub_person_test.go
2022-06-10 11:19:23 -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
94fbd80b7b
Clean up go.sum
2022-06-09 18:56:43 -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
67e0fcdd76
Run go mod tidy to fix missing modules in go.mod and go.sum
2022-06-09 17:22:59 -05:00
Anthony Wang
1e57f01001
Merge remote-tracking branch 'github/main' into feature-activitypub
2022-06-09 17:18:33 -05:00