Commit Graph

13975 Commits

Author SHA1 Message Date
Patrick Schratz 4de48d5252
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>
2022-10-13 21:44:04 -04:00
Yarden Shoham c4f7c96903
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>
2022-10-13 21:33:54 -04:00
wxiaoguang f40833d1f0
Remove useless `appVer` from JS `window.config` (#21445)
The only usage of `appVer` was in serviceworker.js, while indeed it
needs the asset version.
2022-10-14 01:16:27 +08:00
KN4CK3R 0e58201d1a
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>
2022-10-13 18:19:39 +08:00
Neel c35531dd11
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.
2022-10-13 11:31:10 +03:00
Yarden Shoham cda2c38f4a [skip ci] Updated translations via Crowdin 2022-10-13 00:21:26 +00:00
Yarden Shoham 6a6dc97b0f
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>
2022-10-13 00:14:14 +03:00
silverwind ac3a61ea17
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>
2022-10-12 12:26:27 -04:00
Clar Fon 42b803554c
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>
2022-10-12 12:17:55 -04:00
KN4CK3R 444e9df465
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>
2022-10-12 12:17:28 -04:00
Yarden Shoham b474730cf6
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>
2022-10-12 12:17:04 -04:00
qwerty287 a902af75f4
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>
2022-10-12 22:08:29 +08:00
Hubert Wawrzyńczyk c41b30760b
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>
2022-10-12 14:53:56 +08:00
KN4CK3R 0e57ff7eee
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>
2022-10-12 13:18:26 +08:00
M Hickford e84558b093
Improve OAuth integration tests (#21390)
In particular, test explicit error responses.

No change to behaviour.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-10-12 12:22:43 +08:00
Andreas Fischer 9862936ed3
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>
2022-10-11 22:44:09 -04:00
Yarden Shoham b5a54f03a2
Fix broken link to frontend guidelines in hacking guidelines (#21382) 2022-10-11 21:23:21 -04:00
KN4CK3R 4dc3b2ec57
Use Name instead of DisplayName in LFS Lock (#21415)
Fixes #21268

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-10-11 21:03:15 -04:00
kolaente e026459a2d [skip ci] Updated translations via Crowdin 2022-10-12 00:21:02 +00:00
kolaente d8a80b0ed7
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>
2022-10-11 16:42:31 -04:00
Gusted 5ba23066ff
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).
2022-10-11 20:01:07 +01:00
plsnp a99074b267
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>
2022-10-11 12:26:32 -04:00
zeripath 4a23212102
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>
2022-10-11 12:26:22 -04:00
Anbraten 5aceedc7fd
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>
2022-10-11 12:15:14 -04:00
Yarden Shoham 9b7675d0cf
Remove cancel button in repo creation page (#21381) 2022-10-11 22:47:35 +08:00
Bill Wenrich ea3c6c6d7b
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>
2022-10-11 21:12:44 +08:00
KN4CK3R 8752d89be7
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`.
2022-10-11 19:54:44 +08:00
Yarden Shoham 2d4c6321c3
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>
2022-10-11 18:48:17 +08:00
Lunny Xiao 1428877c37
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>
2022-10-11 16:57:37 +08:00
Gusted c540ee08d3
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
2022-10-11 07:41:39 +01:00
Lauris BH b59b0cad0a
Add user/organization code search (#19977)
Fixes #19925 

Screenshots:

![attels](https://user-images.githubusercontent.com/165205/173864718-fe789429-55bc-4cad-808c-9f02f335cddf.png)
2022-10-11 00:12:03 +01:00
zeripath 3ccebf7f40
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>
2022-10-10 21:54:30 +01:00
silverwind 94037ada24
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.
2022-10-10 20:45:02 +02:00
Yarden Shoham 083ac164dc
Fix missing left and right carets in TRANSLATORS (#21397) 2022-10-10 10:36:37 -04:00
wxiaoguang 23b6827151
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.
2022-10-10 15:05:32 +01:00
silverwind 7044d34ae5
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>
2022-10-10 20:02:20 +08:00
qwerty287 a813c9d8f3
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>
2022-10-09 20:07:41 +08:00
Yarden Shoham 97f3f1988b
Fix typos in PullRequestMergeForm.vue header comment (#21378)
Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
2022-10-09 15:17:01 +08:00
wxiaoguang 768e16dad1
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>
2022-10-08 12:22:44 +01:00
Kyle D 7bb12d7efa
Bump playwright to 1.26.1 (#21357) 2022-10-08 16:54:34 +08:00
eleith bbbf9a4b93
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
2022-10-08 13:24:44 +08:00
Michael Horstmann 6c53cf852f
Removed one extra whitespace in footer after "Template" (#21364) 2022-10-08 11:53:42 +08:00
Akshay Mankar f0aed8205b
Fix formatted link for PR review notifications to matrix (#21319)
The PR review notifications HTML was written as markdown due to not
using `MatrixLinkFormatter`.
2022-10-07 22:06:34 +01:00
KN4CK3R 223556073c
Show private data in feeds (#21369)
Show private data in feeds for admins and matching users.
2022-10-07 22:06:04 +01:00
zeripath 7d2545d183
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>
2022-10-07 22:02:24 +01:00
rj1 56aabf3e8d
Fix some typos and update db transaction demo in backend guideline (#21322)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-10-08 02:12:19 +08:00
wxiaoguang c08e42c47e
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)
2022-10-08 01:20:53 +08:00
KN4CK3R 69fc510d6d
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>
2022-10-07 23:30:59 +08:00
Andrew Imeson d94f15c2fd
Make external issue tracker regexp configurable via API (#21338)
Fixes #21336 

Signed-off-by: Andrew Imeson <andrew@andrewimeson.com>
2022-10-07 20:49:30 +08:00
delvh 81d7270cde
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>
2022-10-07 17:48:03 +08:00