]> source.dussan.org Git - gitea.git/log
gitea.git
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

2 years agoFeature: Case-insensitive "find files in repo" (#21269)
HeySora [Tue, 27 Sep 2022 22:55:15 +0000 (00:55 +0200)]
Feature: Case-insensitive "find files in repo" (#21269)

This (short) PR builds upon #15028 and makes the file search
case-insensitive.

Previously, having a file named `TestFile.cs` would not be shown if
`test` was typed in the search box.
This now changes the matching function to be case-insensitive (without
affecting the UI).

The matching function, `strSubMatch`, is only used for this feature (it
has been introduced by #15028), meaning that this PR does not affect the
behaviour of any unrelated functionality of Gitea.

2 years agoBetter repo API unit checks (#21130)
John Olheiser [Tue, 27 Sep 2022 22:23:58 +0000 (17:23 -0500)]
Better repo API unit checks (#21130)

This PR would presumably
Fix #20522
Fix #18773
Fix #19069
Fix #21077

Fix #13622

-----

1. Check whether unit type is currently enabled
2. Check if it _will_ be enabled via opt
3. Allow modification as necessary

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix empty container layer history and UI (#21251)
KN4CK3R [Tue, 27 Sep 2022 13:03:24 +0000 (15:03 +0200)]
Fix empty container layer history and UI (#21251)

Fixes #21248

2 years agoAdd filetree on left of diff view (#21012)
sebastian-sauer [Tue, 27 Sep 2022 05:22:19 +0000 (07:22 +0200)]
Add filetree on left of diff view (#21012)

This PR adds a filetree to the left side of the files/diff view.

Initially the filetree will not be shown and may be shown via a new
"Show file tree" button.

Showing and hiding is using the same icon as github. Folders are
collapsible. On small devices (max-width 991 PX) the file tree will be
hidden.

Close #18192

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Tyrone Yeh [Tue, 27 Sep 2022 00:21:05 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd author search input (#21246)
Tyrone Yeh [Mon, 26 Sep 2022 10:15:12 +0000 (18:15 +0800)]
Add author search input (#21246)

New author filter in #20578 missing author search input
#20623 lost author, so add this

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoUpgrade chroma to v2.3.0 (#21259)
silverwind [Mon, 26 Sep 2022 05:50:03 +0000 (07:50 +0200)]
Upgrade chroma to v2.3.0 (#21259)

The behaviour of `PreventSurroundingPre` has changed in
https://github.com/alecthomas/chroma/pull/618 so that apparently it now
causes line wrapper tags to be no longer emitted, but we need some form
of indication to split the HTML into lines, so I did what
https://github.com/yuin/goldmark-highlighting/pull/33 did and added the
`nopWrapper`.

Maybe there are more elegant solutions but for some reason, just
splitting the HTML string on `\n` did not work.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Julien Palard [Mon, 26 Sep 2022 00:20:43 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoTypo in config-cheat-sheet (#21261)
Julien Palard [Sun, 25 Sep 2022 22:16:46 +0000 (00:16 +0200)]
Typo in config-cheat-sheet (#21261)

2 years agoUse native inputs in whitespace dropdown (#20980)
silverwind [Sun, 25 Sep 2022 14:01:05 +0000 (16:01 +0200)]
Use native inputs in whitespace dropdown (#20980)

Use native `<input type="radio">` instead of fake icon font. The
`pointer-events: none` is necessary so the link click always takes
effect. Tested in Firefox, Safari and Chrome.

Before:
<img width="305" alt="Screen Shot 2022-08-27 at 20 42 11"
src="https://user-images.githubusercontent.com/115237/187044786-6655c766-c3fb-4672-9e3e-219b3ec4896c.png">

After:
<img width="298" alt="Screen Shot 2022-08-27 at 21 10 05"
src="https://user-images.githubusercontent.com/115237/187044790-33f87741-062e-4744-80b1-d3bd3fd725e3.png">
<img width="302" alt="image"
src="https://user-images.githubusercontent.com/115237/187044872-6c133cea-65ee-4ebd-b18a-a8b38c791565.png">

2 years ago[skip ci] Updated licenses and gitignores
wxiaoguang [Sun, 25 Sep 2022 00:20:43 +0000 (00:20 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoUse en-US as fallback when using other default language (#21200)
wxiaoguang [Sat, 24 Sep 2022 23:00:16 +0000 (07:00 +0800)]
Use en-US as fallback when using other default language (#21200)

Only en-US has complete translations. When use other language as
default, the en-US should still be used as fallback.

Close #21199

### Screenshot

![image](https://user-images.githubusercontent.com/2114189/190882906-b7a83958-0ea2-46c4-9084-42c4f9a239aa.png)

Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoMake NuGet service index publicly accessible (#21242)
KN4CK3R [Sat, 24 Sep 2022 15:17:08 +0000 (17:17 +0200)]
Make NuGet service index publicly accessible (#21242)

Addition to #20734, Fixes #20717

The `/index.json` endpoint needs to be accessible even if the registry
is private. The NuGet client uses this endpoint without
authentification.

The old fix only works if the NuGet cli is used with `--source <name>`
but not with `--source <url>/index.json`.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoSave files in local storage as umask (#21198)
Nulo (he/him) [Sat, 24 Sep 2022 13:04:14 +0000 (13:04 +0000)]
Save files in local storage as umask (#21198)

Go creates temporary files as 600, but sometimes we want the group to be able to read them (for example,
for another user to back up the storage)

This PR applies the umask to the renamed tmp files in local storage.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoNPM Package Registry search API endpoint (#20280)
Jack Vine [Sat, 24 Sep 2022 11:24:33 +0000 (20:54 +0930)]
NPM Package Registry search API endpoint (#20280)

Close #20098, in the NPM registry API, implemented to match what's described by https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search

Currently have only implemented the bare minimum to work with the [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui.html).

Co-authored-by: Jack Vine <jackv@jack-lemur-suse.cat-prometheus.ts.net>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Tyrone Yeh [Sat, 24 Sep 2022 00:20:52 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdded search input field to issue filter (#20623)
Tyrone Yeh [Fri, 23 Sep 2022 05:23:24 +0000 (13:23 +0800)]
Added search input field to issue filter (#20623)

Added search input field to issue filter for label and milestone and assignee

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoVarious CSS tweaks (#21244)
silverwind [Fri, 23 Sep 2022 03:00:29 +0000 (05:00 +0200)]
Various CSS tweaks (#21244)

- Remove arc-green specific rules and instead fix the colors in the base
rules.
- Make file table row border visible on arc-green.
- Remove remnants of fomantic accordeon module that was removed.