aboutsummaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Add migrate repo archiver and packages storage support on command line (#20757)Lunny Xiao2022-08-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-1610-17/+17
| | | | | | | * Refactor AssertExistsAndLoadBean to use generics * Fix tests Co-authored-by: zeripath <art27@cantab.net>
* Fix push mirror address backend get error Address cause setting page display ↵xpy2022-08-141-2/+2
| | | | | | error (#20593) Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Remove follow from commits by file (#20765)zeripath2022-08-141-23/+23
| | | | | | | | | | | | | | 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>
* Preserve unix socket file (#20499)Frank2022-08-132-3/+50
| | | | | | | | | | 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>
* Switch Unicode Escaping to a VSCode-like system (#19990)zeripath2022-08-1314-273/+1956
| | | | | | | | | | | | | | | 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>
* Fix git.Init for doctor sub-command (#20782)wxiaoguang2022-08-141-1/+6
|
* Remove useless JS operation for relative time tooltips (#20756)silverwind2022-08-122-3/+3
| | | | | | | | | | | This operation that shifts the content from title to data-content is useless when we can directly render the expected HTML instead. This change does prevent these tooltips from working when the user has JS disabled in their browser, but I think we made it clear by now that JS is required for gitea to work properly. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* refactor webhook *NewPost (#20729)oliverpool2022-08-111-1/+10
| | | | | | | | | | | | | | | * 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/+34
| | | | | https://mcaptcha.org/ Co-authored-by: Felipe Leopoldo Sologuren Gutiérrez <fsologureng@users.noreply.github.com>
* Refactor legacy git init (#20376)wxiaoguang2022-08-095-79/+40
| | | | | | | | * 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>
* Fix disable download button (#20701)Lunny Xiao2022-08-081-1/+1
|
* Fix SecToTime edge-cases (#20610)Gusted2022-08-082-10/+33
|
* Add support for Pub packages (#20560)KN4CK3R2022-08-072-0/+290
| | | | | | | | | | | * 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-8/+17
| | | | | | | | | 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>
* Increase default item listing size `ISSUE_PAGING_NUM` to 20 (#20547)Norwin2022-08-061-2/+2
| | | | | | | | * increase default page sizes to 20 * adjust docs to reflect that the setting is used all over the place * fix tests Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Executable check always returns true for windows (#20637)JonRB2022-08-041-0/+5
| | | | | | | | | | | | | | | | | * Executable check always returns true for windows Windows doesn't have the concept of "executable" POSIX bits so for now always return true to minimise doctor and logging noise. Addresses #20636 * gofmt tweak * Update modules/repository/hooks.go Co-authored-by: silverwind <me@silverwind.io> * gofmt comment line Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Use `strings.Cut` for GIT_PROTOCOL value (#20638)Gusted2022-08-031-2/+1
| | | - As per https://github.com/go-gitea/gitea/pull/20616#discussion_r935612542
* Fix package upload for files >32mb (#20622)KN4CK3R2022-08-023-5/+98
| | | | | | * Rewind file before first read. * Added tests. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Enable Wire 2 for Internal SSH Server (#20616)Gusted2022-08-021-0/+10
| | | | | | | - Git only decides to use the Wire 2 protocol when `git {receive,upload}-pack` receive the `GIT_PROTOCOL` environment with as value `version=2`. Currently the internal SSH Server wasn't passing this environment through. The `gitea serv` code already passed all received environments to the git command, so no code changes there.
* Rework mailer settings (#18982)Clar Fon2022-08-021-42/+157
| | | | | | | | | | | * `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>
* Should also support upper-case README files (#20581)Gary Wang2022-08-012-0/+12
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Support localized README (#20508)Gary Wang2022-08-012-23/+65
| | | | | | | | | | | | | | | | * 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-312-4/+6
| | | | | Add configuration to enable/disable download source from UI. Co-authored-by: zeripath <art27@cantab.net>
* Add setting `SQLITE_JOURNAL_MODE` to enable WAL (#20535)Norwin2022-07-301-1/+9
| | | Co-authored-by: Andrew Thornton <art27@cantab.net>
* Rework file highlight rendering and fix yaml copy-paste (#19967)silverwind2022-07-302-130/+164
| | | | | | | | | | | * 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-303-1/+65
| | | | | | | | | | | - 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>
* Add latest commit's SHA to content response (#20398)Gusted2022-07-302-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | * 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-0/+10
| | | | | | | | | | | | | | - 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
* Stop logging EOFs and exit(1)s in ssh handler (#20476)zeripath2022-07-281-2/+7
| | | | | | | | | | | | | | | | | | | The code in modules/ssh/ssh.go:sessionHandler() currently cause an error to be logged if `gitea serv` exits with a exit(1). This logging is useless because the accompanying stderr is not provided and in any case the exit(1) is most likely due to permissions errors. Further it then causes the EOF to be logged - even though this is not helpful. This PR simply checks the errors returned and stops logging them. In the case of misconfigurations causing `gitea serv` to fail with exit(1) the current logging is not helpful at determining this and users should simply review the message passed over the ssh connection. Fix #20473 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Extended permission checks. (#20517)KN4CK3R2022-07-281-1/+18
|
* Added email notification option to receive all own messages (#20179)Tyrone Yeh2022-07-281-2/+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-281-0/+1
| | | | | | | | | | | | | * 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>
* Removed some vestigial code related to Range bounds checks (#20312)Philip Peterson2022-07-281-16/+0
|
* Slightly simplify LastCommitCache (#20444)zeripath2022-07-2513-150/+143
| | | | | | | | | | | 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>
* Fix Ruby package parsing by removed unused email field (#20470)KN4CK3R2022-07-251-1/+0
|
* Improve code diff highlight, fix incorrect rendered diff result (#19958)wxiaoguang2022-07-231-3/+5
| | | Use Unicode placeholders to replace HTML tags and HTML entities first, then do diff, then recover the HTML tags and HTML entities. Now the code diff with highlight has stable behavior, and won't emit broken tags.
* Add Cache-Control header to html and api responses, add no-transform (#20432)silverwind2022-07-233-5/+16
| | | | | | | | | | | | `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>
* Allow non-semver packages in the Conan package registry (#20412)Gergely Nagy2022-07-222-4/+6
| | | | | | | | | | | | | | A lot of existing packages do not conform to SemVer, yet, they should be allowed in the Conan package registry as-is. To achieve this, remove the SemVer check from `NewRecipeReference`, and replace it with a simple empty string check. A unit test with a non-semver version is also included. Fixes #20405. Signed-off-by: Gergely Nagy <me@gergo.csillger.hu> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Use body text color in repository files table links (#20386)Lucas Azevedo2022-07-221-1/+1
| | | | | | | | Use body text color in for links in the repository files table Issue/PR links (`.ref-issue`) will not be affected, as seen in other git services. Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Dismiss prior pull reviews if done via web in review dismiss (#20197)65432022-07-191-0/+1
|
* Remove confusing TrimPrefix(... git.BranchPrefix) (#20369)wxiaoguang2022-07-161-1/+9
| | | Make Repository.GetDefaultBranch return the real branch name, instead of the ref name. Then there is no need to do TrimPrefix for repo.DefaultBranch
* Allow access to the Public Organization Member lists with minimal ↵a10121127962022-07-151-0/+15
| | | | | | | | | | | permissions (#20330) Examining Organization membership should not necessarily require sign-in if the organization is public and the members are public. Therefore we should adjust `/org/{org}/members` to not require login. Fix #7501 Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: zeripath <art27@cantab.net>
* Fix commit status icon when in subdirectory (#20285)silverwind2022-07-151-0/+1
| | | | | | When viewing a subdirectory and the latest commit to that directory in the table, the commit status icon incorrectly showed the status of the HEAD commit instead of the latest for that directory.
* Include login_name in adminCreateUser response (#20283)Baekjun Kim2022-07-152-0/+4
| | | | `login_name` (Authentication Sign-in Name) is not included in the response of `adminUserCreate` API. This PR is to return user-specified `login_name` if there is one.
* Add allow_rebase_update, default_delete_branch_after_merge to repository api ↵Bian Jiaping2022-07-152-66/+74
| | | | | | | response (#20079) `PATCH /repos/{owner}/{repo}` API allows users to update `allow_rebase_update`, `default_delete_branch_after_merge`, but `GET /repos/{owner}/{repo}` API does not return these two options, and API users has no other ways to find the state of these two options. This PR add `allow_rebase_update`, `default_delete_branch_after_merge` to repository query api response.
* Allow to specify colors for text in markup (#20363)Gusted2022-07-152-0/+14
| | | | `<span style="color: red">Hello World!</span>` will now be accepted by Bluemonday, other properties are still disallowed by Bluemonday.
* Prevent context deadline error propagation in GetCommitsInfo (#20346)zeripath2022-07-141-3/+5
| | | | | | | | | | | | | | * Prevent context deadline error propagation in GetCommitsInfo Although `WalkGitLog` tries to test for `context.DeadlineExceededErr` there is a small chance that the error will propagate to the reader before it is recognised. This will cause the error to propagate up to `renderDirectoryFiles` and cause a http status 500. Here we check that the error passed is a `DeadlineExceededErr` via error.Is Fix #20329 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use default values when provided values are empty (#20318)Gusted2022-07-131-0/+13
| | | | | | | | | | | | * Use default values when provided values are empty - When provided values are empty like `:3000` would imply that host is empty, use the default value. - Resolves #20316 * Update database.go Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add tests for the host checking logic, clarify the behaviors (#20328)wxiaoguang2022-07-131-4/+4
| | | | | | Before, the combination of AllowedDomains/BlockedDomains/AllowLocalNetworks is confusing. This PR adds tests for the logic, clarify the behaviors.