]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoDon't let repo clone URL overflow (#19517)
Gusted [Tue, 26 Apr 2022 23:22:11 +0000 (23:22 +0000)]
Don't let repo clone URL overflow (#19517)

- Apparently `<input>` elements differ from other elements have a size
attribute that act as a `min-width` CSS property, this causes a overflow
on mobile. By setting this size to `1` it doesn't try to force a
min-width and nicely shrink down.

2 years agoAdd commit status popup to issuelist (#19375)
parnic [Tue, 26 Apr 2022 22:40:01 +0000 (17:40 -0500)]
Add commit status popup to issuelist (#19375)

This gets the necessary data to the issuelist for it to support a clickable commit status icon which pops up the full list of commit statuses related to the commit. It accomplishes this without any additional queries or fetching as the existing codepath was already doing the necessary work but only returning the "last" status. All methods were wrapped to call the least-filtered version of each function in order to maximize code reuse.

Note that I originally left `getLastCommitStatus()` in `pull.go` which called to the new function, but `make lint` complained that it was unused, so I removed it. I would have preferred to keep it, but alas.

The only thing I'd still like to do here is force these popups to happen to the right by default instead of the left. I see that the only other place this is popping up right is on view_list.tmpl, but I can't figure out how/why right now.

Fixes #18810

2 years agoDisable unnecessary GitHooks elements (#18485)
Paweł Bogusławski [Tue, 26 Apr 2022 21:10:11 +0000 (23:10 +0200)]
Disable unnecessary GitHooks elements (#18485)

* Disable unnecessary GitHooks elements

This mod fixes disabling unnecessary GitHooks elements.

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

2 years agoDisable unnecessary GitHooks elements
Pawel Boguslawski [Mon, 31 Jan 2022 14:12:47 +0000 (15:12 +0100)]
Disable unnecessary GitHooks elements

This mod fixes disabling unnecessary GitHooks elements.

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

2 years agoImprove dashboard's repo list performance (#18963)
Gusted [Tue, 26 Apr 2022 20:34:30 +0000 (20:34 +0000)]
Improve dashboard's repo list performance (#18963)

* Improve dashboard's repo list performance

- Avoid a lot of database lookups for all the repo's, by adding a
undocumented "minimal" mode for this specific task, which returns the
data that's only needed by this list which doesn't require any database
lookups.
- Makes fetching these list faster.
- Less CPU overhead when a user visits home page.

* Refactor javascript code + fix Fork icon

- Use async in the function so we can use `await`.
- Remove `archivedFilter` check for count, as it doesn't make sense to
  show the count of repos when you can't even see them(as they are
  filited away).

* Add `count_only`

* Remove uncessary code

* Improve comment

Co-authored-by: delvh <dev.lh@web.de>
* Update web_src/js/components/DashboardRepoList.js

Co-authored-by: delvh <dev.lh@web.de>
* Update web_src/js/components/DashboardRepoList.js

Co-authored-by: delvh <dev.lh@web.de>
* By default apply minimal mode

* Remove `minimal` paramater

* Refactor count header

* Simplify init

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoBy default force vertical tabs on mobile (#19486)
Gusted [Tue, 26 Apr 2022 20:31:58 +0000 (20:31 +0000)]
By default force vertical tabs on mobile (#19486)

* By default force vertical tabs on mobile

- While experimenting with using vertical tabs instead of horizontal
tabs on gitea for a better mobile experience, I made a recent
PR(https://github.com/go-gitea/gitea/pull/19468) in order to see if
there was any objections to this new behavior for the repo headers(one
of the most annoying horizontal tabs). This PR had no objections and
even a user commenting that this change is brilliant.
- This PR now improves upon the previous PR by making this the de-facto
behavior for all menu's on mobile. The only exemption is the navbar
which also uses the menu but caught some layout errors with the changes.

* Fix organisation

* Fix repo/wiki buttons

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoRefactor readme file renderer (#19502)
Lunny Xiao [Tue, 26 Apr 2022 20:31:15 +0000 (04:31 +0800)]
Refactor readme file renderer (#19502)

* Refactor readme file renderer

* improve

2 years agoAllow package dump skipping (#19506)
KN4CK3R [Tue, 26 Apr 2022 20:30:51 +0000 (22:30 +0200)]
Allow package dump skipping (#19506)

* Added addReader to support verbose.

* Allow skipping packages.

* Updated docs.

* Update cmd/dump.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUnset git author/committer variables when running integration tests (#19512)
zeripath [Tue, 26 Apr 2022 20:28:45 +0000 (21:28 +0100)]
Unset git author/committer variables when running integration tests (#19512)

TestAPIGitTag (and likely others) will fail if the running environment contains
GIT_AUTHOR_NAME and other env variables like it.

This PR simply unsets these when running the integration tests.

Fix #14247

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAllow commit status popup on /pulls page (#19507)
parnic [Tue, 26 Apr 2022 19:09:46 +0000 (14:09 -0500)]
Allow commit status popup on /pulls page (#19507)

* Allow commit status popup on /pulls page

The /pulls page doesn't contain a "repository" element, so the early-out here was preventing the commit status popup hook from working. However, the only thing the .repository element is being used for here is determining whether the popup should be on the right or on the left, so we don't actually need the element to exist for the hook to work.

Pull request #19375 allows the statuses on /pulls pages to appear clickable, but this commit is required to make the popup actually work there.

* Move commit statuses popup hook to dedicated func

* Add missing import

2 years agoUse router param for filepath in GetRawFile (#19499)
John Olheiser [Tue, 26 Apr 2022 17:15:45 +0000 (12:15 -0500)]
Use router param for filepath in GetRawFile (#19499)

* Use router param for filepath

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move TreePath back into RepoRefForAPI

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix two typos (#19504)
Lunny Xiao [Tue, 26 Apr 2022 16:01:42 +0000 (00:01 +0800)]
Fix two typos (#19504)

2 years agoAdd a new menu in file view to open blame view and fix blame view select range bug...
Lunny Xiao [Tue, 26 Apr 2022 10:54:40 +0000 (18:54 +0800)]
Add a new menu in file view to open blame view and fix blame view select range bug (#19500)

2 years agoFix two UI bugs: JS error in imagediff.js, 500 error in diff/compare.tmpl
wxiaoguang [Tue, 26 Apr 2022 03:14:01 +0000 (11:14 +0800)]
Fix two UI bugs: JS error in imagediff.js, 500 error in diff/compare.tmpl

Co-authored-by: 6543 <6543@obermui.de>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 26 Apr 2022 00:10:13 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoImprove Stopwatch behavior (#18930)
Gusted [Mon, 25 Apr 2022 20:45:22 +0000 (20:45 +0000)]
Improve Stopwatch behavior (#18930)

- Don't send empty stopwatch over and over again, only send once.
- Stop interval to update stopwatch's timer when there is no more stopwatch.

2 years agoPass gitRepo down to GetRawDiff, since its used for main repo and wiki (#19461)
6543 [Mon, 25 Apr 2022 18:45:18 +0000 (20:45 +0200)]
Pass gitRepo down to GetRawDiff, since its used for main repo and wiki (#19461)

as per https://github.com/go-gitea/gitea/pull/19449#issuecomment-1105283931

pass gitRepo down to GetRawDiff, since its used for main repo and wiki

2 years agoUse queue instead of memory queue in webhook send service (#19390)
Lunny Xiao [Mon, 25 Apr 2022 18:03:01 +0000 (02:03 +0800)]
Use queue instead of memory queue in webhook send service (#19390)

2 years agoadd a directory prefix `gitea-src-VERSION` to release-tar-file (#19396)
jklippel [Mon, 25 Apr 2022 16:41:07 +0000 (18:41 +0200)]
add a directory prefix `gitea-src-VERSION` to release-tar-file (#19396)

Use a directory prefix instead on creating the tar file. Fixes: #19066

2 years agoUser specific repoID or xorm builder conditions for issue search (#19475)
6543 [Mon, 25 Apr 2022 14:06:24 +0000 (16:06 +0200)]
User specific repoID or xorm builder conditions for issue search (#19475)

* extend models.IssuesOptions to have more specific repo filter options

* use new options

* unrelated refactor

* rm RepoIDs

2 years agoAdd notags to fetch (#19487)
6543 [Mon, 25 Apr 2022 13:07:08 +0000 (15:07 +0200)]
Add notags to fetch (#19487)

2 years agoSimplify the code to get issue count (#19380)
Lunny Xiao [Mon, 25 Apr 2022 07:04:42 +0000 (15:04 +0800)]
Simplify the code to get issue count (#19380)

* Simple the code to get issue count

* Improve codes

2 years agouse IsLoopback (#19477)
6543 [Mon, 25 Apr 2022 05:55:12 +0000 (07:55 +0200)]
use IsLoopback (#19477)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 25 Apr 2022 00:10:29 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd RSS Feed buttons to Repo, User and Org pages (#19370)
ktprograms [Sun, 24 Apr 2022 20:03:39 +0000 (04:03 +0800)]
Add RSS Feed buttons to Repo, User and Org pages (#19370)

2 years ago[doctor] authorized-keys: fix displayed check name (#19464)
Pilou [Sun, 24 Apr 2022 18:06:33 +0000 (20:06 +0200)]
[doctor] authorized-keys: fix displayed check name (#19464)

The registered check name is authorized-keys, not authorized_keys.

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 24 Apr 2022 00:10:14 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUse horizontal tabs for repo header on mobile (#19468)
Gusted [Sat, 23 Apr 2022 16:56:33 +0000 (16:56 +0000)]
Use horizontal tabs for repo header on mobile (#19468)

* Use horizontal tabs for repo header on mobile

- The current behavior of the repo header on mobile is to display them
vertically column-by-column. I've only experience annoyance due to this
while trying to visit gitea instanced on mobile. This commit changes
this behavior to use horizontal tabs, it uses less tabs and doesn't
bloat 60% of your mobile screen with the repo headers.
- A small fix added in this commit is to give some space around the repo
buttons, current behavior is that they are too "close" to the repo
title.

* Fix lint

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 23 Apr 2022 00:10:15 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoMark TemplateLoading error as "UnprocessableEntity" (#19445)
Gusted [Fri, 22 Apr 2022 17:19:55 +0000 (17:19 +0000)]
Mark TemplateLoading error as "UnprocessableEntity" (#19445)

- Don't return Internal Server error if the user provide incorrect label
template, instead return UnprocessableEntity.
- Resolves #19399

2 years agoPrevent dangling cat-file calls (goroutine alternative) (#19454)
zeripath [Fri, 22 Apr 2022 15:20:04 +0000 (16:20 +0100)]
Prevent dangling cat-file calls (goroutine alternative) (#19454)

If an `os/exec.Command` is passed non `*os.File` as an input/output, go
will create `os.Pipe`s and wait for their closure in `cmd.Wait()`.  If
the code following this is responsible for closing `io.Pipe`s or other
handlers then on process death from context cancellation the `Wait` can
hang.

There are two possible solutions:

1. use `os.Pipe` as the input/output as `cmd.Wait` does not wait for these.
2. create a goroutine waiting on the context cancellation that will close the inputs.

This PR provides the second option - which is a simpler change that can
be more easily backported.

Closes #19448

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 22 Apr 2022 00:10:36 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoSet correct PR status on 3way on conflict checking (#19457)
Gusted [Thu, 21 Apr 2022 21:55:45 +0000 (21:55 +0000)]
Set correct PR status on 3way on conflict checking (#19457)

* Set correct PR status on 3way on conflict checking

- When 3-way merge is enabled for conflict checking, it has a new
interesting behavior that it doesn't return any error when it found a
conflict, so we change the condition to not check for the error, but
instead check if conflictedfiles is populated, this fixes a issue
whereby PR status wasn't correctly on conflicted PR's.
- Refactor the mergeable property(which was incorrectly set and lead me this
bug) to be more maintainable.
- Add a dedicated test for conflicting checking, so it should prevent
future issues with this.

* Fix linter

2 years agoFix logging of Transfer API (#19456)
Gusted [Thu, 21 Apr 2022 16:05:53 +0000 (16:05 +0000)]
Fix logging of Transfer API (#19456)

- Use the correct fullname's in tracing calls.
- Return correct function name in error.

Co-authored-by: 6543 <6543@obermui.de>
2 years agoRepoAssignment ensure to close before overwrite (#19449)
6543 [Thu, 21 Apr 2022 15:17:57 +0000 (17:17 +0200)]
RepoAssignment ensure to close before overwrite (#19449)

* check if GitRepo already open and close if

* only run RepoAssignment once

* refactor context helper for api to open GitRepo

2 years agonode12 is EOL (#19451)
techknowlogick [Thu, 21 Apr 2022 01:17:39 +0000 (21:17 -0400)]
node12 is EOL (#19451)

* node12 is EOL

* fix lockfile

2 years agoAdd Changelog v1.16.6 (#19339) (#19450)
6543 [Thu, 21 Apr 2022 01:17:23 +0000 (03:17 +0200)]
Add Changelog v1.16.6 (#19339) (#19450)

* Add Changelog v1.16.6 (#19339)

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
* bump version

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix DELETE request for non-existent public key (#19443)
Gusted [Thu, 21 Apr 2022 01:08:30 +0000 (01:08 +0000)]
Fix DELETE request for non-existent public key (#19443)

- Add a return for the first "block" of errors, which fixes the double
error messages.
- Add a return for `externallyManaged`.
- Resolves #19398

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 21 Apr 2022 00:10:26 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoDon't panic on `ErrEmailInvalid` (#19441)
Gusted [Wed, 20 Apr 2022 21:39:30 +0000 (21:39 +0000)]
Don't panic on `ErrEmailInvalid` (#19441)

- Don't panic on `ErrEmailInvalid`, this was caused due that we were
trying to force `ErrEmailCharIsNotSupported` interface, which panics.
- Resolves #19397

2 years agoWhen dumping trim the standard suffices instead of a random suffix (#19440)
zeripath [Wed, 20 Apr 2022 18:53:34 +0000 (19:53 +0100)]
When dumping trim the standard suffices instead of a random suffix (#19440)

* When dumping trim the standard suffices instead of a random suffix

Instead of using the `path.Ext()` to trim the last "extension" suffix, just iterate
through the supported suffices and trim those.

Fix #19424

Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix enum with to have correct supported types only

Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdd uploadpack.allowAnySHA1InWant to allow --filter=blob:none with older git clients...
zeripath [Wed, 20 Apr 2022 15:52:16 +0000 (16:52 +0100)]
Add uploadpack.allowAnySHA1InWant to allow --filter=blob:none with older git clients (#19430)

Older git clients need uploadpack.allowAnySHA1InWant if partial cloning is allowed.

Fix #19118

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoDon't allow merging PR's which are being conflict checked (#19357)
Gusted [Wed, 20 Apr 2022 14:43:15 +0000 (14:43 +0000)]
Don't allow merging PR's which are being conflict checked (#19357)

* Don't allow merging PR's which are being conflict checked

- When a PR is still being conflict checked, don't allow the PR to be
merged(the merge button could already be visible before e.g. a new
commit was pushed to the PR).
- Relevant(should prevent such issue from happening) #19352

Co-authored-by: delvh <dev.lh@web.de>
2 years agodoc: add brief intro on using traefik as reverse-proxy (#19432)
Campbell He [Wed, 20 Apr 2022 14:08:23 +0000 (22:08 +0800)]
doc: add brief intro on using traefik as reverse-proxy (#19432)

2 years agoFix panic in team repos API (#19431)
qwerty287 [Wed, 20 Apr 2022 10:43:26 +0000 (12:43 +0200)]
Fix panic in team repos API (#19431)

* Fix panic in team repos API

* Fix pagination

* fmt

2 years agoWhen updating mirror repo intervals by API reschedule next update too (#19429)
zeripath [Wed, 20 Apr 2022 08:20:53 +0000 (09:20 +0100)]
When updating mirror repo intervals by API reschedule next update too (#19429)

When a mirror repo interval is updated by the UI it is rescheduled with that interval
however the API does not do this. The API also lacks the enable_prune option.

This PR adds this functionality in to the API Edit Repo endpoint.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix nil error when some pages are rendered outside request context (#19427)
wxiaoguang [Tue, 19 Apr 2022 23:30:09 +0000 (07:30 +0800)]
Fix nil error when some pages are rendered outside request context (#19427)

2 years agoAdd Helm Chart registry (#19406)
KN4CK3R [Tue, 19 Apr 2022 16:55:35 +0000 (18:55 +0200)]
Add Helm Chart registry (#19406)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 18 Apr 2022 00:10:09 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 17 Apr 2022 00:10:24 +0000 (00:10 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoupgrade postgres refrence to 14 (#19416)
Stephen J. Fuhry [Sat, 16 Apr 2022 15:59:56 +0000 (11:59 -0400)]
upgrade postgres refrence to 14 (#19416)

2 years agoFix datarace in gitea_uploader.go (#19409)
chavacava [Fri, 15 Apr 2022 14:50:09 +0000 (16:50 +0200)]
Fix datarace in gitea_uploader.go (#19409)

2 years agoFix double blob-hunk (#19404)
Gusted [Fri, 15 Apr 2022 11:43:38 +0000 (11:43 +0000)]
Fix double blob-hunk (#19404)

- Don't show the blob-hunk twice.

2 years agoUse a struct as test options (#19393)
Lunny Xiao [Thu, 14 Apr 2022 13:58:21 +0000 (21:58 +0800)]
Use a struct as test options (#19393)

* Use a struct as test options

* Fix name

* Fix test

2 years agoDisallow selecting the text of buttons (#19330)
delvh [Thu, 14 Apr 2022 08:57:19 +0000 (10:57 +0200)]
Disallow selecting the text of buttons (#19330)

Introduce a CSS class `.unselectable`

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 13 Apr 2022 00:10:15 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoNote where frontend files are located in docs (#19379)
ktprograms [Tue, 12 Apr 2022 20:36:24 +0000 (04:36 +0800)]
Note where frontend files are located in docs (#19379)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoDocument 409 error returned by repos/migrate api (#19376)
Chongyi Zheng [Tue, 12 Apr 2022 08:13:07 +0000 (04:13 -0400)]
Document 409 error returned by repos/migrate api (#19376)

* Document 409 error returned by repos/migrate api

* Generate swagger spec

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix middleware function's placements for some `/user/...` (#19377)
Gusted [Tue, 12 Apr 2022 02:02:58 +0000 (04:02 +0200)]
Fix middleware function's placements for some `/user/...` (#19377)

- Add reqSignIn to `/user/task/{task}` as it specific to a logged in user currently not-logged in user could cause a NPE.
- Move `/user/stopwatch` & `/user/search` middleware before the actual function is called, because functions are executed in order and currently hadn't any effect and could as well cause a NPE due to that.
- Remove `/user/active` reqSignIn middleware, because when you want to active a account you're not "signed in" so it doesn't make sense to add that middleware.

2 years agoFix panic in teams API when requesting members (#19360)
delvh [Mon, 11 Apr 2022 12:49:49 +0000 (14:49 +0200)]
Fix panic in teams API when requesting members (#19360)

2 years agoAdd logic to switch between source/rendered on Markdown (#19356)
Gusted [Sun, 10 Apr 2022 15:01:35 +0000 (17:01 +0200)]
Add logic to switch between source/rendered on Markdown (#19356)

Adds a button to switch between the source blob and the rendered markdown.

2 years agoFixed registry host value. (#19363)
KN4CK3R [Sun, 10 Apr 2022 11:57:36 +0000 (13:57 +0200)]
Fixed registry host value. (#19363)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 10 Apr 2022 00:10:15 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAllow package linking to private repository (#19348)
KN4CK3R [Sat, 9 Apr 2022 15:57:37 +0000 (17:57 +0200)]
Allow package linking to private repository (#19348)

* Display private repos too.

* lint

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoUse "main" as default branch name (#19354)
wxiaoguang [Sat, 9 Apr 2022 04:26:48 +0000 (12:26 +0800)]
Use "main" as default branch name (#19354)

* Use "main" as default branch name

* fix test code

2 years agoMove milestone to models/issues/ (#19278)
Lunny Xiao [Fri, 8 Apr 2022 09:11:15 +0000 (17:11 +0800)]
Move milestone to models/issues/ (#19278)

* Move milestone to models/issues/

* Fix lint

* Fix test

* Fix lint

* Fix lint

2 years agoRefactor CSRF protection modules, make sure CSRF tokens can be up-to-date. (#19337)
wxiaoguang [Fri, 8 Apr 2022 05:21:05 +0000 (13:21 +0800)]
Refactor CSRF protection modules, make sure CSRF tokens can be up-to-date. (#19337)

Do a refactoring to the CSRF related code, remove most unnecessary functions.
Parse the generated token's issue time, regenerate the token every a few minutes.

2 years agoRemove dependent on session auth for api/v1 routers (#19321)
Lunny Xiao [Fri, 8 Apr 2022 04:22:10 +0000 (12:22 +0800)]
Remove dependent on session auth for api/v1 routers (#19321)

* Remove dependent on session auth for api/v1 routers

* Remove unnecessary session on API context

* remove missed header

* fix test

* fix missed api/v1

2 years agoAPI: Search Issues, dont show 500 if filter result in empty list (#19244)
6543 [Fri, 8 Apr 2022 02:39:03 +0000 (04:39 +0200)]
API: Search Issues, dont show 500 if filter result in empty list (#19244)

* remove error who is none

* use setupSessionNoLimit instead of setupSessionWithLimit when no pagination

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 8 Apr 2022 00:17:39 +0000 (00:17 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoNever use /api/v1 from Gitea UI Pages (#19318)
Lunny Xiao [Thu, 7 Apr 2022 18:59:56 +0000 (02:59 +0800)]
Never use /api/v1 from Gitea UI Pages (#19318)

Reusing `/api/v1` from Gitea UI Pages have pros and cons.
Pros:
1) Less code copy

Cons:
1) API/v1 have to support shared session with page requests.
2) You need to consider for each other when you want to change something about api/v1 or page.

This PR moves all dependencies to API/v1 from UI Pages.

Partially replace #16052

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 7 Apr 2022 00:17:35 +0000 (00:17 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoShow ssh command directly in template instead of i18n translation (#19335)
原俊杰 [Wed, 6 Apr 2022 11:35:04 +0000 (19:35 +0800)]
Show ssh command directly in template instead of i18n translation (#19335)

* add missing space for generate ssh token command

Signed-off-by: Junjie Yuan <yuan@junjie.pro>
* Do not use i18n for ssh command

* Remove unnecessary settings.ssh_token_code

* Revert locale_zh-CN.ini

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoPackage registry changes (#19305)
KN4CK3R [Wed, 6 Apr 2022 01:32:09 +0000 (03:32 +0200)]
Package registry changes (#19305)

* removed debug logs
* fixed SELECT
* removed unneeded error type
* use common SearchVersions method
* remove empty container upload versions
* return err

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 6 Apr 2022 00:17:36 +0000 (00:17 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd `ENABLE_SSH_LOG` to debugging problems (#19316)
Gusted [Tue, 5 Apr 2022 20:41:56 +0000 (22:41 +0200)]
Add `ENABLE_SSH_LOG` to debugging problems (#19316)

- Add this option to the debugging problems section. So users that are
trying to debug SSH-related problems will get the errors logged from `cmd/serv.go`

2 years agoWarn on SSH connection for incorrect configuration (#19317)
Gusted [Tue, 5 Apr 2022 20:28:10 +0000 (22:28 +0200)]
Warn on SSH connection for incorrect configuration (#19317)

* Warn on SSH connection for incorrect configuration

- When `setting.RepoRootPath` cannot be found(most likely due to
incorrect configuration) show "Gitea: Incorrect configuration" on the
client-side to help easier with debugging the problem.

* Update cmd/serv.go

Co-authored-by: delvh <dev.lh@web.de>
* Don't leak configuration

* Update cmd/serv.go

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoescape fake link
techknowlogick [Tue, 5 Apr 2022 17:30:07 +0000 (13:30 -0400)]
escape fake link

2 years agoAllow custom redirect for landing page (#19324)
techknowlogick [Tue, 5 Apr 2022 16:16:01 +0000 (12:16 -0400)]
Allow custom redirect for landing page (#19324)

* Allow custom redirect for landing page

* Update modules/setting/setting.go

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

* one option

Co-authored-by: delvh <dev.lh@web.de>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 5 Apr 2022 00:17:38 +0000 (00:17 +0000)]
[skip ci] Updated translations via Crowdin

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 4 Apr 2022 00:17:51 +0000 (00:17 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix links to packages documentation (#19315)
Steven [Sun, 3 Apr 2022 16:22:01 +0000 (18:22 +0200)]
Fix links to packages documentation (#19315)

2 years agoRemove legacy unmaintained packages, refactor to support change default locale (...
wxiaoguang [Sun, 3 Apr 2022 09:46:48 +0000 (17:46 +0800)]
Remove legacy unmaintained packages, refactor to support change default locale (#19308)

Remove two unmaintained vendor packages `i18n` and `paginater`. Changes:
* Rewrite `i18n` package with a more clear fallback mechanism. Fix an unstable `Tr` behavior, add more tests.
* Refactor the legacy `Paginater` to `Paginator`, test cases are kept unchanged.

Trivial enhancement (no breaking for end users):
* Use the first locale in LANGS setting option as the default, add a log to prevent from surprising users.

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 3 Apr 2022 00:17:41 +0000 (00:17 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoPrevent intermittent NPE in queue tests (#19301)
zeripath [Sat, 2 Apr 2022 07:59:04 +0000 (08:59 +0100)]
Prevent intermittent NPE in queue tests (#19301)

There appears to be an intermittent NPE in queue tests relating to the deferred
shutdown/terminate functions.

This PR more formally asserts that shutdown and termination occurs before starting
and finishing the tests but leaves the defer in place to ensure that if there is an
issue shutdown/termination will occur.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUpgrade xorm/builder from v0.3.9 to v0.3.10 (#19296)
Lunny Xiao [Fri, 1 Apr 2022 20:14:14 +0000 (04:14 +0800)]
Upgrade xorm/builder from v0.3.9 to v0.3.10 (#19296)

xorm/builder v0.3.10 add support to EXISTS and NOT EXISTS.

2 years agoAn attempt to sync a non-mirror repo must give 400 (Bad Request) (#19300)
Peter Gardfjäll [Fri, 1 Apr 2022 18:29:57 +0000 (20:29 +0200)]
An attempt to sync a non-mirror repo must give 400 (Bad Request) (#19300)

* An attempt to sync a non-mirror repo must give 400 (Bad Request)

* add missing return statement

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoRemove legacy `unknwon/com` package (#19298)
wxiaoguang [Fri, 1 Apr 2022 16:34:57 +0000 (00:34 +0800)]
Remove legacy `unknwon/com` package (#19298)

Follows: #19284
* The `CopyDir` is only used inside test code
* Rewrite `ToSnakeCase` with more test cases
* The `RedisCacher` only put strings into cache, here we use internal `toStr` to replace the legacy `ToStr`
* The `UniqueQueue` can use string as ID directly, no need to call `ToStr`

2 years agoImprove package registry docs (#19273)
Norwin [Fri, 1 Apr 2022 15:31:40 +0000 (17:31 +0200)]
Improve package registry docs (#19273)

* Improve package registry docs

* move new content down

* add hint re upload a package

* wording, formatting

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoA pull-mirror repo should be marked as such on creation (#19295)
Peter Gardfjäll [Fri, 1 Apr 2022 14:14:36 +0000 (16:14 +0200)]
A pull-mirror repo should be marked as such on creation (#19295)

Right now, a pull-mirror repo does not get marked as such until *after* the
mirroring completes. In the meantime, it will show up (in API and UI) as a
regular repo.

2 years agoRefactor legacy `unknwon/com` package, improve golangci lint (#19284)
wxiaoguang [Fri, 1 Apr 2022 08:47:50 +0000 (16:47 +0800)]
Refactor legacy `unknwon/com` package, improve golangci lint (#19284)

The main purpose is to refactor the legacy `unknwon/com` package.
1. Remove most imports of `unknwon/com`, only `util/legacy.go` imports the legacy `unknwon/com`
2. Use golangci's depguard to process denied packages
3. Fix some incorrect values in golangci.yml, eg, the version should be quoted string `"1.18"`
4. Use correctly escaped content for `go-import` and `go-source` meta tags
5. Refactor `com.Expand` to our stable (and the same fast) `vars.Expand`, our `vars.Expand` can still return partially rendered content even if the template is not good (eg: key mistach).

2 years agoSkip frontend ROOT_URL check on installation page, remove unnecessary global var...
wxiaoguang [Fri, 1 Apr 2022 08:00:26 +0000 (16:00 +0800)]
Skip frontend ROOT_URL check on installation page, remove unnecessary global var (#19291)

Skip `checkAppUrl` message on installation page because the ROOT_URL is not determined yet
Move global var `supportedDbTypeNames` into `install.Init` as a local var

2 years agoFix broken of team create (#19288)
Lunny Xiao [Fri, 1 Apr 2022 06:05:31 +0000 (14:05 +0800)]
Fix broken of team create (#19288)

* Fix broken of team create

* Update models/organization/team.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoRemove `git.Command.Run` and `git.Command.RunInDir*` (#19280)
wxiaoguang [Fri, 1 Apr 2022 02:55:30 +0000 (10:55 +0800)]
Remove `git.Command.Run` and `git.Command.RunInDir*` (#19280)

Follows #19266, #8553, Close #18553, now there are only three `Run..(&RunOpts{})` functions.
 * before: `stdout, err := RunInDir(path)`
 * now: `stdout, _, err := RunStdString(&git.RunOpts{Dir:path})`

2 years agoPerformance improvement for add team user when org has more than 1000 repositories...
Lunny Xiao [Fri, 1 Apr 2022 01:53:18 +0000 (09:53 +0800)]
Performance improvement for add team user when org has more than 1000 repositories (#19227)

* performance improvement for add team user when org has more than 1000 repositories

* Fix bug

* Fix bug

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 1 Apr 2022 00:17:38 +0000 (00:17 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUpdate JS dependencies (#19281)
silverwind [Fri, 1 Apr 2022 00:15:46 +0000 (02:15 +0200)]
Update JS dependencies (#19281)

- Upgrade all JS dependencies minus vue and vue-loader
- Adapt to breaking change of octicons
- Update eslint rules
- Tested Swagger UI, sortablejs and prod build

2 years agoFix container download counter (#19287)
KN4CK3R [Thu, 31 Mar 2022 23:08:32 +0000 (01:08 +0200)]
Fix container download counter (#19287)

* Increment counter on manifest download.

* Refactor GetPackageFileStream method.

2 years agogo.mod: update kevinburke/ssh_config to v1.2.0 (#19286)
Kevin Burke [Thu, 31 Mar 2022 22:05:57 +0000 (15:05 -0700)]
go.mod: update kevinburke/ssh_config to v1.2.0 (#19286)

Previously if you tried to read a HostName in a config file that
looked like this:

```
Host github
    HostName github.com        # This is the host for code review
```

DefaultUserSettings.Get("HostName") would return "github.com        ",
which I think is unintuitive and unexpected.

This behavior is fixed in v1.2 which would return "github.com" in the
above example.

2 years agoFix global packages enabled avaiable (#19276)
Lunny Xiao [Thu, 31 Mar 2022 17:31:53 +0000 (01:31 +0800)]
Fix global packages enabled avaiable (#19276)

Fix #19275