summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Move modules/forms to services/forms (#15305)zeripath2021-04-0648-327/+327
| | | | | | | | | | | Forms are dependent on models and therefore should be in services. This PR also removes the old auth. aliasing Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* [refactor] replace int with httpStatusCodes (#15282)65432021-04-0560-402/+462
| | | | | | | | | | | * replace "200" (int) with "http.StatusOK" (const) * ctx.Error & ctx.HTML * ctx.JSON Part1 * ctx.JSON Part2 * ctx.JSON Part3
* Drop the event source if we are unauthorized (#15275)zeripath2021-04-041-2/+2
| | | | | | | | | A previous commit that sent unauthorized if the user is unauthorized simply leads to the repeated reopening of the eventsource. # This PR changes the event returned to tell the client to close the eventsource and thus prevents the repeated reopening. Signed-off-by: Andrew Thornton <art27@cantab.net>
* [refactor] mailer service (#15072)65432021-04-024-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Unexport SendUserMail * Instead of "[]*models.User" or "[]string" lists infent "[]*MailRecipient" for mailer * adopt * code format * TODOs for "i18n" * clean * no fallback for lang -> just use english * lint * exec testComposeIssueCommentMessage per lang and use only emails * rm MailRecipient * Dont reload from users from db if you alredy have in ram * nits * minimize diff Signed-off-by: 6543 <6543@obermui.de> * localize subjects * linter ... * Tr extend * start tmpl edit ... * Apply suggestions from code review * use translation.Locale * improve mailIssueCommentBatch Signed-off-by: Andrew Thornton <art27@cantab.net> * add i18n to datas Signed-off-by: Andrew Thornton <art27@cantab.net> * a comment Co-authored-by: Andrew Thornton <art27@cantab.net>
* response 404 for diff/patch of a commit that not exist (#15221)a10121127962021-04-011-0/+6
| | | | | | | | | | | | | | | | * response 404 for diff/patch of a commit that not exist fix #15217 Signed-off-by: a1012112796 <1012112796@qq.com> * Update routers/repo/commit.go Co-authored-by: silverwind <me@silverwind.io> * use ctx.NotFound() Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
* Add Tabular Diff for CSV files (#14661)KN4CK3R2021-03-293-8/+87
| | | | | | | | | | | | | | | | | | | | | | | Implements request #14320 The rendering of CSV files does match the diff style. * Moved CSV logic into base package. * Added method to create a tabular diff. * Added CSV compare context. * Added CSV diff template. * Use new table style in CSV markup. * Added file size limit for CSV rendering. * Display CSV parser errors in diff. * Lazy read single file. * Lazy read rows for full diff. * Added unit tests for various CSV changes.
* Improve /api/v1/repos/issues/search by just getting repo ids (#15179)zeripath2021-03-291-20/+4
| | | | | | | | | | | | | | /api/v1/repos/issues/search is a highly inefficient search which is unfortunately the basis for our dependency searching algorithm. In particular it currently loads all of the repositories and their owners and their primary coding language all of which is immediately thrown away. This PR makes one simple change - just get the IDs. Related #14560 Related #12827 Signed-off-by: Andrew Thornton <art27@cantab.net>
* should run RetrieveRepoMetas() for empty pr (#15187)a10121127962021-03-291-3/+7
| | | Signed-off-by: a1012112796 <1012112796@qq.com>
* use level config in main section when subsection not set level (#15176)a10121127962021-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in previouse if a log subsetcion not set level it will use ``info`` as default value. this pr will make default value (``[log] -> LEVEL``) useable. example config: ```INI [log] MODE = console LEVEL = Trace [log.console] LEVEL = STDERR = false ``` previous result: ```JSON // console: { "level": "info", ................... } ``` after change: ```JSON // console: { "level": "track", ................... } ``` Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* [refactor] Unify the export of user data via API (#15144)65432021-03-2713-25/+25
| | | | | * [refactor] unify how user data is exported via API * test time via unix timestamp
* Add DefaultMergeStyle option to repository (#14789)parnic2021-03-273-1/+9
| | | Fixes #12293
* Fix bug on avatar middleware (#15124)Lunny Xiao2021-03-231-2/+11
|
* Implement delete release attachments and update release attachments' name ↵Lunny Xiao2021-03-232-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | (#14130) * Implement delete release attachment * Add attachments on release edit page * Fix bug * Finish del release attachments * Fix frontend lint * Fix tests * Support edit release attachments * Added tests * Remove the unnecessary parameter isCreate from UpdateReleaseOrCreatReleaseFromTag * Rename UpdateReleaseOrCreatReleaseFromTag to UpdateRelease * Fix middle align
* Handle unauthorized user events gracefully (#15071)Lauris BH2021-03-202-1/+12
|
* Create new issue from code (#14863)Roger Luo2021-03-171-0/+1
| | | | | | | | | | | | | | * Feat: add reference in new issue with permalink menu for code view. * Fix: recover index.js file. * Add comments and redo ci. * Fix code convention * Fix code. Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* Validate email in oauth registration form (#15014)Kyle D2021-03-171-0/+5
|
* Fixed wrong migrate url error description. (#15010)KN4CK3R2021-03-172-8/+8
|
* Move repo.CloseIssuesViaCommitInAnyBranch to issue settings (#14965)Norwin2021-03-161-4/+12
|
* Add reverse proxy configuration support for remote IP address (#14959)Lauris BH2021-03-161-2/+19
| | | | | | | | | * Add reverse proxy configuration support for remote IP address validation * Trust all IP addresses in containerized environments by default * Use single option to specify networks and proxy IP addresses. By default trust all loopback IPs Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Ensure validation occurs on clone addresses too (#14994)zeripath2021-03-153-52/+60
| | | | | | | | | | | | | | | | | | | | | * Ensure validation occurs on clone addresses too Fix #14984 Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix api tests Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* API: fix set milestone on PR creation (#14981)Norwin2021-03-131-3/+1
| | | | | | | | | | | | | | * API: fix set milestone on PR creation pr creation via API failed with 404, because we searched for milestoneID 0, due to uninitialized var usage D: * add tests * fix expected status codes * fix tests Co-authored-by: 6543 <6543@obermui.de>
* Prevent incorrect HTML escaping in swagger.json (#14957)zeripath2021-03-111-1/+1
| | | | | | | | | | | | | | | | | | * Prevent incorrect HTML escaping in swagger.json Fix #14706 Signed-off-by: Andrew Thornton <art27@cantab.net> * oops add it to the helper Signed-off-by: Andrew Thornton <art27@cantab.net> * try again Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Show correct issues for team dashboard (#14952)Norwin2021-03-121-3/+3
| | | | | | | | | | | | | | * fix no items under /org/$org/{issues,pulls}?type=mentioned it was filtering by org id, but org-mentions are not persisted like that to the DB, we need to filter by UID. This means, selecting different teams will only have an effect on the selected repos, otherwise results will be the same, which may be suboptimal. fixes #14941 * don't spam a warning for a perfectly fine request
* Prevent panic when editing forked repos by API (#14960)zeripath2021-03-111-0/+4
| | | | | | | | When editing forked repos using the API the BaseRepository needs to loaded in order to check its visibility otherwise there will be NPE panic. Fix #14956 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add ui.explore settings to control view of explore pages (2) (#14094)zeripath2021-03-113-4/+20
| | | | | | | | | | | | | | | | | | | | | | | This is an alternative PR to #13687. Add `[ui.explore]` settings to allow restricting the explore pages to logged in users only and to disable the users explore page. The two proposed settings are: - `REQUIRE_SIGNIN_VIEW`: Only allows access to the explore pages if the user is signed in. Also restricts - `/api/v1/user/search` - `/api/v1/users/{username}` - `/api/v1/users/{username}/repos` - but does not restrict `/api/v1/users/{username}/heatmap` - `DISABLE_USERS_PAGE`: Disables the /explore/users page Fix #2908 Close #13687 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Fix migration context data (#14910)KN4CK3R2021-03-071-15/+22
| | | | | * Unified context data. * Changed method name.
* Add SameSite setting for cookies (#14900)zeripath2021-03-075-24/+29
| | | | | | | | | Add SameSite setting for cookies and rationalise the cookie setting code. Switches SameSite to Lax by default. There is a possible future extension of differentiating which cookies could be set at Strict by default but that is for a future PR. Fix #5583 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix bug when combine label comments (#14894)Lunny Xiao2021-03-052-17/+97
| | | | | | | * Fix bug when combine label comments * Added some code comments * More comments
* Show private heatmap on profile to self & admins (#14881)Norwin2021-03-042-6/+2
| | | followup to #14080
* Make manual merge autodetection optional and add manual merge as merge ↵a10121127962021-03-036-10/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | method (#12543) * Make auto check manual merge as a chooseable mod and add manual merge way on ui as title, Before this pr, we use same way with GH to check manually merge. It good, but in some special cases, misjudgments can occur. and it's hard to fix this bug. So I add option to allow repo manager block "auto check manual merge" function, Then it will have same style like gitlab(allow empty pr). and to compensate for not being able to detect THE PR merge automatically, I added a manual approach. Signed-off-by: a1012112796 <1012112796@qq.com> * make swager * api support * ping ci * fix TestPullCreate_EmptyChangesWithCommits * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> * Apply review suggestions and add test * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> * fix build * test error message * make fmt * Fix indentation issues identified by @silverwind Co-authored-by: silverwind <me@silverwind.io> * Fix tests and make manually merged disabled error on API the same Signed-off-by: Andrew Thornton <art27@cantab.net> * a small nit * fix wrong commit id error * fix bug * simple test * fix test Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add CORS config on to /login/oauth/access_token endpoint (#14850)zeripath2021-03-041-1/+13
| | | | | | | | Fix #7204 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Handle urls with trailing slash (#14852)Norwin2021-03-021-0/+1
|
* Migrate to use jsoniter instead of encoding/json (#14841)zeripath2021-03-018-8/+24
| | | | | | | | | | * Migrate to use jsoniter * fix tests * update gitea.com/go-chi/binding Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Organization removal confirmation using name not password (#14738)Paweł Bogusławski2021-03-011-6/+3
| | | | | | | | | | | | | | | | | | | | | | | * Organization removal confirmation using name not password Gitea is asking for user password to confirm organization removal so this operation cannot be done in systems with SSO authentication (where no user passwords are used). This mod changes the way gitea confirms organization removal - user must enter organization name (not user password) to confirm operation (similar to repository removal confirmation). Author-Change-Id: IB#1107219 * Translation removed Translation removed from PR - will be restored using Crowdin after pull got merged. Fixes: 95ddcdd8bd8097a952894556d42641d5ec269288 Related: https://github.com/go-gitea/gitea/pull/14738 Author-Change-Id: IB#1107219
* Repository transfer has to be confirmed, if user can not create repo for new ↵65432021-03-014-9/+98
| | | | | | | owner (#14792) * make repo as "pending transfer" if on transfer start doer has no right to create repo in new destination * if new pending transfer ocured, create UI & Mail notifications
* Set HCaptchaSiteKey on Link Account pages (#14834)zeripath2021-02-281-0/+3
| | | | | | | | | | When using HCaptcha on link account pages the site key needs to be passed in. This PR ensures that HCaptchaSiteKey is set in the data. Fix #14766 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Create tag on ui (#13467)a10121127962021-02-283-3/+40
| | | | | | | | | | Support create single tag directly support create tag with message from create release ui Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Add EasyMDE support for release content editor (#14744)a10121127962021-02-221-0/+8
| | | | | * Add easyMDE(simpleMDE) support for release content editor Signed-off-by: a1012112796 <1012112796@qq.com>
* Fix go get (#14758)Lunny Xiao2021-02-221-1/+65
| | | | | | | * Fix go get * Fix default branch Co-authored-by: 6543 <6543@obermui.de>
* Heatmap days clickable (#13935)gordon--2021-02-202-0/+2
| | | | | | | | | | | | | | | | * Heatmap days clickable * Error handling * Unselect filter * better dayclick handler * made linter happy * clickable heatmap for profiles Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Export LFS & TimeTracking function status (#14753)65432021-02-201-3/+5
|
* Clarify the suffices and prefixes of setting.AppSubURL and setting.AppURL ↵zeripath2021-02-195-18/+15
| | | | | | | | (#12999) Also removes some unnecessary uses of fmt.Sprintf and adds documentation strings Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add UI to delete tracked times (#14100)Norwin2021-02-193-2/+43
| | | Co-authored-by: 6543 <6543@obermui.de>
* Move the stopwatches to the eventsource stream (#14588)zeripath2021-02-191-0/+32
| | | | | | | | | Move the stopwatches to the eventsource stream Use the /user/events eventsource to update the stopwatches instead of polling /api/v1/user/stopwatches if the eventsource is enabled. Signed-off-by: Andrew Thornton <art27@cantab.net>
* routers/routes/web: Fix typo in comment (#14729)Jacob Hrbek2021-02-181-1/+1
|
* [API] Add Restricted Field to User (#14630)65432021-02-181-0/+3
| | | | | | | | | | | | * Expose Restricted field for User * Add Option to Change Restricted on User via adminEditUser API * Add test who change restricted & test if it changed it ... * make generate-swagger Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* #14699 Make branch names in PR description clickable (#14716)Jimmy Praet2021-02-181-0/+2
|
* Add Password Algorithm option to install page (#14701)zeripath2021-02-161-0/+7
| | | | | | | Add Password Algorithm option to install page Fix #14674 Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Restore detection of branches are equal on compare page (#14586)zeripath2021-02-161-24/+2
| | | | | | | | Somehow the test for detecting if branches are equal broke this PR restores this functionality. Fix #14502 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Allow blocking some email domains from registering an account (#14667)Damien Goutte-Gattat2021-02-151-1/+1
| | | | | | | | | Gitea allows to whitelist email domains so that only email addresses from certain domains are allowed to register an account, but does not currently allows to do the opposite: blacklisting email domains so that addresses from certain domains are *forbidden* to register an account. The idea has been briefly mentioned in the discussion about issue #6350, but never implemented. This PR does that. The rationale is that, in my experience of running a Gitea instance, *a single email domain* is responsible for *most* of the spam accounts, and for *all* of the spam accounts that manage to get past the email confirmation step. So on top of the other spam mitigation measures already available (email confirmation, CAPTCHA, etc.), having the option to block a particularly annoying domain would be helpful. close #13628