]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoUpdate OpenRC startup script (#21436)
Lauris BH [Sat, 15 Oct 2022 21:59:52 +0000 (00:59 +0300)]
Update OpenRC startup script (#21436)

2 years agoUse own Go version instead of hardcoded 1.17 for `make fmt` (#21457)
Yarden Shoham [Sat, 15 Oct 2022 20:10:25 +0000 (23:10 +0300)]
Use own Go version instead of hardcoded 1.17 for `make fmt` (#21457)

We should make sure we're using the same version across the codebase.
* We upgraded in #19918 but forgot about the following line
https://github.com/go-gitea/gitea/blob/6bb6a108e0c03b323402b452fc05c6845f7d00df/build/code-batch-process.go#L273

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdd `code` highlighting in issue titles (#21432)
Yarden Shoham [Sat, 15 Oct 2022 18:24:41 +0000 (21:24 +0300)]
Add `code` highlighting in issue titles (#21432)

This changes the rendering logic of issue titles. If a substring in an
issue title is enclosed with a pair of backticks, it'll be rendered with
a monospace font (HTML `code` tag).

* Closes #20887

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdd wording about keeping PRs up-to-date in CONTRIBUTING.md (#21468)
Yarden Shoham [Sat, 15 Oct 2022 16:41:24 +0000 (19:41 +0300)]
Add wording about keeping PRs up-to-date in CONTRIBUTING.md (#21468)

Following a discord discussion from today I've written the policy
explained to me about keeping PRs up-to-date.

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago[refactor] Use const for wiki DefaultBranch (#21466)
6543 [Sat, 15 Oct 2022 14:40:32 +0000 (16:40 +0200)]
[refactor] Use const for wiki DefaultBranch (#21466)

just a nit, that will make it easier to change things and we now have a
single source of truth

2 years agoFollow improve code quality (#21465)
wxiaoguang [Sat, 15 Oct 2022 12:18:31 +0000 (20:18 +0800)]
Follow improve code quality (#21465)

After some discussion, introduce a new slice `brokenArgs` to make
`gitCmd.Run()` return errors if any dynamic argument is invalid.

Co-authored-by: delvh <dev.lh@web.de>
2 years agoalternative to PR "improve code quality" (#21464)
wxiaoguang [Sat, 15 Oct 2022 10:49:26 +0000 (18:49 +0800)]
alternative to PR "improve code quality" (#21464)

This PR doesn't require new git version, and can be backported easily.

Co-authored-by: 6543 <6543@obermui.de>
2 years ago[skip ci] Updated translations via Crowdin
Yarden Shoham [Sat, 15 Oct 2022 00:21:30 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix Drone pushing commits with wrong author info (#21450)
Yarden Shoham [Fri, 14 Oct 2022 19:09:04 +0000 (22:09 +0300)]
Fix Drone pushing commits with wrong author info (#21450)

I don't know how to test this so I'll explain my thought process:

After a discussion with @techknowlogick in
https://github.com/go-gitea/gitea/commit/cda2c38f4a61ef7f448be3efab5420d9974c8474
I saw the CI config has this block:

https://github.com/go-gitea/gitea/blob/cda2c38f4a61ef7f448be3efab5420d9974c8474/.drone.yml#L618-L630

I don't know much about Drone but after looking at
[appleboy/drone-git-push](https://github.com/appleboy/drone-git-push)'s
source code, I think each setting becomes an environment variable (e.g.
`remote` to `PLUGIN_REMOTE`, `commit_message` to `PLUGIN_COMMIT_MESSAGE`
etc...). Take a look at the code block loading the author info:

https://github.com/appleboy/drone-git-push/blob/a69878c00665277c53fb38d6c5980221cb687935/main.go#L32-L42

Two environment variables are listed for each setting. This PR forces
both to have the same value.

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
2 years agoAdd vitest tests to Gitpod (#21449)
Yarden Shoham [Fri, 14 Oct 2022 15:22:57 +0000 (18:22 +0300)]
Add vitest tests to Gitpod (#21449)

The vitest PR is merged, we can now add vitest to Gitpod's testing pane
* #21444

We couldn't use jest in the same manner because we had to customize
`NODE_OPTIONS`.

Screenshot (look at all the cool stuff circled in red):

![image](https://user-images.githubusercontent.com/20454870/195728971-9a2eaa80-8d91-4e4f-899b-a068edb9ff30.png)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
2 years agoSwitch from jest to vitest (#21444)
silverwind [Fri, 14 Oct 2022 13:36:16 +0000 (15:36 +0200)]
Switch from jest to vitest (#21444)

Even if we are not bundling with `vite` yet, we can use `vitest` in
place of Jest which brings a few benefits like not requiring to use
`NODE_OPTIONS` to run and having sane module resolution.

It's possible to also use `jest-extended` with vitest, but I opted to
not do so for now because it brings heavyweight dependencies and it was
trivial to just rewrite the affected matchers to be compatible.

This PR also removes 153 JS dependencies, which is certainly nice.

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoDiff file tree tweaks (#21446)
silverwind [Fri, 14 Oct 2022 09:43:25 +0000 (11:43 +0200)]
Diff file tree tweaks (#21446)

- Left-align the diff stat line again like previously.
- Default the file tree to collapsed view, which means the tree will
rendered initially collapsed and it may "pop in" via JS if enabled. I
think this is more desirable than having the empty space for the tree
"pop out" like it currently does.
- Mute the icon, removing color unless hovered.
- Increase icon size and vertically center it.

Before:
<img width="1271" alt="image"
src="https://user-images.githubusercontent.com/115237/195666451-55771595-0525-42b8-be1b-d03cc1cb2961.png">

After:
<img width="1280" alt="image"
src="https://user-images.githubusercontent.com/115237/195666385-c91fd0de-6dcc-4d9c-89ff-7581828fcf14.png">

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoAdd cynkra bronze sponsor (#21325)
Patrick Schratz [Fri, 14 Oct 2022 01:44:04 +0000 (03:44 +0200)]
Add cynkra bronze sponsor (#21325)

@techknowlogick

Only added a placeholder, the index is possibly wrong. But I think you
need to do/finalize that as the opencollective holder :)

You can take the logo of the opencollective account. LMK if I can help
more!

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <matti@mdranta.net>
2 years agoRun `make fmt` (#21437)
Yarden Shoham [Fri, 14 Oct 2022 01:33:54 +0000 (04:33 +0300)]
Run `make fmt` (#21437)

The only change is what `make fmt` did, I am merely a vessel for its
glorious function

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
2 years agoRemove useless `appVer` from JS `window.config` (#21445)
wxiaoguang [Thu, 13 Oct 2022 17:16:27 +0000 (01:16 +0800)]
Remove useless `appVer` from JS `window.config` (#21445)

The only usage of `appVer` was in serviceworker.js, while indeed it
needs the asset version.

2 years agoAdd support for Chocolatey/NuGet v2 API (#21393)
KN4CK3R [Thu, 13 Oct 2022 10:19:39 +0000 (12:19 +0200)]
Add support for Chocolatey/NuGet v2 API (#21393)

Fixes #21294

This PR adds support for NuGet v2 API.

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix #21406: Hide repo information from file view/blame mode (#21420)
Neel [Thu, 13 Oct 2022 08:31:10 +0000 (14:01 +0530)]
Fix #21406: Hide repo information from file view/blame mode (#21420)

# Summary

The repo information such as description, stats and topics are getting
displayed in the top-bar when viewing a file. This has been fixed to
display the repo information only while navigating the repo and not
while viewing or blaming a file from the repo

## Before fix

Screenshot from the issue

![image](https://user-images.githubusercontent.com/47709856/195278543-9afbb735-7bd3-4f42-b3ba-da514c6989d2.png)

## After the fix

- **Repo homepage**

The repo description, topics and summary will be displayed

![image](https://user-images.githubusercontent.com/47709856/195443913-2ca967cd-6694-4a97-98d0-4d0750692b5d.png)

- **When opening a file**

The repo description, topic and summary has been conditionally hidden
from the view

<img width="1311" alt="image"
src="https://user-images.githubusercontent.com/47709856/195278964-9479231c-62ad-4c0e-b438-2018f22289db.png">

- **When running blame on a file**

> This was originally not part of the issue #21406. However the fix
seems relevant for the blame view as well.

<img width="1312" alt="image"
src="https://user-images.githubusercontent.com/47709856/195279619-02010775-aec3-4c8d-a184-d2d838c797e8.png">

- **From within a directory**

The repo description, topics and summary will not be displayed

![image](https://user-images.githubusercontent.com/47709856/195444080-ff5b2def-7e0f-47d7-b54a-7e9df5f9edd8.png)

Supporting integration tests have also been added.

2 years ago[skip ci] Updated translations via Crowdin
Yarden Shoham [Thu, 13 Oct 2022 00:21:26 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRespect user's locale when rendering the date range in the repo activity page (#21410)
Yarden Shoham [Wed, 12 Oct 2022 21:14:14 +0000 (00:14 +0300)]
Respect user's locale when rendering the date range in the repo activity page (#21410)

# Description
Previously, to make the date range understood by all, we used the format
"2006-01-02" for the dates as it's locale-generic.

This commit changes the rendering logic. Instead of rendering the date
on the server, we send a formatted computer-readable timestamp. The
client's javascript then renders it according to the user's locale.

This approach is reusable across the codebase, any `<time></time>` tag
with the data-format="date" attribute would get rendered according to
the user's chosen locale.

## Previous View

![image](https://user-images.githubusercontent.com/20454870/195099143-e1c5df86-282a-42f1-898f-a36bb5fe7c2f.png)

## New View

### English

![image](https://user-images.githubusercontent.com/20454870/195099301-5cda4eab-4012-49d5-97e5-b1f9cada9c06.png)

### French

![image](https://user-images.githubusercontent.com/20454870/195099434-ce23e394-8d65-4c4c-8ac8-8b96bc9044f3.png)

### Portuguese

![image](https://user-images.githubusercontent.com/20454870/195099559-9a7aed28-944a-45ec-bedb-64403e3faede.png)

### Italian

![image](https://user-images.githubusercontent.com/20454870/195099661-17758d55-3fe0-4797-879b-d45de0ee8ba3.png)

# References
* #21380
* #21387
* #21396

Inspiration:

I think either differentiating by class, or probably better by a custom
attribute such as `data-format` or similar, is the best course of
action.

_Originally posted by @delvh in
https://github.com/go-gitea/gitea/issues/21396#issuecomment-1274424788_

Resolves #21380

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2 years agoConsolidate more CSS colors into variables (#21402)
silverwind [Wed, 12 Oct 2022 16:26:27 +0000 (18:26 +0200)]
Consolidate more CSS colors into variables (#21402)

Move more colors into variables. The only real notable change is the dot
in the release timeline. Also, made the variable comments a bit more
clear.

<img width="279" alt="Screen Shot 2022-10-10 at 21 10 23"
src="https://user-images.githubusercontent.com/115237/194938496-e5a21056-67c4-4219-9c68-134b0edf0e61.png">

<img width="88" alt="Screen Shot 2022-10-10 at 21 31 53"
src="https://user-images.githubusercontent.com/115237/194939712-f666c43e-fb1a-4045-be52-1176391bd8ea.png">

<img width="90" alt="Screen Shot 2022-10-10 at 21 31 44"
src="https://user-images.githubusercontent.com/115237/194939710-2e620c06-75a9-41b7-a3e1-18eab7a57614.png">

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoAdd HEAD fix to gitea doctor (#21352)
Clar Fon [Wed, 12 Oct 2022 16:17:55 +0000 (12:17 -0400)]
Add HEAD fix to gitea doctor (#21352)

Due to a bug in presumably an older version of Gitea, multiple of my
repositories still have their HEADs pointing to a `master` branch while
the default branch on the UI is listed as `main`. This adds a `gitea
doctor` command that will fix all of the HEAD references for repos when
they're not synchronized with the default branch in the DB.

This will help with cloning to ensure that git automatically checks out
the right branch, instead of a nonexistent one.

Note: I'm not sure if I actually need to do more other than add a file
here. Will try testing this out on my server soon.

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoContribution guidelines (#21425)
KN4CK3R [Wed, 12 Oct 2022 16:17:28 +0000 (18:17 +0200)]
Contribution guidelines (#21425)

Some changes to the contribution guidelines.

- I removed the `Large Character Comments` part because I think they are
bad design. They are used in big files to group sections of code. This
code should be organized into individual files.
- Updated some paths.
- Added `Documentation` because our documentation is not good at the
moment. We should enforce documentation of newly added features to help
our users.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoRefactor Gitpod configuration to improve quick spin up of automated dev environments...
Yarden Shoham [Wed, 12 Oct 2022 16:17:04 +0000 (19:17 +0300)]
Refactor Gitpod configuration to improve quick spin up of automated dev environments (#21411)

This commit instructs Gitpod to run `docs` in watch mode in fresh
development environments so any dev could start hacking in seconds.

Also included some vscode extensions for Vue, Go, and Docker.

Try it here:

[![Open in
Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/yardenshoham/gitea/tree/gitpod)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agoSupport instance-wide OAuth2 applications (#21335)
qwerty287 [Wed, 12 Oct 2022 14:08:29 +0000 (16:08 +0200)]
Support instance-wide OAuth2 applications (#21335)

Support OAuth2 applications created by admins on the admin panel, they
aren't owned by anybody.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoCase-insensitive NuGet symbol file GUID (#21409)
Hubert Wawrzyńczyk [Wed, 12 Oct 2022 06:53:56 +0000 (08:53 +0200)]
Case-insensitive NuGet symbol file GUID (#21409)

NuGet symbol file lookup returned 404 on Visual Studio 2019 due to
case-sensitive api router. The api router should accept case-insensitive GUID.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoAdd generic set type (#21408)
KN4CK3R [Wed, 12 Oct 2022 05:18:26 +0000 (07:18 +0200)]
Add generic set type (#21408)

This PR adds a generic set type to get rid of maps used as sets.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoImprove OAuth integration tests (#21390)
M Hickford [Wed, 12 Oct 2022 04:22:43 +0000 (05:22 +0100)]
Improve OAuth integration tests (#21390)

In particular, test explicit error responses.

No change to behaviour.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoMake e-mail sanity check more precise (#20991)
Andreas Fischer [Wed, 12 Oct 2022 02:44:09 +0000 (04:44 +0200)]
Make e-mail sanity check more precise (#20991)

For security reasons, all e-mail addresses starting with
non-alphanumeric characters were rejected. This is too broad and rejects
perfectly valid e-mail addresses. Only leading hyphens should be
rejected -- in all other cases e-mail address specification should
follow RFC 5322.

Co-authored-by: Andreas Fischer <_@ndreas.de>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix broken link to frontend guidelines in hacking guidelines (#21382)
Yarden Shoham [Wed, 12 Oct 2022 01:23:21 +0000 (04:23 +0300)]
Fix broken link to frontend guidelines in hacking guidelines (#21382)

2 years agoUse Name instead of DisplayName in LFS Lock (#21415)
KN4CK3R [Wed, 12 Oct 2022 01:03:15 +0000 (03:03 +0200)]
Use Name instead of DisplayName in LFS Lock (#21415)

Fixes #21268

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago[skip ci] Updated translations via Crowdin
kolaente [Wed, 12 Oct 2022 00:21:02 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

2 years agofeat(pr review): add more space on mobile (#21326)
kolaente [Tue, 11 Oct 2022 20:42:31 +0000 (22:42 +0200)]
feat(pr review): add more space on mobile (#21326)

This PR adds more space to the review screen on mobile so that comments
are more readable and less "squashed" an smaller screens.

Before:

![Screen Shot 2022-10-03 at 17 12
26](https://user-images.githubusercontent.com/13721712/193612834-6add9e25-f635-4a5b-84f6-b8e2b320ec29.png)

After:

![Screen Shot 2022-10-03 at 17 10
15](https://user-images.githubusercontent.com/13721712/193612671-ab4ef640-0360-44ef-9184-b366b7abeb37.png)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoBump `golang.org/x/text` (#21412)
Gusted [Tue, 11 Oct 2022 19:01:07 +0000 (19:01 +0000)]
Bump `golang.org/x/text` (#21412)

- Update the `golang.org/x/text` dependency, this fixes [a security
issue](https://groups.google.com/g/golang-announce/c/-hjNw559_tE/m/KlGTfid5CAAJ).

2 years agoUpdate gitea.service (#21399)
plsnp [Tue, 11 Oct 2022 16:26:32 +0000 (18:26 +0200)]
Update gitea.service (#21399)

`LimitMEMLOCK=infinity` is already the default, so removed that

Default soft limit for LimitNOFILE is 1024
Default hard limit for LimitNOFILE is 524288

`LimitNOFILE=65535` increases the soft limit, but decreases the hard
limit

References:
* https://www.freedesktop.org/software/systemd/man/systemd.exec.html
*
https://blog.skbali.com/2019/09/set-ulimits-for-a-script-started-using-systemd/

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoDo DB update after merge in hammer context (#21401)
zeripath [Tue, 11 Oct 2022 16:26:22 +0000 (17:26 +0100)]
Do DB update after merge in hammer context (#21401)

When merge was changed to run in the background context, the db updates
were still running in request context. This means that the merge could
be successful but the db not be updated.

This PR changes both these to run in the hammer context, this is not
complete rollback protection but it's much better.

Fix #21332

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoadd gitpod config (#20995)
Anbraten [Tue, 11 Oct 2022 16:15:14 +0000 (18:15 +0200)]
add gitpod config (#20995)

Add a config for <https://www.gitpod.io/>. This allows users to easily
run an online IDE pre-configured to develop and test Gitea by opening
<https://gitpod.io/#https://github.com/go-gitea/gitea>.

[![Open in
Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/go-gitea/gitea)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoRemove cancel button in repo creation page (#21381)
Yarden Shoham [Tue, 11 Oct 2022 14:47:35 +0000 (17:47 +0300)]
Remove cancel button in repo creation page (#21381)

2 years agoImprove clarity for camo proxy parameters (#21386)
Bill Wenrich [Tue, 11 Oct 2022 13:12:44 +0000 (09:12 -0400)]
Improve clarity for camo proxy parameters (#21386)

Updates the Config Cheat Sheet for the `ALLWAYS` option in Camo proxy.

- Clarifies the behavior for true (both HTTP and HTTPS is proxied) vs
false (only HTTP is proxied)
- Minor grammar and typo improvements

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoRedirect to new repository owner (#21398)
KN4CK3R [Tue, 11 Oct 2022 11:54:44 +0000 (13:54 +0200)]
Redirect to new repository owner (#21398)

Fixes #17655

If you rename `user1` to `user2` and visit `/user1` you get redirected
to `/user2`. But if you visit `/user1/repo` you just get a 404 error.
With this PR the user is redirected to `/user2/repo`.

2 years agoUse ISO date format instead of hard-coded English date format for date range in repo...
Yarden Shoham [Tue, 11 Oct 2022 10:48:17 +0000 (13:48 +0300)]
Use ISO date format instead of hard-coded English date format for date range in repo activity page (#21396)

January 2, 2006 -> 2006-01-02

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
2 years agolog real ip of requests from ssh (#21216)
Lunny Xiao [Tue, 11 Oct 2022 08:57:37 +0000 (16:57 +0800)]
log real ip of requests from ssh (#21216)

Partially fix #21213.

This PR will get client IP address from SSH_CONNECTION env which should
be the first field of that. And deliver it to the internal API so Gitea
routers could record the real IP from SSH requests.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoAdd Num{Issues,Pulls} stats checks (#21404)
Gusted [Tue, 11 Oct 2022 06:41:39 +0000 (06:41 +0000)]
Add Num{Issues,Pulls} stats checks (#21404)

- Currently `repository.Num{Issues,Pulls}` weren't checked and could
become out-of-consistency. Adds these two checks to `CheckRepoStats`.
- Fix incorrect SQL query for `repository.NumClosedPulls`, the check
should be for `repo_num_pulls`.
- Reference: https://codeberg.org/Codeberg/Community/issues/696

2 years agoAdd user/organization code search (#19977)
Lauris BH [Mon, 10 Oct 2022 23:12:03 +0000 (02:12 +0300)]
Add user/organization code search (#19977)

Fixes #19925

Screenshots:

![attels](https://user-images.githubusercontent.com/165205/173864718-fe789429-55bc-4cad-808c-9f02f335cddf.png)

2 years agoStop logging CheckPath returns error: context canceled (#21064)
zeripath [Mon, 10 Oct 2022 20:54:30 +0000 (21:54 +0100)]
Stop logging CheckPath returns error: context canceled (#21064)

We should only log CheckPath errors if they are not simply due to
context cancellation - and we should add a little more context to the
error message.

Fix #20709

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoHook go-licenses into tidy again (#21353)
silverwind [Mon, 10 Oct 2022 18:45:02 +0000 (20:45 +0200)]
Hook go-licenses into tidy again (#21353)

Running it as part of the build is really unnecessary because we have a
valid output file in the repo and assuming go dependencies do not change
unless go.mod also changes, tidy really is the best target to run the
license generation after.

Also, regenerate the file as I missed to do so during the chroma update,
and mark all json files in assets as generated.

2 years agoFix missing left and right carets in TRANSLATORS (#21397)
Yarden Shoham [Mon, 10 Oct 2022 14:36:37 +0000 (17:36 +0300)]
Fix missing left and right carets in TRANSLATORS (#21397)

2 years agoFix calls to i18n in templates (#21394)
wxiaoguang [Mon, 10 Oct 2022 14:05:32 +0000 (22:05 +0800)]
Fix calls to i18n in templates (#21394)

Although the `.i18n` has been refactored to `.locale`, some PRs using
`.i18n` were still merged.

* #20219
* #21246

This PR fixes the calls to `.i18n`.

At the moment, `{{.nosuch.nosuch "..."}}` won't cause template error so
these mistakes don't cause 500 and haven't been found.

2 years agoUpdate JS dependencies and eslint config (#21388)
silverwind [Mon, 10 Oct 2022 12:02:20 +0000 (14:02 +0200)]
Update JS dependencies and eslint config (#21388)

- Update all JS dependencies and playwright image
- Add new eslint rules, enable a few more, fix issues
- Regenerate SVGs
- Tested Vue and Swagger

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoAllow creation of OAuth2 applications for orgs (#18084)
qwerty287 [Sun, 9 Oct 2022 12:07:41 +0000 (14:07 +0200)]
Allow creation of OAuth2 applications for orgs (#18084)

Adds the settings pages to create OAuth2 apps also to the org settings
and allows to create apps for orgs.

Refactoring: the oauth2 related templates are shared for
instance-wide/org/user, and the backend code uses `OAuth2CommonHandlers`
to share code for instance-wide/org/user.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix typos in PullRequestMergeForm.vue header comment (#21378)
Yarden Shoham [Sun, 9 Oct 2022 07:17:01 +0000 (10:17 +0300)]
Fix typos in PullRequestMergeForm.vue header comment (#21378)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
2 years agoUse weighted algorithm for string matching when finding files in repo (#21370) 12397/head
wxiaoguang [Sat, 8 Oct 2022 11:22:44 +0000 (19:22 +0800)]
Use weighted algorithm for string matching when finding files in repo (#21370)

This PR is for:
* https://github.com/go-gitea/gitea/issues/20231

Now, when a user searches `word`, they always see `/{word}.txt` before
`/{w}e-g{o}t-{r}esult.{d}at`

Demo:

When searching "a", "a.ext" comes first.

Then when searching "at", the longer matched "template" comes first.

<details>

![image](https://user-images.githubusercontent.com/2114189/194588738-3644d891-956f-40e4-b79b-b97d34265456.png)

![image](https://user-images.githubusercontent.com/2114189/194588797-9b124670-4e1e-4510-a170-780295ed89b8.png)

</details>

This PR also makes the frontend tests could import feature JS files by
introducing `jestSetup.js`

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: silverwind <me@silverwind.io>
2 years agoBump playwright to 1.26.1 (#21357)
Kyle D [Sat, 8 Oct 2022 08:54:34 +0000 (10:54 +0200)]
Bump playwright to 1.26.1 (#21357)

2 years agonpm package registry support for `bin` (#21372)
eleith [Sat, 8 Oct 2022 05:24:44 +0000 (22:24 -0700)]
npm package registry support for `bin` (#21372)

Fix #21303

npm package.json supports binary packaging:
https://docs.npmjs.com/cli/v8/configuring-npm/package-json#bin

the npm registry documents that the binary references will be attached
to the abbreviated version object:

https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-version-object

unfortunately their api documentation leaves this out:
https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#abbreviated-version-objectdoc

which is likely to be the reason this was left out in gitea's initial
implementation

this response is critical for npm to install the binary in the `.bin`
folder so as to be included on the users default bin path, resulting in
immediate access to any binaries provided by the package

2 years agoRemoved one extra whitespace in footer after "Template" (#21364)
Michael Horstmann [Sat, 8 Oct 2022 03:53:42 +0000 (03:53 +0000)]
Removed one extra whitespace in footer after "Template" (#21364)

2 years agoFix formatted link for PR review notifications to matrix (#21319)
Akshay Mankar [Fri, 7 Oct 2022 21:06:34 +0000 (23:06 +0200)]
Fix formatted link for PR review notifications to matrix (#21319)

The PR review notifications HTML was written as markdown due to not
using `MatrixLinkFormatter`.

2 years agoShow private data in feeds (#21369)
KN4CK3R [Fri, 7 Oct 2022 21:06:04 +0000 (23:06 +0200)]
Show private data in feeds (#21369)

Show private data in feeds for admins and matching users.

2 years agoAdd nicer error handling on template compile errors (#21350)
zeripath [Fri, 7 Oct 2022 21:02:24 +0000 (22:02 +0100)]
Add nicer error handling on template compile errors (#21350)

There are repeated issues reported whereby users are unable to interpret
the template errors. This PR adds some (somewhat complex) error handling
to the panic recovery for template renderering but hopefully makes the
interpretation of the error easier.

Reference #21344

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix some typos and update db transaction demo in backend guideline (#21322)
rj1 [Fri, 7 Oct 2022 18:12:19 +0000 (13:12 -0500)]
Fix some typos and update db transaction demo in backend guideline (#21322)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoRefactor parseTreeEntries, speed up tree list (#21368)
wxiaoguang [Fri, 7 Oct 2022 17:20:53 +0000 (01:20 +0800)]
Refactor parseTreeEntries, speed up tree list (#21368)

Close #20315 (fix the panic when parsing invalid input), Speed up #20231 (use ls-tree without size field)

Introduce ListEntriesRecursiveFast (ls-tree without size) and ListEntriesRecursiveWithSize (ls-tree with size)

2 years agoAdd GET and DELETE endpoints for Docker blob uploads (#21367)
KN4CK3R [Fri, 7 Oct 2022 15:30:59 +0000 (17:30 +0200)]
Add GET and DELETE endpoints for Docker blob uploads (#21367)

This PR adds support for
https://docs.docker.com/registry/spec/api/#get-blob-upload
https://docs.docker.com/registry/spec/api/#delete-blob-upload

Both are not required by the OCI spec but some clients call these
endpoints.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoMake external issue tracker regexp configurable via API (#21338)
Andrew Imeson [Fri, 7 Oct 2022 12:49:30 +0000 (08:49 -0400)]
Make external issue tracker regexp configurable via API (#21338)

Fixes #21336

Signed-off-by: Andrew Imeson <andrew@andrewimeson.com>
2 years agoAdd new CSS variables --color-accent and --color-small-accent (#21305)
delvh [Fri, 7 Oct 2022 09:48:03 +0000 (11:48 +0200)]
Add new CSS variables --color-accent and --color-small-accent (#21305)

At the moment, this is only used to replace the color of the `viewed`
checkbox and of the `has changed` label.
Previously, the used variable accentuated always either darker or
lighter, which meant that one theme looked good while the other didn't.

Co-authored-by: silverwind <me@silverwind.io>
2 years agoSet SemverCompatible to false for Conan packages (#21275)
KN4CK3R [Fri, 7 Oct 2022 04:22:05 +0000 (06:22 +0200)]
Set SemverCompatible to false for Conan packages (#21275)

Fixes #21250
Related #20414

Conan packages don't have to follow SemVer.
The migration fixes the setting for all existing Conan and Generic
(#20414) packages.

2 years agoParse OAuth Authorization header when request omits client secret (#21351)
M Hickford [Fri, 7 Oct 2022 02:53:49 +0000 (03:53 +0100)]
Parse OAuth Authorization header when request omits client secret (#21351)

This fixes error "unauthorized_client: invalid client secret" when
client includes secret in Authorization header rather than request body.
OAuth spec permits both.

Sanity validation that client id and client secret in request are
consistent with Authorization header.

Improve error descriptions. Error codes remain the same.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoDisable Firefox E2E tests (#21363)
silverwind [Thu, 6 Oct 2022 20:55:26 +0000 (22:55 +0200)]
Disable Firefox E2E tests (#21363)

Make CI green again, until we figure out
https://github.com/go-gitea/gitea/issues/21355.

2 years agoAdd redirect of /upgrade/ to /upgrade-from-gitea/ on docs site (#21330)
Joe Constant [Thu, 6 Oct 2022 20:53:02 +0000 (14:53 -0600)]
Add redirect of /upgrade/ to /upgrade-from-gitea/ on docs site (#21330)

Since adding an aliases block doesn't seem to work locally for me (I
suspect because a page actually exists and Hugo is granting preference
to existing pages over aliases), I also added entries to
static/_redirects file so Netlify will handle the redirects

Fixes #7208

2 years agoUpdate to go-enry v2.8.3 (#21360)
Clark Boylan [Thu, 6 Oct 2022 20:51:38 +0000 (13:51 -0700)]
Update to go-enry v2.8.3 (#21360)

This fixes an issue with enry's isVendor() method being too greedy. This
lead to gitea classifying unvendored code as vendored. The impact of
this is fairly minimal, but our Gitea users did notice which led me to
fixing this in go-enry. Some files will be tagged with a vendored flag
in the UI. I think it also impacts the calculation of language
statistics in the repo as vendored files are not incorporated into the
stats.

For more information on the issue see the go-enry bug:
  https://github.com/go-enry/go-enry/issues/135

2 years agoUpdate go to 1.19 (#21361)
zeripath [Thu, 6 Oct 2022 20:51:18 +0000 (21:51 +0100)]
Update go to 1.19 (#21361)

It appears that updating go to 1.19 for playwright was missed when we
updated to go 1.19 elsewhere.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoSessionUser protection against nil pointer dereference (#21358)
Paweł Bogusławski [Thu, 6 Oct 2022 20:50:38 +0000 (22:50 +0200)]
SessionUser protection against nil pointer dereference (#21358)

`SessionUser` should be protected against passing `sess` = `nil` to
avoid

```
PANIC: runtime error: invalid memory address or nil pointer dereference
```

in

https://github.com/go-gitea/gitea/pull/18452/files#diff-a215b82aadeb8b4c4632fcf31215dd421f804eb1c0137ec6721b980136e4442aR69

after upgrade from gitea v1.16 to v1.17.

Related: https://github.com/go-gitea/gitea/pull/18452
Author-Change-Id: IB#1126459

2 years agoFix and improve incorrect error messages (#21342)
delvh [Thu, 6 Oct 2022 06:00:54 +0000 (08:00 +0200)]
Fix and improve incorrect error messages (#21342)

L

2 years agoFix default theme-auto selector when nologin (#21346)
rock2dust [Thu, 6 Oct 2022 03:52:43 +0000 (11:52 +0800)]
Fix default theme-auto selector when nologin (#21346)

the bug is theme selector is `theme-` when not login to Gitea

![theme-auto](https://user-images.githubusercontent.com/76462613/194099390-0ff6854a-1eb9-4dba-bb28-fd238f2225f8.png)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoAdd `stat` to `ToCommit` function for speed (#21337)
Gennady Kovshenin [Thu, 6 Oct 2022 03:21:04 +0000 (06:21 +0300)]
Add `stat` to `ToCommit` function for speed (#21337)

Calls to ToCommit are very slow due to fetching diffs, analyzing files.
This patch lets us supply `stat` as false to speed fetching a commit
when we don't need the diff.

/v1/repo/commits has a default `stat` set as true now. Set to false to
experience fetching thousands of commits per second instead of 2-5 per
second.

2 years agoFix typo in API comment document (#21347)
wxiaoguang [Wed, 5 Oct 2022 20:26:34 +0000 (04:26 +0800)]
Fix typo in API comment document (#21347)

Close #21307

After the fix:

![image](https://user-images.githubusercontent.com/2114189/194120843-52566b84-6e29-4f91-859a-eb5839c68c54.png)

2 years agoUpdate comment about repository.DISABLED_REPO_UNITS in app.example.ini (#21343)
rock2dust [Wed, 5 Oct 2022 19:38:30 +0000 (03:38 +0800)]
Update comment about repository.DISABLED_REPO_UNITS in app.example.ini (#21343)

Add allowed values: `repo.projects`

2 years agoRemove extra space from title element (#21345)
rock2dust [Wed, 5 Oct 2022 19:24:21 +0000 (03:24 +0800)]
Remove extra space from title element (#21345)

Removes a spurious additional space in the head template.

![](https://user-images.githubusercontent.com/76462613/194077336-1e757242-6f92-4238-8856-746b2e9a1a2c.png)

2 years agoFix slight bug in katex (#21171)
zeripath [Wed, 5 Oct 2022 18:55:36 +0000 (19:55 +0100)]
Fix slight bug in katex (#21171)

There is a small bug in #20571 whereby `$a a$b b$` will not be correctly
detected as a math inline block of `a a$b b`. This PR fixes this.

Also reenable test cases as per #21340

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix linked account translation (#21331)
John Olheiser [Tue, 4 Oct 2022 12:51:07 +0000 (07:51 -0500)]
Fix linked account translation (#21331)

fix key used for translation

2 years ago[skip ci] Updated translations via Crowdin
Jason Song [Tue, 4 Oct 2022 00:20:52 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoTag list should include draft releases with existing tags (#21263)
Jason Song [Mon, 3 Oct 2022 12:05:53 +0000 (20:05 +0800)]
Tag list should include draft releases with existing tags (#21263)

Before, a tag for a draft release disappeared in the tag list, fix #21262.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
techknowlogick [Mon, 3 Oct 2022 00:20:54 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoForeign ID conflicts if ID is 0 for each item (#21271)
techknowlogick [Sun, 2 Oct 2022 21:43:16 +0000 (17:43 -0400)]
Foreign ID conflicts if ID is 0 for each item (#21271)

The default is 0 if not defined, and that causes dupe index errors

Co-authored-by: 6543 <6543@obermui.de>
2 years agoMake app.ini read-only message more prominent (#21315)
John Olheiser [Sun, 2 Oct 2022 08:12:59 +0000 (03:12 -0500)]
Make app.ini read-only message more prominent (#21315)

2 years agoFix doc and heatmap for the Vue3 refactoring (#21312)
wxiaoguang [Sun, 2 Oct 2022 02:13:44 +0000 (10:13 +0800)]
Fix doc and heatmap for the Vue3 refactoring (#21312)

2 years agoAllow specifying SECRET_KEY_URI, similar to INTERNAL_TOKEN_URI (#19663)
Clar Fon [Sat, 1 Oct 2022 17:26:33 +0000 (13:26 -0400)]
Allow specifying SECRET_KEY_URI, similar to INTERNAL_TOKEN_URI (#19663)

Only load SECRET_KEY and INTERNAL_TOKEN if they exist.
Never write the config file if the keys do not exist, which was only a fallback for Gitea upgraded from < 1.5

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoRefactor from Vue2 to Vue3 (#20044)
André Jaenisch [Sat, 1 Oct 2022 14:26:38 +0000 (16:26 +0200)]
Refactor from Vue2 to Vue3 (#20044)

Close #19902

2 years agoUpdate Golang deps (#21304)
techknowlogick [Sat, 1 Oct 2022 13:49:30 +0000 (09:49 -0400)]
Update Golang deps (#21304)

2 years agoFix issue that `sync_on_commit` is not set (#21309)
Chongyi Zheng [Sat, 1 Oct 2022 13:07:05 +0000 (09:07 -0400)]
Fix issue that `sync_on_commit` is not set (#21309)

<!--

Please check the following:

1. Make sure you are targeting the `main` branch, pull requests on
release branches are only allowed for bug fixes.
2. Read contributing guidelines:
https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md
3. Describe what your pull request does and which issue you're targeting
(if any)

-->
Fixes #21308.

With the original frontend template
`templates/repo/settings/options.tmpl`, the field
`push_mirror_sync_on_commit` is always empty even when checkbox is
checked. Removing `value` from the input tag seems to solve the issue,
and will set `push_mirror_sync_on_commit: on` when the checkbox is
checked.

(I'm not familiar with the frontend logics Gitea is using, so I don't
really understand the cause of it)

2 years ago[skip ci] Updated translations via Crowdin
qwerty287 [Sat, 1 Oct 2022 00:20:52 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd pages to view watched repos and subscribed issues/PRs (#17156)
qwerty287 [Thu, 29 Sep 2022 19:09:14 +0000 (21:09 +0200)]
Add pages to view watched repos and subscribed issues/PRs (#17156)

Adds GitHub-like pages to view watched repos and subscribed issues/PRs
This is my second try to fix this, but it is better than the first since
it doesn't uses a filter option which could be slow when accessing
`/issues` or `/pulls` and it shows both pulls and issues (the first try
is #17053).

Closes #16111
Replaces and closes #17053

![Screenshot](https://user-images.githubusercontent.com/80460567/134782937-3112f7da-425a-45b6-9511-5c9695aee896.png)

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix the hook related FAQ contents (#21297)
wxiaoguang [Thu, 29 Sep 2022 17:20:22 +0000 (01:20 +0800)]
Fix the hook related FAQ contents (#21297)

Follows
https://github.com/go-gitea/gitea/issues/21129#issuecomment-1260802986
* https://github.com/go-gitea/gitea/issues/21129#issuecomment-1260802986

A lot of users are asking similar questions.

The old content in FAQ doesn't seem to be related to the problem.

2 years agoCheck if email is used when updating user (#21289)
Alexander Shimchik [Thu, 29 Sep 2022 12:36:29 +0000 (15:36 +0300)]
Check if email is used when updating user (#21289)

Fix #21075
When updating user data should check if email is used by other users

2 years agoAdd name field for org api (#21270)
KN4CK3R [Thu, 29 Sep 2022 03:27:33 +0000 (05:27 +0200)]
Add name field for org api (#21270)

related #21205

The field `UserName` is not really usefull for an organization.
This adds a second `Name` field.

The [GitHub API](https://docs.github.com/en/rest/orgs/orgs#get-an-organization) uses `name` too. `UserName` should be deprecated then.

2 years agoAdd API endpoint to get changed files of a PR (#21177)
qwerty287 [Thu, 29 Sep 2022 02:27:20 +0000 (04:27 +0200)]
Add API endpoint to get changed files of a PR (#21177)

This adds an api endpoint `/files` to PRs that allows to get a list of changed files.

built upon #18228, reviews there are included
closes https://github.com/go-gitea/gitea/issues/654

Co-authored-by: Anton Bracke <anton@ju60.de>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
M Hickford [Thu, 29 Sep 2022 00:20:54 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoIgnore port for loopback redirect URIs (#21293)
M Hickford [Wed, 28 Sep 2022 22:19:55 +0000 (23:19 +0100)]
Ignore port for loopback redirect URIs (#21293)

Following https://datatracker.ietf.org/doc/html/rfc8252#section-7.3

Fixes #21285

2 years agoImprove error descriptions for unauthorized_client (#21292)
M Hickford [Wed, 28 Sep 2022 19:10:27 +0000 (20:10 +0100)]
Improve error descriptions for unauthorized_client (#21292)

Fixes #21282

As suggested by the [OAuth RFC](https://www.rfc-editor.org/rfc/rfc6749)
(quoted below), it's helpful to give more detail in the description

> error_description
OPTIONAL. Human-readable ASCII
[[USASCII](https://www.rfc-editor.org/rfc/rfc6749#ref-USASCII)] text
providing **additional information, used to assist the client developer
in understanding the error that occurred.**
Values for the "error_description" parameter MUST NOT include characters
outside the set %x20-21 / %x23-5B / %x5D-7E.

2 years agoConsolidate more CSS rules, fix inline code on arc-green (#21260)
silverwind [Wed, 28 Sep 2022 13:19:22 +0000 (15:19 +0200)]
Consolidate more CSS rules, fix inline code on arc-green (#21260)

- Consolidate various CSS rules into base rules
- Fix inline code in Markdown not having enough contrast on arc-green

Adds one new color variable, `--color-label-active-bg` for the
background of active labels.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUpdate bluemonday (#21281)
6543 [Wed, 28 Sep 2022 02:02:41 +0000 (04:02 +0200)]
Update bluemonday (#21281)

https://github.com/microcosm-cc/bluemonday/releases/tag/v1.0.20

Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoAdd support for authentication based on reverse proxy email (#19949)
Hasnain Lakhani [Wed, 28 Sep 2022 00:00:15 +0000 (17:00 -0700)]
Add support for authentication based on reverse proxy email (#19949)

This is useful in scenarios where the reverse proxy may have knowledge
of user emails, but does not know about usernames set on gitea,
as in the feature request in #19948.

I tested this by setting up a fresh gitea install with one user `mhl`
and email `m.hasnain.lakhani@gmail.com`. I then created a private repo,
and configured gitea to allow reverse proxy authentication.

Via curl I confirmed that these two requests now work and return 200s:

curl http://localhost:3000/mhl/private -I --header "X-Webauth-User: mhl"
curl http://localhost:3000/mhl/private -I --header "X-Webauth-Email: m.hasnain.lakhani@gmail.com"

Before this commit, the second request did not work.

I also verified that if I provide an invalid email or user,
a 404 is correctly returned as before

Closes #19948

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoDo not allow organisation owners add themselves as collaborator (#20043)
Wim [Tue, 27 Sep 2022 23:25:40 +0000 (01:25 +0200)]
Do not allow organisation owners add themselves as collaborator (#20043)

We're already checking for repo owners, but we also need to check for
organisation owners that try to add themselves as collaborator

Closes #17966