summaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Fix incorrect key name so registerManualConfirm setting works as expected. ↵Dofri Jónsson2021-01-261-1/+1
| | | | (#14455)
* Redirect on changed user and org name (#11649)Andrew Bezold2021-01-243-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add redirect for user * Add redirect for orgs * Add user redirect test * Appease linter * Add comment to DeleteUserRedirect function * Fix locale changes * Fix GetUserByParams * Fix orgAssignment * Remove debug logging * Add redirect prompt * Dont Export DeleteUserRedirect & only use it within a session * Unexport newUserRedirect * cleanup * Fix & Dedub API code * Format Template * Add Migration & rm dublicat * Refactor: unexport newRepoRedirect() & rm dedub del exec * if this fails we'll need to re-rename the user directory Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* just overload to not get it by mistake again ... (#14440)65432021-01-231-0/+5
|
* Enhance Ghost comment mitigation Settings (#14392)65432021-01-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * refactor models.DeleteComment and delete related reactions too * use deleteComment for UserDeleteWithCommentsMaxDays in DeleteUser * nits * Use time.Duration as other time settings have * docs * Resolve Fixme & fix potential deadlock * Disabled by Default * Update Config Value Description * switch args * Update models/issue_comment.go Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Add support to migrate from gogs (#14342)65432021-01-2116-298/+861
| | | | | | | | | | | | | Add support to migrate gogs: * issues * comments * labels * milestones * wiki Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Display current stopwatch in navbar (#14122)Norwin2021-01-212-0/+4
| | | | | | | | | | | | | | | | | * add notification about running stopwatch to header * serialize seconds, duration in stopwatches api * ajax update stopwatch i should get my testenv working locally... * new variant: hover dialog * noscript compatibility * js: live-update stopwatch time * js live update robustness
* Add support for ed25519_sk and ecdsa_sk SSH keys (#13462)Artemis Tosini2021-01-201-1/+1
| | | | | | | | | | | | | | * Add support for ed25519_sk and ecdsa_sk SSH keys These start with sk-ssh-ed25519@openssh.com and sk-ecdsa-sha2-nistp256@openssh.com. They are supported in recent versions of go x/crypto/ssh and OpenSSH 8.2 or higher. * skip ssh-keygen Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Prevent panic on fuzzer provided string (#14405)zeripath2021-01-202-10/+53
| | | | | | | | | | | | | | | | | | | * Prevent panic on fuzzer provided string The fuzzer has found that providing a <body> tag with an attribute to PostProcess causes a panic. This PR removes any rendered html or body tags from the output. Signed-off-by: Andrew Thornton <art27@cantab.net> * Placate lint * placate lint again Signed-off-by: Andrew Thornton <art27@cantab.net> * minor cleanup Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix log http status is always zero (#14400)Lunny Xiao2021-01-191-0/+62
| | | | | | | * Fix log http status is always zero * Fix lint Co-authored-by: 6543 <6543@obermui.de>
* Add pager to the branches page (#14202)Chester Liu2021-01-192-0/+10
| | | | | | | | | | | * Add pager to the branches page * override pageSize if bigger than max * Make branches commit range configurable Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: silverwind <me@silverwind.io>
* Check if label template exist first (#14384)65432021-01-182-9/+22
| | | | | | | * add check * refactor * rollback repo on error after session closed
* Upgrade blevesearch dependency to v2.0.1 (#14346)Lauris BH2021-01-173-18/+18
| | | | | | | * Upgrade blevesearch dependency to v2.0.1 * Update rupture to v1.0.0 * Fix test
* Implement ghost comment mitigation (#14349)65432021-01-171-0/+2
| | | | | | | | | | | | | * Implement ghost comment mitigation Adds a config option USER_DELETE_WITH_COMMENTS_MAX_DAYS to the [service] section. See https://codeberg.org/Codeberg/Discussion/issues/24 for the underlying issue. * cleanup * use setting module correctly * add to docs Co-authored-by: Moritz Marquardt <git@momar.de>
* Sort issue search results by revelance (#14353)Lauris BH2021-01-163-3/+4
|
* Kd/fix allow svg doctype (#14344)Kyle D2021-01-152-2/+10
| | | | | | | | | * make svg regex case-insensitive & use strict word boundary * allow doctype svg * add doctype tests * allow <!DOCTYPE svg> and <svg/>
* Use IsProd instead of testing if it's equal. (#14336)Lunny Xiao2021-01-143-3/+7
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Fix typo (#14332)Lunny Xiao2021-01-141-1/+1
|
* Display SVG files as images instead of text (#14101)Jonathan Tran2021-01-123-5/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change to display SVG files as images * Remove unsafe styles from SVG CSP * Add integration test to test SVG headers * Add config setting to disable SVG rendering * Add test for img tag when loading SVG image * Remove the Raw view button for svg files since we don't fully support this * Fix copyright year * Rename and move config setting * Add setting to cheat sheet in docs * Fix so that comment matches cheat sheet * Add allowing styles in CSP based on pull request feedback * Re-enable raw button since we show SVG styles now * Change so that SVG files are editable * Add UI to toggle between source and rendered image for SVGs * Change to show blame button for SVG images * Fix to update ctx data * Add test for DetectContentType when file is longer than sniffLen Co-authored-by: Jonathan Tran <jon@allspice.io> Co-authored-by: Kyle D <kdumontnu@gmail.com>
* Add option to change username to the admin panel (#14229)65432021-01-101-0/+1
| | | | | Co-authored-by: Bwko <bouwko@gmail.com> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: zeripath <art27@cantab.net>
* Do not reload page after adding comments in Pull Request reviews (#13877)Jimmy Praet2021-01-081-0/+1
| | | | | | | | | | | | | | | | Fixed #8861 * use ajax on PR review page * handle review comments * extract duplicate code FetchCodeCommentsByLine was initially more or less copied from fetchCodeCommentsByReview. Now they both use a common findCodeComments function instead * use the Engine that was passed into the method Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Some code improvements (#14266)Lunny Xiao2021-01-061-3/+2
|
* Fix windows build error (#14263)Lunny Xiao2021-01-0610-43/+48
| | | | | | | | | | | * fix build * take flash error message back and fix more windows lint error * performance optimization * own step to check lint for windows Co-authored-by: 6543 <6543@obermui.de>
* Add option for administrator to reset user 2FA (#14243)65432021-01-051-0/+1
| | | | | | | * Frontend * Backend * only show 2FA-Reset option if posible
* Fix recovery middleware to render gitea style page. (#13857)Lunny Xiao2021-01-0519-126/+892
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Some changes to fix recovery * Move Recovery to middlewares * Remove trace code * Fix lint * add session middleware and remove dependent on macaron for sso * Fix panic 500 page rendering * Fix bugs * Fix fmt * Fix vendor * recover unnecessary change * Fix lint and addd some comments about the copied codes. * Use util.StatDir instead of com.StatDir Co-authored-by: 6543 <6543@obermui.de>
* Render links for commit hashes followed by comma (#14224)Nuno Silva2021-01-032-1/+7
| | | | | Regex test cases: https://regex101.com/r/mVbPxM/2/ fixes #14223
* Add MirrorInterval to the API (#14163)Paul Barton2021-01-026-21/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added MirrorInterval to the API * Remove MirrorInterval from CreateRepository * Removed Duplicate UpdateMirror Function * Updated Error Logging * Update Log Message for is not Mirror Co-authored-by: 6543 <6543@obermui.de> * Delete Debug Statement that snuck in Co-authored-by: zeripath <art27@cantab.net> * Add Check for If Interval is too small * Output to API Call * Add Error Object when time is Less than Min Interval * Frequency Error Message Co-authored-by: zeripath <art27@cantab.net> * Allow Zero Mirror Interval Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Send notifications for mentions in pulls, issues, (code-)comments (#14218)Jimmy Praet2021-01-028-43/+108
| | | | | Fixes #14187: mention handling extracted from email notification code Fixes #14013: add notification for mentions in pull request code comments Fixes #13450: Not receiving any emails with setting "Only Email on Mention"
* When visit /favicon.ico but the static file is not exist return 404 but not ↵Lunny Xiao2021-01-011-0/+1
| | | | | continue to handle the route (#14211) Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Consolidate Logos and update README header (#14136)silverwind2021-01-011-14/+4
| | | | | | | | | | | | | | | | | | | | * Consolidate Logos and update README header - Remove unused `logo-lg.png`, `logo-sm.png` and `logo-192.png`. - Consolidate `favicon.svg` and `logo.svg` to just `logo.svg`. - Remove Safari Mask icon, it seems to work fine with just `favicon.png` (no SVG support). - Remove Fluid Icon. It only served Firefox and SVG works just fine there. - Update customization instructions. - Update README.md to use SVG icon, increase logo size and center it and badges. * Update README_ZH.md Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> * Update README_ZH.md Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Minimal OpenID Connect implementation (#14139)Johnny Oskarsson2021-01-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | This is "minimal" in the sense that only the Authorization Code Flow from OpenID Connect Core is implemented. No discovery, no configuration endpoint, and no user scope management. OpenID Connect is an extension to the (already implemented) OAuth 2.0 protocol, and essentially an `id_token` JWT is added to the access token endpoint response when using the Authorization Code Flow. I also added support for the "nonce" field since it is required to be used in the id_token if the client decides to include it in its initial request. In order to enable this extension an OAuth 2.0 scope containing "openid" is needed. Other OAuth 2.0 requests should not be impacted by this change. This minimal implementation is enough to enable single sign-on (SSO) for other sites, e.g. by using something like `mod_auth_openidc` to only allow access to a CI server if a user has logged into Gitea. Fixes: #1310 Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Check for 'main' as potential default branch name (#14193)Chester Liu2020-12-301-0/+5
|
* Improve label and text wrapping (#14113)silverwind2020-12-291-1/+1
| | | | | | | | | | | | | | | | | | | | | * Improve label wrapping - Adjust issue list styles so labels can wrap on the same line as the text. This relies on `display: inline` with the HTML whitespace being used as the separator. - Add global word-break: break-word. This should generally avoid text overflows in various places. * add whitespace to history labels * use overflow-wrap * restore word-break rules * use correct pre * use better selector for middle align Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix bug of link query order on markdown render (#14156)Lunny Xiao2020-12-291-1/+1
| | | | | | | * Fix bug of link query order on markdown render * Fix bluemonday bug and fix one wrong test Co-authored-by: 6543 <6543@obermui.de>
* Custom icons for OAuth sources (#14161)Timo Ley2020-12-281-0/+1
| | | | | | | | | | | | | * Add Icon URL to Backend * Template for Icon URL * Localization & Edit Icon URL * Improve Custom Icon URL * Removed not working else Co-authored-by: 6543 <6543@obermui.de>
* Dump github/gitlab/gitea repository data to a local directory and restore to ↵Lunny Xiao2020-12-2722-216/+1161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gitea (#12244) * Dump github/gitlab repository data to a local directory * Fix lint * Adjust directory structure * Allow migration special units * Allow migration ignore release assets * Fix lint * Add restore repository * stage the changes * Merge * Fix lint * Update the interface * Add some restore methods * Finish restore * Add comments * Fix restore * Add a token flag * Fix bug * Fix test * Fix test * Fix bug * Fix bug * Fix lint * Fix restore * refactor downloader * fmt * Fix bug isEnd detection on getIssues * Refactor maxPerPage * Remove unused codes * Remove unused codes * Fix bug * Fix restore * Fix dump * Uploader should not depend downloader * use release attachment name but not id * Fix restore bug * Fix lint * Fix restore bug * Add a method of DownloadFunc for base.Release to make uploader not depend on downloader * fix Release yml marshal * Fix trace information * Fix bug when dump & restore * Save relative path on yml file * Fix bug * Use relative path * Update docs * Use git service string but not int * Recognize clone addr to service type
* Migration: drop to long repo topics (#14152)65432020-12-271-0/+9
|
* migrate from com.* to alternatives (#14103)65432020-12-256-26/+58
| | | | | | | | | | | | | | | * remove github.com/unknwon/com from models * dont use "com.ToStr()" * replace "com.ToStr" with "fmt.Sprint" where its easy to do * more refactor * fix test * just "proxy" Copy func for now * as per @lunny
* Fix creating OAuth2 auth source from CLI (#14116)Daniil Pankratov2020-12-241-0/+5
| | | | | | | | Fix creation OAuth2 auth source from CLI. Fix #8356 Co-authored-by: Daniil Pankratov <daniil.pankratov@t-systems.com>
* Improve vfsgen to not unzip bindata files but send to browser directly (#7109)Lunny Xiao2020-12-244-2/+102
| | | | | | | | | | | | | | | * Don't unzip files from bindata but send to browser directly * remove dependent for httpgzip * Add tests for parseAcceptEncoding * Update docs for ENABLE_GZIP * Fix bug * Fix bug Co-authored-by: zeripath <art27@cantab.net>
* API: Make BasicAuth Prefix case insensitive (#14106)65432020-12-231-1/+1
|
* Fix manifest encoding (#14114)silverwind2020-12-232-9/+104
| | | | | | The previous URL encoding would encode spaces to '+' for the app name which is incorrect. Use base64 encoding instead which does not have such issues.
* Fix git.parseTagData (#14105)65432020-12-223-4/+80
| | | | | | | | | | | | | | | * Fix git.parseTagData() close #14092 * Add Test * add message to test * limit readers * git tag -m trims and terminates with a newline Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Inline manifest.json (#14038)silverwind2020-12-222-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Inline manifest.json Improve performance by eliminating this separate request and just inline this small JSON in HTML directly as a data uri. Also update previously static app name scripts to use AppName. I've confirmed this as working via "Add to Homescreen" feature which offered to save the shortcut under the new app name. * prerender manifest data on startup * move to settings * restore setting.AppStartTime and use it on admin page * use double quotes because template.URL escapes everything * fix lint * move variable to global context variable * delete template file Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Standardize Co-Authored-By / Reviewed-By strings (#14097)Cirno the Strongest2020-12-211-2/+2
| | | | | | | * Standardize Co-Authored-By / Reviewed-By strings * Use lowercase variant Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add StatDir and replace com.StatDir (#14099)Lunny Xiao2020-12-225-13/+87
| | | | | | | | | * Add StatDir and replace com.StatDir * a nit * Remove wrong file Co-authored-by: 6543 <6543@obermui.de>
* more test case for STORAGE_TYPE overrides (and fixes) (#14096)胡玮文2020-12-222-8/+57
| | | Signed-off-by: 胡玮文 <huww98@outlook.com>
* Fix storage config implementation (#14091)胡玮文2020-12-212-21/+177
| | | | | | | | | The design is very flexible, but not implemented correctly. This commit fixes several issues: * Costom storage type stated in https://docs.gitea.io/en-us/config-cheat-sheet/#storage-storage not working * [storage.attachments], [storage.minio] section not respected Signed-off-by: 胡玮文 <huww98@outlook.com>
* Add Test for Fix #14040 (#14045)65432020-12-211-0/+69
| | | Add Test for Fix #14040
* Add mentionable teams to tributeValues and change team mention rules to gh's ↵a10121127962020-12-213-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | style (#13198) * Add mentionable teams to tributeValues Signed-off-by: a1012112796 <1012112796@qq.com> * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> * Change team mention rules to gh's style * use org's avator as team avator in ui Signed-off-by: a1012112796 <1012112796@qq.com> * Update modules/markup/html.go * Update models/issue.go Co-authored-by: Lauris BH <lauris@nix.lv> * Update models/issue.go * fix a small nit and update test code Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* Added option to disable migrations (#13114)Paweł Bogusławski2020-12-214-3/+10
| | | | | | | | | | | | | | | | | | | | | | * Added option to disable migrations This patch introduces DISABLE_MIGRATIONS parameter in [repository] section of app.ini (by default set to false). If set to true it blocks access to repository migration feature. This mod hides also local repo import option in user editor if local repo importing or migrations is disabled. * Alter Example config DISABLE_MIGRATIONS set to false in example config to match its default value. * HTTP error 403 instead of 500 on denied access to migration * Parameter DISABLE_MIGRATIONS exposed via API Fixes: 04b04cf854bcb3ed7659442bcf79822bdebe29e9 Author-Change-Id: IB#1105130