Commit graph

13459 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
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
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
6543
2706e89138
Merge branch 'main' into feature-activitypub 2022-06-14 14:10:40 +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
singuliere
460c03ca49 [skip ci] Updated translations via Crowdin 2022-06-14 00:10:10 +00: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
singuliere
1fef9a2d69
Remove singuliere from MAINTAINERS (#19883) 2022-06-13 21:05:41 +01:00
wxiaoguang
0d7eda511f
Fix aria for logo (#19955)
Co-authored-by: 6543 <6543@obermui.de>
2022-06-13 14:46:39 -04:00
Lunny Xiao
ff82a18315
Fix mirror template bug (#19959)
* Fix mirror template bug

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2022-06-13 18:12:59 +02: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
Lunny Xiao
3c6c150740
Add deprecated log when using MySQL with utf8 charset (#19952) 2022-06-13 20:55:08 +08:00
Lunny Xiao
1a9821f57a
Move issues related files into models/issues (#19931)
* Move access and repo permission to models/perm/access

* fix test

* fix git test

* Move functions sequence

* Some improvements per @KN4CK3R and @delvh

* Move issues related code to models/issues

* Move some issues related sub package

* Merge

* Fix test

* Fix test

* Fix test

* Fix test

* Rename some files
2022-06-13 17:37:59 +08:00
yutotnh
3708ca8e28
fix: some typos (#19956) 2022-06-13 15:34:46 +08:00
Anthony Wang
d91c61f8fa
Update TestWebFinger to check for ActivityPub IRI in aliases 2022-06-12 21:11:14 -05:00
Lunny Xiao
5f136783d1 [skip ci] Updated translations via Crowdin 2022-06-13 00:10:09 +00: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
Lunny Xiao
110fc57cbc
Move some code into models/git (#19879)
* Move access and repo permission to models/perm/access

* fix test

* Move some git related files into sub package models/git

* Fix build

* fix git test

* move lfs to sub package

* move more git related functions to models/git

* Move functions sequence

* Some improvements per @KN4CK3R and @delvh
2022-06-12 23:51:54 +08:00
wxiaoguang
a9dc9b06e4
Fix signal loop in graceful manager (#19943) 2022-06-12 21:50:18 +08:00
Gusted
796c4eca0b
Prettify number of issues (#17760)
* Prettify number of issues

- Use the PrettyNumber function to add commas in large amount of issues.

* Use client-side formatting

* prettify on both server and client

* remove unused i18n entries

* handle more cases, support other int types in PrettyNumber

* specify locale to avoid issues with node default locale

* remove superfluos argument

* introduce template helper, octicon tweaks, js refactor

* Update modules/templates/helper.go

* Apply some suggestions.

* Add comment

* Update templates/user/dashboard/issues.tmpl

Co-authored-by: silverwind <me@silverwind.io>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-06-12 20:08:23 +08:00
Gusted
0097fbc2ac
Improve file header on mobile (#19945)
- File headers can become quite width, so ensure the file size is not
being wrapped into itself(width + padding-right) and allow the overflow
to be scrolled(overflow-x).
2022-06-12 12:30:22 +03:00
Gusted
edf14202fe
Unify repo settings & show better error (#19828)
* Unify context data
* Actually show invalid url in error
2022-06-12 13:43:27 +08: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
xkcdstickfigure
3898fc5bda [skip ci] Updated translations via Crowdin 2022-06-12 00:10:13 +00:00
Anthony Wang
7658649d61
Merge remote-tracking branch 'upstream/main' into feature-activitypub 2022-06-11 18:36:41 -05:00
xkcdstickfigure
47bb06236d
fixed comment typo (#19944) 2022-06-11 14:54:08 -04: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
6543
f7da251c5d
Merge branch 'main' into feature-activitypub 2022-06-11 16:59:18 +02:00
6543
a9cc9c0f7a
Auto merge pull requests when all checks succeeded via WebUI (#19648)
Add WebUI part of Auto merge feature

close #19621

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2022-06-11 16:44:20 +02:00
Lunny Xiao
ce3dd04c63
Fix some mirror bugs (#18649)
* Fix some mirror bugs

* Remove unnecessary code

* Fix lint

* rename stdard url

* Allow more charactors in git ssh protocol url

* improve the detection

* support ipv6 for git url parse

* Fix bug

* Fix template

* Fix bug

* fix template

* Fix tmpl

* Fix tmpl

* Fix parse ssh with interface

* Rename functions name

Co-authored-by: zeripath <art27@cantab.net>
2022-06-11 21:50:14 +08:00
wxiaoguang
88f2e457d8
Fix data-race problems in git module (quick patch) (#19934)
* Fix data-race problems in git module

* use HomeDir instead of setting.RepoRootPath

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-06-11 11:56:27 +08:00
silverwind
23422f9909 [skip ci] Updated translations via Crowdin 2022-06-11 00:10:12 +00: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