Commit graph

13503 commits

Author SHA1 Message Date
6543
7e1784fd3f
Merge branch 'main' into feature-activitypub 2022-06-16 22:09:41 +02:00
a1012112796
e3e06d13af
fix permission check for delete tag (#19985)
fix #19970

by the way, fix some error response about protected tags.

Signed-off-by: a1012112796 <1012112796@qq.com>
2022-06-16 22:03:03 +02:00
7a214dd212
More code cleanup 2022-06-16 14:18:30 -05:00
b35490c53d
Merge remote-tracking branch 'upstream/main' into feature-activitypub 2022-06-16 11:42:37 -05:00
c118dacde7
Move getting the RFC 2616 time to a separate function 2022-06-16 11:17:05 -05:00
2a013b8fe4
make generate-swagger
For some reason I didn't realize that /templates/swagger/v1_json.tmpl was machine-generated by make generate-swagger... I've been editing it by hand for three months! 🤦
2022-06-16 11:11:57 -05:00
wxiaoguang
89b0aac374 [skip ci] Updated translations via Crowdin 2022-06-16 16:10:29 +00:00
3a8b8408b4
Fix failing ActivityPubMissingPerson test
We now use ctx.ContextUser so the message printed out when a user does not exist is slightly different
2022-06-16 11:08:24 -05:00
6602fd136e
Add more better comments 2022-06-16 11:03:53 -05:00
0c49fea641
Don't multiply Federation.MaxSize by 1<<20 twice 2022-06-16 11:00:24 -05:00
6336ba2e83
Add better comments 2022-06-16 10:59:36 -05:00
db13e1d6a1
Add a warning about changing settings that can break federation 2022-06-16 10:53:18 -05:00
wxiaoguang
157b405753
Remove legacy git code (ver < 2.0), fine tune markup tests (#19930)
* clean git support for ver < 2.0

* fine tune tests for markup (which requires git module)

* remove unnecessary comments

* try to fix tests

* try test again

* use const for GitVersionRequired instead of var

* try to fix integration test

* Refactor CheckAttributeReader to make a *git.Repository version

* update document for commit signing with Gitea's internal gitconfig

* update document for commit signing with Gitea's internal gitconfig

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-06-16 23:47:44 +08:00
Gusted
70ce051f1a [skip ci] Updated translations via Crowdin 2022-06-16 15:10:36 +00:00
Gusted
36127a3336
Don't prevent overflow on y-as (#19978)
- Fomantic tries to prevent overflowing on the `y/x`-as by default on
stackable menu's on mobile screens. We already solve this issue by
forcing overflow on x as and hide it on y as(due to some issues with
other menu's), since https://github.com/go-gitea/gitea/pull/19486.
- However this edge case does require a y-overflow to show the dropdown,
because you cannot easily adjust this with CSS, once you're fiddling
with overflow's (https://stackoverflow.com/a/6433475). However
interesting behavior is noted
https://css-tricks.com/popping-hidden-overflow/ when you remove the
position: relative, it will suddenly work again. Well because this is
the only solution without redesigning dropdowns, I think we can live
with the side-effect of the dropdown items being full-width instead
"relative" width to their parent.
- Resolves #19976

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-06-16 22:49:22 +08:00
a1012112796
d05fb6f6c9 [skip ci] Updated translations via Crowdin 2022-06-16 14:10:29 +00:00
a1012112796
a6b7c3646a
fix go to file link for mirror repository (#19983)
the `BaseRepo` not always exit, should
use `Repository`.

Signed-off-by: a1012112796 <1012112796@qq.com>
2022-06-16 20:37:13 +08:00
Gusted
e399f0f5b4
Don't buffer doctor logger (#19982)
- We don't need to buffer the logger with a thousand capacity. It's not
a high-throughput logger, this also caused issue whereby the logger
can't keep up with repeated messages being send(somehow they are lost in
the queue?).
- Resolves #19969

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-06-16 17:10:33 +08:00
Lunny Xiao
b01dce2a6e
Allow render HTML with css/js external links (#19017)
* Allow render HTML with css/js external links

* Fix bug because of filename escape chars

* Fix lint

* Update docs about new configuration item

* Fix bug of render HTML in sub directory

* Add CSP head for displaying iframe in rendering file

* Fix test

* Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>

* Some improvements

* some improvement

* revert change in SanitizerDisabled of external renderer

* Add sandbox for iframe and support allow-scripts and allow-same-origin

* refactor

* fix

* fix lint

* fine tune

* use single option RENDER_CONTENT_MODE, use sandbox=allow-scripts

* fine tune CSP

* Apply suggestions from code review

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-06-16 11:33:23 +08:00
Gusted
7d1770cd71
Use correct count for NumOpenIssues (#19980)
- Don't specify the field in `Count` instead use `Cols` for this.
- Call `log.Error` when a error occur.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-06-16 10:51:34 +08:00
ad62049f0b
Fix failing ActivityPubPerson integration test by checking the correct field for username 2022-06-15 20:59:57 -05:00
fb1f551153
Move setting key constants to models/user/setting_keys.go 2022-06-15 20:56:50 -05:00
a2d5202d4e
Limit maximum ActivityPub request and response sizes to a configurable setting 2022-06-15 20:43:19 -05:00
e9e8a03e08
Use activitypub.ActivityStreamsContentType for Person response Content Type 2022-06-15 20:29:01 -05:00
3fe44596de
Revert "Use ctx.JSON in Person response to make code cleaner"
This doesn't work because the ctx.JSON() function already sends the response out and it's too late to edit the headers.

This reverts commit 95aad98897.
2022-06-15 20:26:47 -05:00
95aad98897
Use ctx.JSON in Person response to make code cleaner 2022-06-15 20:22:05 -05:00
Hugo Hoitink
6473bd333a
In code search, get code unit accessible repos in one (main) query (#19764)
* When non-admin users use code search, get code unit accessible repos in one main query

* Modified some comments to match the changes

* Removed unnecessary check for Access Mode in Collaboration table

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2022-06-16 02:24:10 +03:00
Gusted
881646520e [skip ci] Updated translations via Crowdin 2022-06-15 22:10:15 +00:00
Gusted
f0ce5470e5
Always try to fetch repo for mirrors (#19975)
- Always give a best-effort to fetching the repositories, if even that
fails indeed give a disconnected mirror found error.
- *Partially* resolves #19928

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-06-15 23:58:44 +08:00
e5ed91d986
Merge remote-tracking branch 'github/feature-activitypub' into feature-activitypub 2022-06-15 10:56:14 -05:00
Lauris BH
1f8f9c3826
Remove tab/TabName usage where it's not needed (#19973)
`tab` query argument and `TabName` in context is used only in profile so remove it from all other places where it's not used anymore.
2022-06-15 23:05:32 +08:00
6543
46b344ca3e
Merge branch 'main' into feature-activitypub 2022-06-15 16:27:31 +02:00
wxiaoguang
9f87b60b46
Fix cli command restore-repo: "units" should be parsed as StringSlice (#19953)
* Fix cli command restore-repo: "units" should be parsed as StringSlice because after  #15790 it's read by c.StringSlice("units").  Before, the "units" were processed by strings.Split
* Add checking for invalid unit names

Co-authored-by: 6543 <6543@obermui.de>
2022-06-15 20:28:03 +08:00
AHOHNMYC
97548d2722
Uppercase first languages letters (#19965) 2022-06-15 12:08:49 +02:00
Lunny Xiao
d91d4db344
Move tests as seperate sub packages to reduce duplicated file names (#19951) 2022-06-15 09:02:00 +02:00
6543
58401634d8
Update routers/web/webfinger.go 2022-06-15 08:50:26 +02:00
6543
172c39f781 use const for key values 2022-06-15 08:47:32 +02:00
silverwind
b4d420d865
Replace unstyled meter with progress (#19968)
Replace the only `<meter>` element in use with a `<progress>` which is
styled properly. Also slightly adjust colors on it for better contrast.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2022-06-15 12:28:24 +08:00
f48115f5f0
Go back to using ap.IRI to generate inbox and outbox IRIs 2022-06-14 21:34:37 -05:00
1da4849ad7
Merge remote-tracking branch 'github/feature-activitypub' into feature-activitypub 2022-06-14 21:33:31 -05:00
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
6543
c05bad8d41
Merge branch 'main' into feature-activitypub 2022-06-15 03:24:48 +02:00
6543
f8ad1a832f
Apply suggestions from code review
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2022-06-15 03:19:34 +02:00
singuliere
f6e2dbaf1e [skip ci] Updated translations via Crowdin 2022-06-15 00:10:14 +00:00
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
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
d06772b376
Return if marshalling error 2022-06-14 12:26:06 -05:00
faf2855244
Add new federation settings to app.example.ini and config-cheat-sheet 2022-06-14 12:23:20 -05:00
a4403e4e80
Move httpsig algs constant slice to modules/setting/federation.go 2022-06-14 12:16:32 -05:00
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