]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoKd/ci playwright go test (#20123)
Kyle D [Fri, 2 Sep 2022 19:18:23 +0000 (15:18 -0400)]
Kd/ci playwright go test (#20123)

* Add initial playwright config

* Simplify Makefile

* Simplify Makefile

* Use correct config files

* Update playwright settings

* Fix package-lock file

* Don't use test logger for e2e tests

* fix frontend lint

* Allow passing TEST_LOGGER variable

* Init postgres database

* use standard gitea env variables

* Update playwright

* update drone

* Move empty env var to commands

* Cleanup

* Move integrations to subfolder

* tests integrations to tests integraton

* Run e2e tests with go test

* Fix linting

* install CI deps

* Add files to ESlint

* Fix drone typo

* Don't log to console in CI

* Use go test http server

* Add build step before tests

* Move shared init function to common package

* fix drone

* Clean up tests

* Fix linting

* Better mocking for page + version string

* Cleanup test generation

* Remove dependency on gitea binary

* Fix linting

* add initial support for running specific tests

* Add ACCEPT_VISUAL variable

* don't require git-lfs

* Add initial documentation

* Review feedback

* Add logged in session test

* Attempt fixing drone race

* Cleanup and bump version

* Bump deps

* Review feedback

* simplify installation

* Fix ci

* Update install docs

2 years agochore: add myself to maintainers (#21028)
Jason Song [Fri, 2 Sep 2022 12:23:48 +0000 (20:23 +0800)]
chore: add myself to maintainers (#21028)

2 years agoSupport Issue forms and PR forms (#20987)
Jason Song [Fri, 2 Sep 2022 07:58:49 +0000 (15:58 +0800)]
Support Issue forms and PR forms (#20987)

* feat: extend issue template for yaml

* feat: support yaml template

* feat: render form to markdown

* feat: support yaml template for pr

* chore: rename to Fields

* feat: template unmarshal

* feat: split template

* feat: render to markdown

* feat: use full name as template file name

* chore: remove useless file

* feat: use dropdown of fomantic ui

* feat: update input style

* docs: more comments

* fix: render text without render

* chore: fix lint error

* fix: support use description as about in markdown

* fix: add field class in form

* chore: generate swagger

* feat: validate template

* feat: support is_nummber and regex

* test: fix broken unit tests

* fix: ignore empty body of md template

* fix: make multiple easymde editors work in one page

* feat: better UI

* fix: js error in pr form

* chore: generate swagger

* feat: support regex validation

* chore: generate swagger

* fix: refresh each markdown editor

* chore: give up required validation

* fix: correct issue template candidates

* fix: correct checkboxes style

* chore: ignore .hugo_build.lock in docs

* docs: separate out a new doc for merge templates

* docs: introduce syntax of yaml template

* feat: show a alert for invalid templates

* test: add case for a valid template

* fix: correct attributes of required checkbox

* fix: add class not-under-easymde for dropzone

* fix: use more back-quotes

* chore: remove translation in zh-CN

* fix EasyMDE statusbar margin

* fix: remove repeated blocks

* fix: reuse regex for quotes

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoInclude go.mod in gomod-check and rename to tidy-check (#21025)
silverwind [Fri, 2 Sep 2022 01:58:09 +0000 (03:58 +0200)]
Include go.mod in gomod-check and rename to tidy-check (#21025)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago[skip ci] Updated translations via Crowdin
zeripath [Fri, 2 Sep 2022 00:20:55 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUpdate a few go dependencies (#21022)
zeripath [Thu, 1 Sep 2022 21:13:17 +0000 (22:13 +0100)]
Update a few go dependencies (#21022)

There are a lot of go dependencies that appear old and we should update them.

The following packages have been updated:

* codeberg.org/gusted/mcaptcha
* github.com/markbates/goth
* github.com/buildkite/terminal-to-html
* github.com/caddyserver/certmagic
* github.com/denisenkom/go-mssqldb
* github.com/duo-labs/webauthn
* github.com/editorconfig/editorconfig-core-go/v2
* github.com/felixge/fgprof
* github.com/gliderlabs/ssh
* github.com/go-ap/activitypub
* github.com/go-git/go-git/v5
* github.com/go-ldap/ldap/v3
* github.com/go-swagger/go-swagger
* github.com/go-testfixtures/testfixtures/v3
* github.com/golang-jwt/jwt/v4
* github.com/klauspost/compress
* github.com/lib/pq
* gitea.com/lunny/dingtalk_webhook - instead of github.com
* github.com/mattn/go-sqlite3
* github/matn/go-isatty
* github.com/minio/minio-go/v7
* github.com/niklasfasching/go-org
* github.com/prometheus/client_golang
* github.com/stretchr/testify
* github.com/unrolled/render
* github.com/xanzy/go-gitlab
* gopkg.in/ini.v1

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
Lunny Xiao [Thu, 1 Sep 2022 00:20:54 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix missed sort bug (#20996)
Lunny Xiao [Wed, 31 Aug 2022 18:15:12 +0000 (02:15 +0800)]
Fix missed sort bug (#20996)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix typo (#21004)
ya [Wed, 31 Aug 2022 16:47:34 +0000 (00:47 +0800)]
Fix typo (#21004)

Missing directory

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoMake sure fmt catches all templates (#20979)
silverwind [Wed, 31 Aug 2022 15:58:54 +0000 (17:58 +0200)]
Make sure fmt catches all templates (#20979)

* Make sure fmt catches all templates

Make's `wildcard` is not recursive so it missed many template files, fix
that by using `find`.

* Update Makefile

2 years agoRemove black labels and CSS cleanup (#21003)
silverwind [Wed, 31 Aug 2022 09:04:41 +0000 (11:04 +0200)]
Remove black labels and CSS cleanup (#21003)

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoGo 1.19 format (#20758)
John Olheiser [Wed, 31 Aug 2022 02:15:45 +0000 (21:15 -0500)]
Go 1.19 format (#20758)

* 1.19 gofumpt

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Change CSV test

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Commit whitespace fixes from @zeripath

Co-authored-by: zeripath <art27@cantab.net>
* Update emoji

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* bump swagger & fix generate-swagger

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years ago[skip ci] Updated translations via Crowdin
JonRB [Wed, 31 Aug 2022 00:21:00 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix typo (#20993)
JonRB [Mon, 29 Aug 2022 15:20:20 +0000 (16:20 +0100)]
Fix typo (#20993)

2 years agofix broken insecureskipverify handling in rediss connection uris (#20967)
Igor Rzegocki [Mon, 29 Aug 2022 14:38:49 +0000 (16:38 +0200)]
fix broken insecureskipverify handling in rediss connection uris (#20967)

fixes regression #19213

2 years agoRedirect if user does not exist (#20981)
KN4CK3R [Mon, 29 Aug 2022 13:44:39 +0000 (15:44 +0200)]
Redirect if user does not exist (#20981)

2 years agofix hard-coded timeout and error panic in API archive download endpoint (#20925)
Peter Gardfjäll [Mon, 29 Aug 2022 09:45:20 +0000 (11:45 +0200)]
fix hard-coded timeout and error panic in API archive download endpoint (#20925)

* fix hard-coded timeout and error panic in API archive download endpoint

This commit updates the `GET /api/v1/repos/{owner}/{repo}/archive/{archive}`
endpoint which prior to this PR had a couple of issues.

1. The endpoint had a hard-coded 20s timeout for the archiver to complete after
   which a 500 (Internal Server Error) was returned to client. For a scripted
   API client there was no clear way of telling that the operation timed out and
   that it should retry.

2. Whenever the timeout _did occur_, the code used to panic. This was caused by
   the API endpoint "delegating" to the same call path as the web, which uses a
   slightly different way of reporting errors (HTML rather than JSON for
   example).

   More specifically, `api/v1/repo/file.go#GetArchive` just called through to
   `web/repo/repo.go#Download`, which expects the `Context` to have a `Render`
   field set, but which is `nil` for API calls. Hence, a `nil` pointer error.

The code addresses (1) by dropping the hard-coded timeout. Instead, any
timeout/cancelation on the incoming `Context` is used.

The code addresses (2) by updating the API endpoint to use a separate call path
for the API-triggered archive download. This avoids producing HTML-errors on
errors (it now produces JSON errors).

Signed-off-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
2 years agoAdd support for Vagrant packages (#20930)
KN4CK3R [Mon, 29 Aug 2022 07:04:45 +0000 (09:04 +0200)]
Add support for Vagrant packages (#20930)

* Add support for Vagrant boxes.

* Add authentication.

* Add tests.

* Add integration tests.

* Add docs.

* Add icons.

* Update routers/api/packages/api.go

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
2 years ago[skip ci] Updated translations via Crowdin
JonRB [Mon, 29 Aug 2022 00:20:41 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd instructions how to add service dependencies (#20968)
JonRB [Sun, 28 Aug 2022 15:28:42 +0000 (16:28 +0100)]
Add instructions how to add service dependencies (#20968)

2 years agoShare HTML template renderers and create a watcher framework (#20218)
zeripath [Sun, 28 Aug 2022 09:43:25 +0000 (10:43 +0100)]
Share HTML template renderers and create a watcher framework (#20218)

The recovery, API, Web and package frameworks all create their own HTML
Renderers. This increases the memory requirements of Gitea
unnecessarily with duplicate templates being kept in memory.

Further the reloading framework in dev mode for these involves locking
and recompiling all of the templates on each load. This will potentially
hide concurrency issues and it is inefficient.

This PR stores the templates renderer in the context and stores this
context in the NormalRoutes, it then creates a fsnotify.Watcher
framework to watch files.

The watching framework is then extended to the mailer templates which
were previously not being reloaded in dev.

Then the locales are simplified to a similar structure.

Fix #20210
Fix #20211
Fix #20217

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated licenses and gitignores
silverwind [Sun, 28 Aug 2022 00:20:43 +0000 (00:20 +0000)]
[skip ci] Updated licenses and gitignores

2 years ago[skip ci] Updated translations via Crowdin
silverwind [Sat, 27 Aug 2022 00:20:55 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoChange review buttons to icons to make space for text (#20934)
silverwind [Fri, 26 Aug 2022 16:49:40 +0000 (18:49 +0200)]
Change review buttons to icons to make space for text (#20934)

The layout on the review code view was broken depending on length of the text. Change all three buttons to icons with tooltip to make more space for these long texts.

Fixes: #20922
2 years agoFix download archiver of a commit (#20962)
Lunny Xiao [Fri, 26 Aug 2022 13:07:06 +0000 (21:07 +0800)]
Fix download archiver of a commit (#20962)

2 years agoAdd whitespace removal inside template curly brackes (#20853)
silverwind [Thu, 25 Aug 2022 21:55:52 +0000 (23:55 +0200)]
Add whitespace removal inside template curly brackes (#20853)

2 years agoOnly show relevant repositories on explore page (#19361)
Gusted [Thu, 25 Aug 2022 18:38:41 +0000 (20:38 +0200)]
Only show relevant repositories on explore page (#19361)

Adds a new option to only show relevant repo's on the explore page, for bigger Gitea instances like Codeberg this is a nice option to enable to make the explore page more populated with unique and "high" quality repo's. A note is shown that the results are filtered and have the possibility to see the unfiltered results.

Co-authored-by: vednoc <vednoc@protonmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoReplace `ServeStream` with `ServeContent` (#20903)
KN4CK3R [Thu, 25 Aug 2022 16:05:21 +0000 (18:05 +0200)]
Replace `ServeStream` with `ServeContent` (#20903)

* Replace ServeStream with ServeContent.

* Update modules/timeutil/timestamp.go

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoUpdate JS dependencies (#20950)
silverwind [Thu, 25 Aug 2022 14:11:12 +0000 (16:11 +0200)]
Update JS dependencies (#20950)

- Update all JS dependencies minus vue
- Tested easymde, monaco, swagger

2 years agochore: remove broken gitea-format-imports (#20952)
Jason Song [Thu, 25 Aug 2022 08:53:48 +0000 (16:53 +0800)]
chore: remove broken gitea-format-imports (#20952)

2 years agoFix input.value attr for RequiredClaimName/Value (#20946)
soumyadey [Thu, 25 Aug 2022 06:17:03 +0000 (11:47 +0530)]
Fix input.value attr for RequiredClaimName/Value (#20946)

Values set for RequiredClaimName and RequiredClaimValue do not show up on UI.
Fix typo `values` to `value`.

2 years agoMove some files into models' sub packages (#20262)
Lunny Xiao [Thu, 25 Aug 2022 02:31:57 +0000 (10:31 +0800)]
Move some files into models' sub packages (#20262)

* Move some files into models' sub packages

* Move functions

* merge main branch

* Fix check

* fix check

* Fix some tests

* Fix lint

* Fix lint

* Revert lint changes

* Fix error comments

* Fix lint

Co-authored-by: 6543 <6543@obermui.de>
2 years ago[skip ci] Updated translations via Crowdin
xinyu [Thu, 25 Aug 2022 00:20:57 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agodocs[zh-cn]: Install on Kubernetes (#20874)
xinyu [Wed, 24 Aug 2022 13:26:41 +0000 (21:26 +0800)]
docs[zh-cn]: Install on Kubernetes (#20874)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoReturn 404 NotFound if requested attachment does not exist (#20886)
zeripath [Wed, 24 Aug 2022 12:36:21 +0000 (13:36 +0100)]
Return 404 NotFound if requested attachment does not exist (#20886)

Add code to test if GetAttachmentByID returns an ErrAttachmentNotExist error
and return NotFound instead of InternalServerError

Fix #20884

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAvoid frequent string2bytes conversions (#20940)
Jason Song [Wed, 24 Aug 2022 11:50:13 +0000 (19:50 +0800)]
Avoid frequent string2bytes conversions (#20940)

Fix #20939

2 years agoDisplay total blob size of a package version. (#20927)
KN4CK3R [Wed, 24 Aug 2022 05:48:33 +0000 (07:48 +0200)]
Display total blob size of a package version. (#20927)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoDisplay all files. (#20917)
KN4CK3R [Wed, 24 Aug 2022 01:39:25 +0000 (03:39 +0200)]
Display all files. (#20917)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoEnhance package date display (#20928)
KN4CK3R [Wed, 24 Aug 2022 01:39:00 +0000 (03:39 +0200)]
Enhance package date display (#20928)

* Use better date display.

* Update templates/package/view.tmpl

2 years ago[skip ci] Updated translations via Crowdin
silverwind [Wed, 24 Aug 2022 00:20:55 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoForbid HTML string tooltips (#20935)
silverwind [Tue, 23 Aug 2022 20:17:42 +0000 (22:17 +0200)]
Forbid HTML string tooltips (#20935)

Tippy allows HTML strings to be passed as content but we do not use this
feature (we do pass HTML only as Element), so it's better to disable it
for increased security.

Ref: https://atomiks.github.io/tippyjs/v6/html-content/#string

2 years agoSet no-tags in git fetch on compare (#20893)
zeripath [Tue, 23 Aug 2022 18:12:43 +0000 (19:12 +0100)]
Set no-tags in git fetch on compare (#20893)

* Set no-tags in git fetch on compare

In the compare endpoint the git fetch is restricted to a certain branch however,
this does not completely prevent tag acquisition/pollution as git fetch will collect
any tags on that branch.

This causes pollution of the tag namespace and could cause confusion by users.

This PR adds `--no-tags` to the `git fetch` call.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update modules/git/repo_compare.go

* Update modules/git/repo_compare.go

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUpdate comparison.en-us.md: link subgroups issue (#20905)
Kiara Grouwstra [Tue, 23 Aug 2022 14:13:41 +0000 (16:13 +0200)]
Update comparison.en-us.md: link subgroups issue (#20905)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoEnable contenthash in filename for dynamic assets (#20813)
silverwind [Tue, 23 Aug 2022 12:58:04 +0000 (14:58 +0200)]
Enable contenthash in filename for dynamic assets (#20813)

This should solve the main problem of dynamic assets getting stale after
a version upgrade. Everything not affected will use query-string based
cache busting, which includes files loaded via HTML or worker scripts.

2 years agorefactor webhook *EditPost (#20780)
oliverpool [Tue, 23 Aug 2022 06:52:35 +0000 (08:52 +0200)]
refactor webhook *EditPost (#20780)

2 years agoChangelog 1.17.1 (#20833) (#20919)
John Olheiser [Tue, 23 Aug 2022 02:02:16 +0000 (21:02 -0500)]
Changelog 1.17.1 (#20833) (#20919)

* Changelog 1.17.1 (#20833)

* Changelog 1.17.1

 ## [1.17.1](https://github.com/go-gitea/gitea/releases/tag/1.17.1) - 2022-08-17

* SECURITY
  * Correctly escape within tribute.js (#20831) (#20832)
* FEATURES
  * Add support for NuGet API keys (#20721) (#20734)
* ENHANCEMENTS
  * Display project in issue list (#20583)
  * Add disable download source configuration (#20548) (#20579)
* BUGFIXES
  * Use the total issue count for UI (#20785) (#20827)
  * Add proxy host into allow list (#20798) (#20819)
  * Add missing translation for queue flush workers (#20791) (#20792)
  * Improve comment header for mobile (#20781) (#20789)
  * Fix git.Init for doctor sub-command (#20782) (#20783)
  * Check webhooks slice length before calling xorm (#20642) (#20768)
  * Remove manual rollback for failed generated repositories (#20639) (#20762)
  * Use correct field name in npm template (#20675) (#20760)
  * Keep download count on Container tag overwrite (#20728) (#20735)
  * Fix v220 migration to be compatible for MSSQL 2008 r2 (#20702) (#20707)
  * Use request timeout for git service rpc (#20689) (#20693)
  * Send correct NuGet status codes (#20647) (#20677)
  * Use correct context to get package content (#20673) (#20676)
  * Fix the JS error "EventSource is not defined" caused by some non-standard browsers (#20584) (#20663)
  * Add default commit messages to PR for squash merge (#20618) (#20645)
  * Fix package upload for files >32mb (#20622) (#20635)
  * Fix the new-line copy-paste for rendered code (#20612)
  * Clean up and fix clone button script (#20415 & #20600) (#20599)
  *  Fix default merge style (#20564) (#20565)
  * Add repository condition for issue count (#20454) (#20496)
* MISC
  * Make branch icon stand out more (#20726) (#20774)
  * Fix loading button with invalid form (#20754) (#20759)
  * Add username check to doctor (#20140) (#20671)
  * Enable Wire 2 for Internal SSH Server (#20616) (#20617)
  *  Fix SecToTime edge-cases (#20610) (#20611)

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review

Co-authored-by: John Olheiser <john+github@jolheiser.com>
* Update CHANGELOG.md

Co-authored-by: delvh <dev.lh@web.de>
* Update CHANGELOG.md

* Update CHANGELOG.md

* update changelog

* Update CHANGELOG.md

Co-authored-by: John Olheiser <john+github@jolheiser.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: John Olheiser <john+github@jolheiser.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* update changelog

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix typo in backup documentation (pgdump->pg_dump) (#20913)
Enrico [Mon, 22 Aug 2022 18:39:59 +0000 (20:39 +0200)]
Fix typo in backup documentation (pgdump->pg_dump) (#20913)

This PR fixes a small typo in the backup documentation: `pgdump` command is wrong, the correct name for the backup software in PostgreSQL is `pg_dump`

2 years agoIncrease Content field size of gpg_key and public_key to MEDIUMTEXT (#20896)
zeripath [Mon, 22 Aug 2022 13:32:28 +0000 (14:32 +0100)]
Increase Content field size of gpg_key and public_key to MEDIUMTEXT (#20896)

Unfortunately some keys are too big to fix within the 65535 limit of TEXT on MySQL
this causes issues with these large keys.

Therefore increase these fields to MEDIUMTEXT.

Fix #20894

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoImprove single repo action for issue and pull requests (#20730)
CodeDoctor [Mon, 22 Aug 2022 12:51:48 +0000 (14:51 +0200)]
Improve single repo action for issue and pull requests (#20730)

Related to #20650.

This will fix the behavior of the single repo action for pull requests and disables the button for other screens that don't have a single repo action currently.

2 years agoRemove deprecated licenses (#20222)
Gusted [Mon, 22 Aug 2022 04:33:01 +0000 (06:33 +0200)]
Remove deprecated licenses (#20222)

2 years agoupdate current stable version
techknowlogick [Mon, 22 Aug 2022 02:14:13 +0000 (22:14 -0400)]
update current stable version

2 years ago[skip ci] Updated translations via Crowdin
Gary Wang [Mon, 22 Aug 2022 00:20:55 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix mirror address setting not working (#20850)
Gary Wang [Sun, 21 Aug 2022 18:23:50 +0000 (02:23 +0800)]
Fix mirror address setting not working (#20850)

This patch fixes the issue that the mirror address field is ignored from the repo setting form.

2 years agoSupport Proxy protocol (#12527)
zeripath [Sun, 21 Aug 2022 18:20:43 +0000 (19:20 +0100)]
Support Proxy protocol (#12527)

This PR adds functionality to allow Gitea to sit behind an
HAProxy and HAProxy protocolled connections directly.

Fix #7508

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix SQL Query for `SearchTeam` (#20844)
Gusted [Sun, 21 Aug 2022 16:24:05 +0000 (18:24 +0200)]
Fix SQL Query for `SearchTeam` (#20844)

- Currently the function takes in the `UserID` option, but isn't being
used within the SQL query. This patch fixes that by checking that only
teams are being returned that the user belongs to.

Fix #20829

Co-authored-by: delvh <dev.lh@web.de>
2 years agoDouble check CloneURL is acceptable (#20869)
zeripath [Sun, 21 Aug 2022 13:28:15 +0000 (14:28 +0100)]
Double check CloneURL is acceptable (#20869)

Some Migration Downloaders provide re-writing of CloneURLs that may point to
unallowed urls. Recheck after the CloneURL is rewritten.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix graceful doc (#20883)
wxiaoguang [Sun, 21 Aug 2022 06:50:27 +0000 (14:50 +0800)]
Fix graceful doc (#20883)

2 years agoPad GPG Key ID with preceding zeroes (#20878)
zeripath [Sun, 21 Aug 2022 06:50:15 +0000 (07:50 +0100)]
Pad GPG Key ID with preceding zeroes (#20878)

2 years ago[skip ci] Updated translations via Crowdin
JonRB [Sun, 21 Aug 2022 00:20:58 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agocall builtinUnused() if internal SSH is disabled (#20877)
JonRB [Sat, 20 Aug 2022 21:09:41 +0000 (22:09 +0100)]
call builtinUnused() if internal SSH is disabled (#20877)

The graceful manager waits for 4 listeners to be created or to be told that they are not needed. If it is not told about them it will indefinitely and timeout.

This leads to SVC hosts not being told of being in the readyState but on Unix would lead to the termination of the process.

There was an unfortunate regression in #20299 which missed this subtly and in the case whereby SSH is disabled the `builtinUnused()` is not called.

This PR adds a call to `builtinUnused()` when not using the builtin ssh to allow `createServerWaitGroup.Done()` to be called.

In addition it was noted that the if/else clauses for timeout informing of the SVC host were in the wrong order. These have been swapped.

Fix #20609

2 years agoDon't open new page for ext wiki on same repository (#20725)
Gusted [Sat, 20 Aug 2022 14:47:04 +0000 (16:47 +0200)]
Don't open new page for ext wiki on same repository (#20725)

- When the external wiki has been set to a file on the repository, don't
open the page on a tab.
- Resolves #20657

2 years ago[skip ci] Updated translations via Crowdin
wxiaoguang [Sat, 20 Aug 2022 00:20:56 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix the mode of custom dir to 0700 in docker-rootless (#20861)
wxiaoguang [Fri, 19 Aug 2022 15:05:07 +0000 (23:05 +0800)]
Fix the mode of custom dir to 0700 in docker-rootless (#20861)

2 years agoFix UI mis-align for PR commit history (#20845)
wxiaoguang [Fri, 19 Aug 2022 07:01:06 +0000 (15:01 +0800)]
Fix UI mis-align for PR commit history (#20845)

2 years agoFix create repository page's help text (#20810)
Gusted [Fri, 19 Aug 2022 02:13:08 +0000 (04:13 +0200)]
Fix create repository page's help text (#20810)

2 years agoIn PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (#20837)
zeripath [Fri, 19 Aug 2022 02:12:00 +0000 (03:12 +0100)]
In PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (#20837)

2 years agoDisable doctor logging on panic (#20847)
zeripath [Fri, 19 Aug 2022 01:27:27 +0000 (02:27 +0100)]
Disable doctor logging on panic (#20847)

* Disable doctor logging on panic

If permissions are incorrect for writing to the doctor log simply disable the log file
instead of panicing.

Related #20570

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update cmd/doctor.go

* Update cmd/doctor.go

Co-authored-by: delvh <dev.lh@web.de>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoRemove calls to load Mirrors in user.Dashboard (#20855)
zeripath [Fri, 19 Aug 2022 00:53:31 +0000 (01:53 +0100)]
Remove calls to load Mirrors in user.Dashboard (#20855)

Whilst looking at #20840 I noticed that the Mirrors data doesn't appear
to be being used therefore we can remove this and in fact none of the
related code is used elsewhere so it can also be removed.

Related #20840
Related #20804

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoswitch to node18 for snapcraft
techknowlogick [Thu, 18 Aug 2022 16:25:50 +0000 (12:25 -0400)]
switch to node18 for snapcraft

2 years agoPrevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate...
zeripath [Thu, 18 Aug 2022 10:31:15 +0000 (11:31 +0100)]
Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (#20839)

Some repositories do not have the PullRequest unit present in their configuration
and unfortunately the way that IsUserAllowedToUpdate currently works assumes
that this is an error instead of just returning false.

This PR simply swallows this error allowing the function to return false.

Fix #20621

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoFix owners cannot create organization repos bug (#20841)
Lunny Xiao [Thu, 18 Aug 2022 08:58:21 +0000 (16:58 +0800)]
Fix owners cannot create organization repos bug (#20841)

* Fix owners cannot create organization repos bug

* Fix api

* Update routers/api/v1/org/team.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agoFix migration file name (#20843)
Lunny Xiao [Thu, 18 Aug 2022 05:38:59 +0000 (13:38 +0800)]
Fix migration file name (#20843)

2 years agoCheck Mirror exists before linking its Repo (#20840)
zeripath [Thu, 18 Aug 2022 02:22:56 +0000 (03:22 +0100)]
Check Mirror exists before linking its Repo (#20840)

In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries
from the database. This assumes that every Repository which has IsMirror set has
a Mirror associated in the DB. This association is incorrect in the case of
Mirror repository under creation when there is no Mirror entry in the DB until
completion.

Unfortunately LoadAttributes makes this incorrect assumption and presumes that a
Mirror will always be loaded. This then causes a panic.

This PR simply double checks if there a Mirror before attempting to link back to
its Repo. Unfortunately it should be expected that there may be other cases where
this incorrect assumption causes further problems.

Fix #20804

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
techknowlogick [Thu, 18 Aug 2022 00:21:28 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd badge capabilities to users (#20607)
techknowlogick [Wed, 17 Aug 2022 23:25:25 +0000 (19:25 -0400)]
Add badge capabilities to users (#20607)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2 years agodocs[zh-cn]: Managing Deployments With Environment Variables (#20817)
xinyu [Wed, 17 Aug 2022 19:44:07 +0000 (03:44 +0800)]
docs[zh-cn]: Managing Deployments With Environment Variables (#20817)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoCorrectly escape within tribute.js (#20831)
zeripath [Wed, 17 Aug 2022 19:43:53 +0000 (20:43 +0100)]
Correctly escape within tribute.js (#20831)

When writing html in tribute.js ensure that strings are properly escaped.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix panic when an invalid oauth2 name is passed (#20820)
Balki [Wed, 17 Aug 2022 18:25:28 +0000 (18:25 +0000)]
Fix panic when an invalid oauth2 name is passed (#20820)

2 years agoUse the total issue count for UI (#20785)
parnic [Wed, 17 Aug 2022 13:13:41 +0000 (08:13 -0500)]
Use the total issue count for UI (#20785)

* Use the total issue count for UI

This fixes a problem where the "All" line item on the Issues or Pull Requests page was only showing the count of the selected repos instead of the total of all issues/prs in all repos.

The "total number of shown issues" number is now stashed in a different context variable in case it wants to be used by the frontend later. It's currently not being used.

Fixes #20574

* Remove unused context variable

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAdd proxy host into allow list (#20798)
Lunny Xiao [Wed, 17 Aug 2022 00:15:54 +0000 (08:15 +0800)]
Add proxy host into allow list (#20798)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoFix tooltip init after review (#20814)
silverwind [Tue, 16 Aug 2022 21:05:40 +0000 (23:05 +0200)]
Fix tooltip init after review (#20814)

* Fix tooltip init after review

Previous code passed a jQuery collection which initTooltip couldn't
handle. Instead, iterate the individial matched elements and add a
dollar to the variable name to make it clear it's jQuery.

Fixes: https://github.com/go-gitea/gitea/issues/20809
2 years agoauth/reverseproxy: Add support for full name (#20776)
Will Norris [Tue, 16 Aug 2022 06:30:27 +0000 (23:30 -0700)]
auth/reverseproxy: Add support for full name (#20776)

This adds support for getting the user's full name from the reverse
proxy in addition to username and email.

Tested locally with caddy serving as reverse proxy with Tailscale
authentication.

Signed-off-by: Will Norris <will@tailscale.com>
Signed-off-by: Will Norris <will@tailscale.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAdd migrate repo archiver and packages storage support on command line (#20757)
Lunny Xiao [Tue, 16 Aug 2022 04:05:15 +0000 (12:05 +0800)]
Add migrate repo archiver and packages storage support on command line (#20757)

* Add migrate repo archiver and packages storage support on command line

* Fix typo

* Use stdCtx

* Use packageblob and fix command description

* Add migrate packages unit tests

* Fix comment year

* Fix the migrate storage command line description

* Update cmd/migrate_storage.go

Co-authored-by: zeripath <art27@cantab.net>
* Update cmd/migrate_storage.go

Co-authored-by: zeripath <art27@cantab.net>
* Update cmd/migrate_storage.go

Co-authored-by: zeripath <art27@cantab.net>
* Fix test

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoRefactor AssertExistsAndLoadBean to use generics (#20797)
Lunny Xiao [Tue, 16 Aug 2022 02:22:25 +0000 (10:22 +0800)]
Refactor AssertExistsAndLoadBean to use generics (#20797)

* Refactor AssertExistsAndLoadBean to use generics

* Fix tests

Co-authored-by: zeripath <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
MaeIsBad [Tue, 16 Aug 2022 00:20:56 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix the commit diff route (#20796)
MaeIsBad [Mon, 15 Aug 2022 06:13:08 +0000 (08:13 +0200)]
Fix the commit diff route (#20796)

Gitea used to return 500 on the /:user/:repo/:commit route due to locale
being undefined in the escape_title template.

Co-authored-by: bad <badatnames@tutanota.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix push mirror address backend get error Address cause setting page display error...
xpy [Mon, 15 Aug 2022 03:12:01 +0000 (11:12 +0800)]
Fix push mirror address backend get error Address cause setting page display error (#20593)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoRemove follow from commits by file (#20765)
zeripath [Mon, 15 Aug 2022 01:22:13 +0000 (02:22 +0100)]
Remove follow from commits by file (#20765)

The use of `--follow` makes getting these commits very slow on large repositories
as it results in searching the whole commit tree for a blob.

Now as nice as the results of `--follow` are, I am uncertain whether it is really
of sufficient importance to keep around.

Fix #20764

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago[skip ci] Updated translations via Crowdin
Gusted [Mon, 15 Aug 2022 00:20:43 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix `make watch` for generated files (#20794)
Gusted [Sun, 14 Aug 2022 21:22:09 +0000 (21:22 +0000)]
Fix `make watch` for generated files (#20794)

- Don't rebuild the binary when generated files are updated, which is the
case by-default when running `make watch`.

2 years agoAdd missing translation for queue flush workers (#20791)
Gusted [Sun, 14 Aug 2022 19:28:19 +0000 (19:28 +0000)]
Add missing translation for queue flush workers (#20791)

- Add a missing translation key and value for the flush worker indication
- Resolves #20770

2 years agoUpdate zh-cn translation for Installation from source (#20772)
PEN² [Sun, 14 Aug 2022 16:03:12 +0000 (00:03 +0800)]
Update zh-cn translation for Installation from source (#20772)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoImprove comment header for Mobile (#20781)
Gusted [Sun, 14 Aug 2022 16:02:59 +0000 (16:02 +0000)]
Improve comment header for Mobile (#20781)

- Since
https://github.com/go-gitea/gitea/commit/b9e8fa5beb300eac7bd0623c9d7201a9e3a92a4a
the avatar will be inlined into the comment header, so there's more room
for the actual comment container(thus more text per line in the comment
body). However this didn't take into consideration that the flex didn't
allow any wrapping and thus was shrinking the avatar. Well this isn't a
perfect solution, as you ideally all want these elements to be
individually wrapped(such that `comment-header-right` can be on the same
line as `comment-header-left`, which now causes a new line in certain
situations). It's a better solution than the current CSS and to not
mess with the desktop CSS/HTML.

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoAdd myself to MAINTAINERS (#20786)
PEN² [Sun, 14 Aug 2022 10:08:53 +0000 (18:08 +0800)]
Add myself to MAINTAINERS (#20786)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated licenses and gitignores
Frank [Sun, 14 Aug 2022 00:20:44 +0000 (00:20 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoPreserve unix socket file (#20499)
Frank [Sat, 13 Aug 2022 21:31:33 +0000 (05:31 +0800)]
Preserve unix socket file (#20499)

By default Gitea will always unlink any sockets that are provided using the `LISTEN_FDS` environment variable. This is because it uses this variable to handle passing when it is doing a graceful restart. However, this same mechanism is used by systemd - which explicitly expects that passed in sockets should not be unlinked by the receiving process.

This PR adjusts Gitea's graceful restart mechanism to use an additional environment variable which tracks if a listening socket was opened by Gitea - and therefore should be unlinked on shutdown by Gitea.

Fix #20490

Co-authored-by: zeripath <art27@cantab.net>
2 years agoSwitch Unicode Escaping to a VSCode-like system (#19990)
zeripath [Sat, 13 Aug 2022 18:32:34 +0000 (19:32 +0100)]
Switch Unicode Escaping to a VSCode-like system (#19990)

This PR rewrites the invisible unicode detection algorithm to more
closely match that of the Monaco editor on the system. It provides a
technique for detecting ambiguous characters and relaxes the detection
of combining marks.

Control characters are in addition detected as invisible in this
implementation whereas they are not on monaco but this is related to
font issues.

Close #19913

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix git.Init for doctor sub-command (#20782)
wxiaoguang [Sat, 13 Aug 2022 16:33:18 +0000 (00:33 +0800)]
Fix git.Init for doctor sub-command (#20782)

2 years agoRemove the translation key website by PR #20777 (#20779)
PEN² [Sat, 13 Aug 2022 06:24:21 +0000 (14:24 +0800)]
Remove the translation key website by PR #20777 (#20779)

2 years agoMove the official website link at the footer of gitea (#20777)
PEN² [Sat, 13 Aug 2022 01:34:53 +0000 (09:34 +0800)]
Move the official website link at the footer of gitea (#20777)