summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* refactor webhook *EditPost (#20780)oliverpool2022-08-232-481/+196
|
* Improve single repo action for issue and pull requests (#20730)CodeDoctor2022-08-221-0/+2
| | | | | 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.
* Fix mirror address setting not working (#20850)Gary Wang2022-08-211-2/+5
| | | This patch fixes the issue that the mirror address field is ignored from the repo setting form.
* Fix SQL Query for `SearchTeam` (#20844)Gusted2022-08-211-1/+1
| | | | | | | | | | - 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>
* Pad GPG Key ID with preceding zeroes (#20878)zeripath2022-08-211-0/+7
|
* Remove calls to load Mirrors in user.Dashboard (#20855)zeripath2022-08-181-33/+0
| | | | | | | | | | | | 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>
* Fix owners cannot create organization repos bug (#20841)Lunny Xiao2022-08-182-2/+5
| | | | | | | | | | | * 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>
* Add badge capabilities to users (#20607)techknowlogick2022-08-181-0/+7
| | | | | Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Use the total issue count for UI (#20785)parnic2022-08-171-2/+7
| | | | | | | | | | | | | | * 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>
* auth/reverseproxy: Add support for full name (#20776)Will Norris2022-08-161-0/+1
| | | | | | | | | | | | 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>
* Add migrate repo archiver and packages storage support on command line (#20757)Lunny Xiao2022-08-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Refactor AssertExistsAndLoadBean to use generics (#20797)Lunny Xiao2022-08-162-6/+6
| | | | | | | * Refactor AssertExistsAndLoadBean to use generics * Fix tests Co-authored-by: zeripath <art27@cantab.net>
* Remove follow from commits by file (#20765)zeripath2022-08-142-4/+4
| | | | | | | | | | | | | | 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>
* Switch Unicode Escaping to a VSCode-like system (#19990)zeripath2022-08-134-38/+64
| | | | | | | | | | | | | | | 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>
* refactor webhook *NewPost (#20729)oliverpool2022-08-114-488/+131
| | | | | | | | | | | | | | | * refactor webhook *NewPost * remove empty values * always show errs.Message * remove utils.IsValidSlackChannel * move IsValidSlackChannel to services/webhook package * binding: handle empty Message case * make IsValidSlackChannel more strict
* Add support mCaptcha as captcha provider (#20458)Gusted2022-08-103-0/+27
| | | | | https://mcaptcha.org/ Co-authored-by: Felipe Leopoldo Sologuren GutiƩrrez <fsologureng@users.noreply.github.com>
* Add support for NuGet API keys (#20721)KN4CK3R2022-08-092-0/+46
| | | | | | | | | | | | | * Add support for NuGet API key. * lint * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Keep download count on Container tag overwrite (#20728)KN4CK3R2022-08-091-0/+3
| | | Co-authored-by: 6543 <6543@obermui.de>
* Add an option to create new issues from "/issues" page (#20650)CodeDoctor2022-08-091-0/+6
|
* Add support for `npm unpublish` (#20688)KN4CK3R2022-08-092-2/+73
|
* Allow multiple files in generic packages (#20661)KN4CK3R2022-08-092-40/+68
| | | | | | | | | * Allow multiple files in generic packages. * Add deletion of a single file. * Update docs. * Change version check. Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor legacy git init (#20376)wxiaoguang2022-08-091-3/+1
| | | | | | | | * merge `CheckLFSVersion` into `InitFull` (renamed from `InitWithSyncOnce`) * remove the `Once` during git init, no data-race now * for doctor sub-commands, `InitFull` should only be called in initialization stage Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add issue filter for Author (#20578)parnic2022-08-081-1/+9
| | | This adds a new filter option on the issues and pulls pages to filter by the author/poster/creator of the issue or PR
* Fix init mail render logic (#20704)KN4CK3R2022-08-081-4/+0
| | | This bug affects tests which are sending emails (#20307). Some tests reinitialise the web routes (like `TestNodeinfo`) which messed up the mail templates. There is no reason why the templates should be loaded in the routes method.
* Add support for Pub packages (#20560)KN4CK3R2022-08-074-2/+292
| | | | | | | | | | | * Added support for Pub packages. * Update docs/content/doc/packages/overview.en-us.md Co-authored-by: Gergely Nagy <algernon@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Gergely Nagy <algernon@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Use request timeout for git service rpc (#20689)parnic2022-08-061-5/+6
| | | | | | | | | This enables git.Command's Run to optionally use the given context directly so its deadline will be respected. Otherwise, it falls back to the previous behavior of using the supplied timeout or a default timeout value of 360 seconds. repo's serviceRPC() calls now use the context's deadline (which is unset/unlimited) instead of the default 6-minute timeout. This means that large repo clones will no longer arbitrarily time out on the upload-pack step, and pushes can take longer than 6 minutes on the receive-pack step. Fixes #20680 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Allow multiple metadata files for Maven packages (#20674)KN4CK3R2022-08-051-2/+3
| | | | | | | | | | * Allow file overwrite for meta files. * Added tests. * lint Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Send correct NuGet status codes (#20647)KN4CK3R2022-08-031-3/+5
| | | | | * Fixed status codes. * Fixed status codes.
* Add default commit messages to PR for squash merge (#20618)Tyrone Yeh2022-08-031-0/+2
| | | | | | Keep the same behavior as 1.16 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Use correct page size for link header pagination (#20546)Norwin2022-08-021-1/+1
| | | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Rework mailer settings (#18982)Clar Fon2022-08-022-4/+6
| | | | | | | | | | | * `PROTOCOL`: can be smtp, smtps, smtp+startls, smtp+unix, sendmail, dummy * `SMTP_ADDR`: domain for SMTP, or path to unix socket * `SMTP_PORT`: port for SMTP; defaults to 25 for `smtp`, 465 for `smtps`, and 587 for `smtp+startls` * `ENABLE_HELO`, `HELO_HOSTNAME`: reverse `DISABLE_HELO` to `ENABLE_HELO`; default to false + system hostname * `FORCE_TRUST_SERVER_CERT`: replace the unclear `SKIP_VERIFY` * `CLIENT_CERT_FILE`, `CLIENT_KEY_FILE`, `USE_CLIENT_CERT`: clarify client certificates here Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Support localized README (#20508)Gary Wang2022-08-012-69/+117
| | | | | | | | | | | | | | | | * Support localized README * Slightly simplify getting the readme file and add some tests. Ensure that i18n also works for docs/ etc. Signed-off-by: Andrew Thornton <art27@cantab.net> * Update modules/markup/renderer.go * Update modules/markup/renderer.go * Update modules/markup/renderer.go Co-authored-by: Andrew Thornton <art27@cantab.net>
* Add disable download source configuration (#20548)Lunny Xiao2022-07-311-1/+8
| | | | | Add configuration to enable/disable download source from UI. Co-authored-by: zeripath <art27@cantab.net>
* Add missing Tabs on organisation/package view (Frontport #20539) (#20540)65432022-07-311-0/+16
| | | hotfix #20106
* Rework file highlight rendering and fix yaml copy-paste (#19967)silverwind2022-07-301-13/+13
| | | | | | | | | | | * Rework file highlight rendering and fix yaml copy-paste * use Split+Trim to replace tag parser * remove unnecessary bytes.Count * remove newLineInHTML = "&#10;" Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add new API endpoints for push mirrors management (#19841)Mohamed Sekour2022-07-305-9/+361
| | | | | | | | | | | - Add a new push mirror to specific repository - Sync now ( send all the changes to the configured push mirrors ) - Get list of all push mirrors of a repository - Get a push mirror by ID - Delete push mirror by ID Signed-off-by: Mohamed Sekour <mohamed.sekour@exfo.com> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* WebAuthn CredentialID field needs to be increased in size (#20530)zeripath2022-07-301-2/+1
| | | | | | | | | | | | | WebAuthn have updated their specification to set the maximum size of the CredentialID to 1023 bytes. This is somewhat larger than our current size and therefore we need to migrate. The PR changes the struct to add CredentialIDBytes and migrates the CredentialID string to the bytes field before another migration drops the old CredentialID field. Another migration renames this field back. Fix #20457 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add latest commit's SHA to content response (#20398)Gusted2022-07-301-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | * Add latest commit's SHA to content response - When requesting the contents of a filepath, add the latest commit's SHA to the requested file. - Resolves #12840 * Add swagger * Fix NPE * Fix tests * Hook into LastCommitCache * Move AddLastCommitCache to a common nogogit and gogit file Signed-off-by: Andrew Thornton <art27@cantab.net> * Prevent NPE Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Rework raw file http header logic (#20484)silverwind2022-07-291-38/+56
| | | | | | | | | | | | | | - Always respect the user's configured mime type map - Allow more types like image/pdf/video/audio to serve with correct content-type - Shorten cache duration of raw files to 5 minutes, matching GitHub - Don't set `content-disposition: attachment`, let the browser decide whether it wants to download or display a file directly - Implement rfc5987 for filenames, remove previous hack. Confirmed it working in Safari. - Make PDF attachment work in Safari by removing `sandbox` attribute. This change will make a lot more file types open directly in browser now. Logic should generally be more readable than before with less `if` nesting and such. Replaces: https://github.com/go-gitea/gitea/pull/20460 Replaces: https://github.com/go-gitea/gitea/pull/20455 Fixes: https://github.com/go-gitea/gitea/issues/20404
* packages/generic: Do not restrict package versions to SemVer (#20414)Gergely Nagy2022-07-291-8/+6
| | | | | | | There are existing packages out there whose version do not conform to SemVer, yet, one would like to have them available in a generic package repository. To this end, remove the SemVer restriction on package versions when using the Generic package registry, and replace it with a check that simply makes sure the version isn't empty. Signed-off-by: Gergely Nagy <me@gergo.csillger.hu> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: 6543 <6543@obermui.de>
* Added email notification option to receive all own messages (#20179)Tyrone Yeh2022-07-281-1/+2
| | | | | | Sometimes users want to receive email notifications of messages they create or reply to, Added an option to personal preferences to allow users to choose Closes #20149
* Add Docker /v2/_catalog endpoint (#20469)KN4CK3R2022-07-289-6/+73
| | | | | | | | | | | | | * Added properties for packages. * Fixed authenticate header format. * Added _catalog endpoint. * Check owner visibility. * Extracted condition. * Added test for _catalog. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix possible panic when repository is empty (#20509)Lunny Xiao2022-07-281-4/+8
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Show hint to link package to repo when viewing empty repo package list (#20504)Norwin2022-07-271-0/+4
| | | | | | | * show hint to link package to repo on empty repo package listing * reword
* Hide internal package versions (#20492)KN4CK3R2022-07-279-28/+51
| | | | | * Hide internal versions from most searches. * Added test.
* fix enabling repo packages when projects are off (#20486)Norwin2022-07-261-1/+1
|
* Slightly simplify LastCommitCache (#20444)zeripath2022-07-255-23/+27
| | | | | | | | | | | The LastCommitCache code is a little complex and there is unnecessary duplication between the gogit and nogogit variants. This PR adds the LastCommitCache as a field to the git.Repository and pre-creates it in the ReferencesGit helpers etc. There has been some simplification and unification of the variant code. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add repository condition for issue count (#20454)Tyrone Yeh2022-07-241-0/+1
| | | | | | | | | | * Add repository condition for issue count * Update routers/web/user/home.go Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Prepend commit message to template content (#20429)Gusted2022-07-241-0/+13
| | | | | | | | | - When a repository has a pull request template, it will always override the current content. With this PR it will prepend content to the template content when appropriate. This is similar how GitHub(and GitLab I presume) does it and it saves developers time to not go open their commit and copy paste their will written commit message.
* Add Cache-Control header to html and api responses, add no-transform (#20432)silverwind2022-07-232-0/+3
| | | | | | | | | | | | `no-transform` allegedly disables CloudFlare auto-minify and we did not set caching headers on html or api requests, which seems good to have regardless. Transformation is still allowed for asset requests. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Andrew Thornton <art27@cantab.net>