summaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Backport emoji fixes to 1.12 (#12327)silverwind2020-07-252-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix emoji detection in certain cases (#12320) * Fix emoji detection certain cases Previous tests weren't complicated enough so there were some situations where emojis were't detected properly. Find the earliest occurance in addition to checking for the longest combination. Fixes #12312 * ok spell bot Co-authored-by: Lauris BH <lauris@nix.lv> * Reduce emoji size (#12317) * Reduce emoji size Rendering should now pretty much match GitHub with 1.25em. I verified that emojis don't increase the line height and removed unecessary size overrides because now all emojis should appear similar in relation to the font size. * fix reaction hover Co-authored-by: mrsdizzie <info@mrsdizzie.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix double-indirection bug in logging IDs (#12294) (#12308)techknowlogick2020-07-241-1/+1
| | | | | | | | This PR fixes a bug in log.NewColoredIDValue() which led to a double indirection and incorrect IDs being printed out. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* properly set symbolic-ref HEAD when a repo is created with a non-master ↵techknowlogick2020-07-081-0/+7
| | | | | | | default branch (#12135) (#12182) This fixes an issue I noticed with #10803: when you create a repo with a non-master default branch, gitea doesn't change the remote ref HEAD, so it still points at refs/heads/master. As a result, cloning my repos gives me error messages and doesn't check out the desired default branch, so I need to manually check it out after cloning. Co-authored-by: xenofem <45297511+xenofem@users.noreply.github.com>
* Use hash of repo path, ref and entrypath as cache key (#12151) (#12161)Lauris BH2020-07-061-2/+8
|
* Multiple small admin dashboard fixes (#12153) (#12156)zeripath2020-07-052-1/+3
| | | | | | | | * Prevent (EXTRA string) comments in Task headers * Redirect tasks started from monitor page back to monitor * Fix #12107 - redirects from process cancel should use AppSubUrl * When wrapping queues set the name correctly Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move EventSource to SharedWorker (#12095) (#12130)zeripath2020-07-052-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move EventSource to SharedWorker (#12095) Backport #12095 Move EventSource to use a SharedWorker. This prevents issues with HTTP/1.1 open browser connections from preventing gitea from opening multiple tabs. Also allow setting EVENT_SOURCE_UPDATE_TIME to disable EventSource updating Fix #11978 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io> * Bugfix for shared event source For some reason our eslint configuration is not working correctly and a bug has become apparent when trying to backport this to 1.12. Signed-off-by: Andrew Thornton <art27@cantab.net> * Re-fix #12095 again Unfortunately some of the suggested changes to #12095 introduced bugs which due to caching behaviour of sharedworkers were not caught on simple tests. These are as follows: * Changing from simple for loop to use includes here: ```js register(port) { if (!this.clients.includes(port)) return; this.clients.push(port); port.postMessage({ type: 'status', message: `registered to ${this.url}`, }); } ``` The additional `!` prevents any clients from being added and should read: ```js if (this.clients.includes(port)) return; ``` * Dropping the use of jQuery `$(...)` selection and using DOM `querySelector` here: ```js async function receiveUpdateCount(event) { try { const data = JSON.parse(event.data); const notificationCount = document.querySelector('.notification_count'); if (data.Count > 0) { notificationCount.classList.remove('hidden'); } else { notificationCount.classList.add('hidden'); } notificationCount.text() = `${data.Count}`; await updateNotificationTable(); } catch (error) { console.error(error, event); } } ``` Requires that `notificationCount.text()` be changed to use `textContent` instead. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix ui bug in wiki commit page (#12089) (#12125)赵智超2020-07-031-2/+9
| | | | | | | | | | | | | | | * Fix ui bug in wiki commit page TODO: Maybe we should allow wiki to have its own ``.editorconfig`` file. Signed-off-by: a1012112796 <1012112796@qq.com> * fix a small nit Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Set the base url when migrating from Gitlab using access token or username ↵zeripath2020-07-021-1/+1
| | | | | | | | | | | | without password (#11852) (#12104) Backport #11852 When migrating from gitlab, set the baseUrl in NewGitlabDownloader when using an access token or username without password Fix #11851 Co-authored-by: Gernot Eger <gernot.eger@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Ensure BlameReaders close at end of request (#12102) (#12103)zeripath2020-07-012-7/+12
| | | | | | | | | | | | | | | | | | | | | Backport #12102 this was thought to be due to timeouts, however on closer look this appears to be due to the Close() function of the BlameReader hanging with a blocked stdout pipe. This PR fixes this Close function to: * Cancel the context of the cmd * Close the StdoutReader - ensuring that the output pipe is closed Further it makes the context of the `git blame` command a child of the request context - ensuring that even if Close() is not called, on cancellation of the Request the blame is command will also be cancelled. Fixes #11716 Closes #11727 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix comments webhook panic backport (#12058)Cornel2020-06-258-9/+39
| | | | | * Handle HookIssueReviewed action in webhook * Fix webhook comment handling type cast panic
* Add serviceworker.js to KnownPublicEntries (#11992) (#11994)silverwind2020-06-201-3/+4
| | | | | Fixes a wrong 302 redirect to the login page, see https://github.com/go-gitea/gitea/issues/11989. Also made it so the reserved username list is extended with those known entries so we avoid code duplication.
* For language detection do not try to analyze big files by content (#11971) ↵Lauris BH2020-06-191-3/+7
| | | | (#11975)
* Use google/uuid to instead satori/go.uuid (#11943) (#11946)Lunny Xiao2020-06-184-9/+9
| | | | | | Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net>
* Global default branch setting (#11918) (#11937)techknowlogick2020-06-172-1/+4
| | | | | | | | | | | | | | | * Global default branch setting (#11918) * Global default branch setting * add to app.ini example per @silverwind * update per @lunny Co-authored-by: John Olheiser <john.olheiser@gmail.com> * Update modules/setting/repository.go Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Handle more pathological branch and tag names (#11843) (#11863)zeripath2020-06-122-67/+7
| | | | | | | | | | | | | | | | Backport #11843 It's possible to push quite pathological appearing branch names to gitea using git push gitea reasonable-branch:refs/heads/-- at which point large parts of the UI will break. Similarly you can git push origin reasonable-tag:refs/tags/-- which wil return an error. This PR fixes the problems these cause. It also changes the code from creating branches to pushing to ensure that branch restoration has to pass hooks. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Prevent panic on empty HOST for mysql (#11850) (#11856)zeripath2020-06-111-1/+1
| | | | | Backport #11850 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Honor DEFAULT_PAGING_NUM for API (#11805) (#11813)Cirno the Strongest2020-06-091-1/+1
| | | | | | | | | | | * Honor DEFAULT_PAGING_NUM for API * set pagination to 10 for tests * lint Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io> (cherry picked from commit cefbf73aea912c510a8dd194532233076b822d37)
* Add option to API to update PullRequest base branch (#11666) (#11796)65432020-06-071-0/+1
| | | | | | | * EditPull: add option to change base Close #11552 Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix timezone on issue deadline (#11697) (#11784)Cirno the Strongest2020-06-061-0/+5
| | | | | | | | * Fix timezone on issue deadline * FormatDate Co-authored-by: zeripath <art27@cantab.net> (cherry picked from commit bbe13b60cdf93d8296f4c6dab624df2b571db234)
* European Portuguese translation (#11568) (#11778)Emanuel Angelo2020-06-061-4/+4
| | | | | This PR includes the modifications necessary to make use of the European Portuguese translation from the default setting. Co-authored-by: zeripath <art27@cantab.net>
* Update emoji dataset with skin tone variants (#11678) (#11763)mrsdizzie2020-06-042-1727/+3103
| | | | | | | | | | | * Update emoji dataset with skin tone variants Since the format of emoji that support skin tone modifiers is predictable we can add different variants into our dataset when generating it so that we can match and properly style most skin tone variants of emoji. No real code change here other than what generates the dataset and the data itself. * use escape unicode sequence in map Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* [API] on 500 error only show message if gitea in dev mode (#11641) (#11753)65432020-06-031-0/+4
| | | | | | | * add API specific InternalServerError() * return 500 error msg only if not Production mode * rm unnessesary change
* Change language statistics to save size instead of percentage (#11681) (#11690)Lauris BH2020-06-022-21/+32
| | | | | | | | | | | | | | | | | | | | | | | * Change language statistics to save size instead of percentage (#11681) * Change language statistics to save size instead of percentage in database Co-Authored-By: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> * Do not exclude if only language * Fix edge cases with special langauges Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> * Fix language stat calculation (#11692) * Fix language stat calculation * Group languages and ignore 0 size files * remove unneeded code Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com>
* Update emoji regex (#11584) (#11679)mrsdizzie2020-05-293-7/+31
| | | | | | When matching emoji, use a regex built from the data we have instead of something generic using unicode ranges. A generic regex can't tell the difference between two separate emoji next to each other or one emoji that is built out of two separate emoji next to each other. This means that emoji that are next to each other without space in between will be now accurately spanned individually with proper title etc...
* Default MSSQL port 0 to allow automatic detection by default (#11642) (#11673)zeripath2020-05-291-1/+1
| | | | | | | Backport #11642 Fix #11633 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Exclude generated files from language statistics (#11653) (#11670)Lauris BH2020-05-292-14/+10
| | | * Update go-enry to v2.5.2
* Use -1 to disable key algorithm type in ssh.minimum_key_sizes (#11635) (#11662)zeripath2020-05-281-0/+2
| | | | | | | | | Backport #11635 Fix #11634 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Return json on 500 error from API (#11574) (#11659)65432020-05-281-4/+21
| | | | | | | Backport #11574 add API specific InternalServerError() InternalServerError
* When must change password only show Signout (#11600) (#11637)guillep2k2020-05-271-1/+3
| | | | | | | | | | | | | | When "Must Change Password" simplify the navbar header to only show the signout button as all other links will redirect back. This prevents the notifications icon from showing preventing initialization of the event-source and hence preventing redirect_to being set, however in addition do not set the redirect_to cookie if we are looking at the /user/events page. Fix #11554 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* When initialising repositories ensure that the user doing the creation is ↵zeripath2020-05-251-1/+1
| | | | | | | | | the initializer (#11601) (#11608) Backport #11601 Fix #10760 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent (caught) panic on login (#11590) (#11597)zeripath2020-05-241-6/+14
| | | | | | | | | | | | | | | | | Backport #11590 Unfortunately when the virtual session is released it requires that the real session does not exist. This worked fine when sessions were only saved at the end of request/response cycle however, now sessions are saved proactively this does not hold. The result is a caught panic in the logs during every log-in. This panic has no significant side-effects but should not occur. This PR marks the virtual session as released when released and updates it if the same session is released again. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Allow different HardBreaks settings for documents and comments (#11515) (#11599)zeripath2020-05-243-13/+29
| | | | | | | | | | | | | | | GH has different HardBreaks behaviour for markdown comments and documents. Comments have hard breaks and documents have soft breaks - therefore Gitea's rendering will always be different from GH's if we only provide one setting. Here we split the setting in to two - one for documents and one for comments and other things. Signed-off-by: Andrew Thornton art27@cantab.net Changes to index.js as per @silverwind Co-authored-by: silverwind <me@silverwind.io> Changes to docs as per @guillep2k Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Move serviceworker to workbox and fix SSE interference (#11538) (#11547)silverwind2020-05-222-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move serviceworker to workbox and fix SSE interference Instead of statically hardcoding every frontend asset, this uses a type-based approach to cache all js,css and manifest.json requests. This also fixes the issue that the service worker was interfering with EventSource because it was unconditionally handling all requests which this new implementation doesn't. Fixes: https://github.com/go-gitea/gitea/issues/11092 Fixes: https://github.com/go-gitea/gitea/issues/7372 * rethrow error instead of logging * await .register * Revert "rethrow error instead of logging" This reverts commit 043162ba1f18b98a4bf9635959fd28d16e839fc5. * improve comment * remove JSRenderer * add version-based cache invalidation * refactor * more refactor * remove comment * rename item to fit cache name Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* API PullReviewComment HTMLPullURL should return the HTMLURL (#11501) (#11533)zeripath2020-05-211-1/+1
| | | | | | | Fix #11499 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* TrimSpace when reading InternalToken from a file (#11502) (#11524)zeripath2020-05-201-1/+1
| | | | | | | | | | | | InternalTokens are fixed as alphanum strings therefore TrimSpace from these. Also use isatty to not add a terminal newline when redirecting generate. Fix #11498 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lauris BH <lauris@nix.lv>
* Refactor Cron and merge dashboard tasks (#10745)zeripath2020-05-1613-291/+632
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor Cron and merge dashboard tasks * Merge Cron and Dashboard tasks * Make every cron task report a system notice on completion * Refactor the creation of these tasks * Ensure that execution counts of tasks is correct * Allow cron tasks to be started from the cron page * golangci-lint fixes * Enforce that only one task with the same name can be registered Signed-off-by: Andrew Thornton <art27@cantab.net> * fix name check Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @guillep2k * as per @lafriks Signed-off-by: Andrew Thornton <art27@cantab.net> * Add git.CommandContext variants Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Allow log.xxx.default to set logging settings for the default logger only ↵zeripath2020-05-151-2/+5
| | | | | | | | | | | | | | | (#11292) * Allow log.xxx.default to set logging settings for the default logger only Signed-off-by: Andrew Thornton <art27@cantab.net> * Update modules/setting/log.go * as per @silverwind add some documentation Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Handle panics that percolate up to the graceful module (#11291)zeripath2020-05-142-1/+42
| | | | | | | | | | | | | | | | | | * Handle panics in graceful goroutines Adds a some deferred functions to handle panics in graceful goroutines Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle panic in webhook.Deliver Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle panic in mirror.syncMirror Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix ref links in issue overviews for tags (#8742)Sijmen Schoon2020-05-143-8/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Properly generate ref URLs Tags used to not generate correct URLs (src/branch/tags/1.0.0 instead of src/tags/1.0.0). Also cleans up some code around it with the created helper functions. * Fix formatting and create migration * Add copyright head to utils_test * Use a raw query for the ref migration * Remove semicolon * Quote column and table names in migration SQL * Change || to CONCAT, since MSSQL does not support || * Make migration engine aware * Add missing import * Move ref EndName and URL to the issue service * Fix tests * Add test for commit refs * Update issue.go * Use the right command for building JavaScript bundles * Prepare for merge * Check for refs/* before prepending in migration * Update services/issue/issue_test.go * Update modules/git/utils_test.go Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: techknowlogick <matti@mdranta.net>
* Revert "Avoid 0 new commits messages to be send (#11082)" (#11397)zeripath2020-05-131-1/+7
| | | This reverts commit 6034f8bcaaa5348fee775d2307ff03162130a088.
* Refactor Milestone related (#11225)65432020-05-122-1/+44
|
* Allow compare page to look up base, head, own-fork, forkbase-of-head (#11327)zeripath2020-05-122-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow compare page to look up base, head, own-fork, forkbase-of-head Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @guillep2k Signed-off-by: Andrew Thornton <art27@cantab.net> * Update routers/repo/compare.go * as per @guillep2k Signed-off-by: Andrew Thornton <art27@cantab.net> * Rationalise the names a little Signed-off-by: Andrew Thornton <art27@cantab.net> * Rationalise the names a little (2) Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix 500 with fork of fork Signed-off-by: Andrew Thornton <art27@cantab.net> * Prevent 500 on compare different trees Signed-off-by: Andrew Thornton <art27@cantab.net> * dotdotdot is perfectly valid in both usernames and repo names Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure we can set the head and base repos too Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure we can set the head and base repos too (2) Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * only set headRepo == baseRepo if isSameRepo Signed-off-by: Andrew Thornton <art27@cantab.net>
* Support Range header end in lfs (#11314)burbon2020-05-111-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial support of end Range header option in lfs * Allow end range option to be unspecified * Declare toByte for consistency * Factor out content encoding tests from doLfs This is so Range tests could still use doLfs but without repeating not related tests * Add Range header test * implemented extraHeader * parametrized expectedStatus * Add more test cases of Range header * Fix S1030: should use resp.Body.String() * Add more tests for edge cases * Fix tests Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Prevent 500 with badly formed task list (#11328)zeripath2020-05-113-21/+27
| | | | | Fix #11317 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move LFS directory creation out of NewContext (#11362)zeripath2020-05-101-4/+9
| | | | | | | | Fix #9481 (probably others too) Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Prevent timer leaks in Workerpool and others (#11333)zeripath2020-05-084-20/+29
| | | | | | | | | | | | | | | | There is a potential memory leak in `Workerpool` due to the intricacies of `time.Timer` stopping. Whenever a `time.Timer` is `Stop`ped its channel must be cleared using a `select` if the result of the `Stop()` is `false`. Unfortunately in `Workerpool` these were checked the wrong way round. However, there were a few other places that were not being checked. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add NotifySyncPushCommits to indexer notifier (#11309)zeripath2020-05-081-0/+9
| | | | | | | | Thanks to @simon-on-gh for tracking down the issue. Fix #11200 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add EventSource support (#11235)zeripath2020-05-077-12/+401
| | | | | | If the browser supports EventSource switch to use this instead of polling notifications. Signed-off-by: Andrew Thornton art27@cantab.net
* Manage port in submodule refurl (#11305)zeripath2020-05-071-3/+7
| | | | | | | | | | | | | | | | | | | | | * Manage port in submodule refurl Fix #11304 Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * URLJoin is causes a cyclic dependency and possibly isn't what what we want anyway Signed-off-by: Andrew Thornton <art27@cantab.net> * Protect against leading .. in scp syntax Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* api.Context.NotFound(...) should tolerate nil (#11288)zeripath2020-05-051-0/+5
| | | | | | | | | | | | | There is an unfortunate signature change with the api.Context NotFound function; whereas the normal modules/context/Context NotFound function requires an error or nil, the api.Context variant will panic with an NPE if a nil is provided. This PR will allow api.Context.NotFound to tolerate a being passed a nil. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>