aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
Commit message (Collapse)AuthorAgeFilesLines
* Sanitize user-input on file name (#17666)Gusted2021-11-171-1/+2
| | | | | | | | | | | * Sanitize user-input on file name - Sanitize user-input before it get passed into the DOM. - Prevent things like "<iframe onload=alert(1)></iframe>" from being executed. This isn't a XSS attack as the server seems to be santizing the path as well. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Multiple Escaping Improvements (#17551)zeripath2021-11-161-1/+1
| | | | | | | | | | | | | | There are multiple places where Gitea does not properly escape URLs that it is building and there are multiple places where it builds urls when there is already a simpler function available to use this. This is an extensive PR attempting to fix these issues. 1. The first commit in this PR looks through all href, src and links in the Gitea codebase and has attempted to catch all the places where there is potentially incomplete escaping. 2. Whilst doing this we will prefer to use functions that create URLs over recreating them by hand. 3. All uses of strings should be directly escaped - even if they are not currently expected to contain escaping characters. The main benefit to doing this will be that we can consider relaxing the constraints on user names and reponames in future. 4. The next commit looks at escaping in the wiki and re-considers the urls that are used there. Using the improved escaping here wiki files containing '/'. (This implementation will currently still place all of the wiki files the root directory of the repo but this would not be difficult to change.) 5. The title generation in feeds is now properly escaped. 6. EscapePound is no longer needed - urls should be PathEscaped / QueryEscaped as necessary but then re-escaped with Escape when creating html with locales Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net>
* Remove superfluous argument (#17667)Gusted2021-11-161-1/+1
| | | As title.
* Add copy button to markdown code blocks (#17638)silverwind2021-11-1610-21/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add copy button to markdown code blocks Done mostly in JS because I think it's better not to try getting buttons past the markup sanitizer. * add svg module tests * fix sanitizer regexp * remove outdated comment * vertically center button in issue comments as well * add comment to css * fix undefined on view file line copy * combine animation less files * Update modules/markup/markdown/markdown.go Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> * add test for different sizes * add cloneNode and add tests for it * use deep clone * remove useless optional chaining * remove the svg node cache * unify clipboard copy string and i18n * remove unused var * remove unused localization * minor css tweaks to the button * comment tweak * remove useless attribute Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Migrating wiki don't require token, so we should move it out of the require ↵Lunny Xiao2021-11-161-1/+0
| | | | | | | form (#17645) * Migrating wiki don't require token, so we should move it out of the require form * Fix lint
* Fix GitBucket icon (#17644)silverwind2021-11-161-1/+1
| | | | | Partial fix for https://github.com/go-gitea/gitea/issues/17642. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix database deadlock when update issue labels (#17649)wxiaoguang2021-11-162-26/+22
| | | | This fix updates issue labels one by one, and won't cause database deadlock. In future, we can use a batch API to update all changed labels by one request.
* Add icon to vscode clone link (#17641)silverwind2021-11-141-0/+1
|
* Add migration from GitBucket (#16767)KN4CK3R2021-11-141-0/+39
| | | | | | | | | | | | | This PR adds [GitBucket](https://gitbucket.github.io/) as migration source. Supported: - Milestones - Issues - Pull Requests - Comments - Reviews - Labels There is no public usable instance so no integration tests added.
* perf: only generate data-comment-url once (#17618)Gusted2021-11-141-1/+1
|
* Fix some incorrect async functions, improve frontend document. (#17597)wxiaoguang2021-11-126-44/+48
|
* Update JS dependencies (#17611)silverwind2021-11-115-8/+7
| | | | | | | | | - Update monaco, adapting to breaking changes - Update dropzone, adapting to breaking changes - Update linters, fix new issues, disable opinionated stylelint rules - Rebuild SVGs and images - Tested Dropzone and Monaco Replaces: https://github.com/go-gitea/gitea/pull/17574
* Move merge-section to `> .content` (#17582)Gusted2021-11-091-8/+15
| | | | | | | | | | | | * Move `> .merge-section` to `> .content` scope - Fixes a issue that started from https://github.com/go-gitea/gitea/pull/17317 - Move `> .merge-section` to the `> .content` scope. - Resolves #17480 * Move `.merge-section` back to outside scope Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Improve async/await usage, and sort init calls in `index.js` (#17386)wxiaoguang2021-11-0921-202/+214
| | | | * clean up async/await, and sort init calls in `index.js * use `const _promise` to indicate that we do not need await an async function
* Remove appSubUrl from pasted images (#17572)zeripath2021-11-081-3/+3
| | | | | | | | | | * Remove appSubUrl from pasted images Since we fixed the url base for the links in repositories we no longer need to add the appsuburl to pasted image links. Fix #17057 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move key forms before list and add cancel button (#17432)qwerty2872021-10-281-1/+2
| | | | | | | * Move GPG form before list and add cancel button * Move SSH form before list and add cancel button Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* make commit-statuses popup can be shown correctly. (#17447)wxiaoguang2021-10-282-3/+19
| | | | | | | | | | Close #17443 Maybe we do not need to backport this PR, the bug doesn't break daily usage. After the fix, the commit statuses popup can show a lot of lines with scroll bars: ![image](https://user-images.githubusercontent.com/2114189/139026160-f01b484c-6207-494a-a190-a6dd184ceb2b.png)
* Fix a UI error when folding a file content in a commit view (#17446)wxiaoguang2021-10-271-2/+1
|
* Show client-side error if wiki page is empty (#17415)David Jimenez2021-10-271-2/+20
| | | | | | | | | | | | | | | * fix: show client-side error if wiki page is empty Implement a JS, client-side validation workaround for a bug in the upstream editor library SimpleMDE which breaks HTML5 client-side validation when a wiki page is submitted. This allows native, client-side errors to appear if the text editor contents are empty. See upstream bugfix report: https://github.com/sparksuite/simplemde-markdown-editor/issues/324 Signed-off-by: David Jimenez <dvejmz@sgfault.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Tune UI alignment for nav bar notification icon, avatar image, issue label ↵wxiaoguang2021-10-262-0/+3
| | | | (#17438)
* fix markdown checkbox rendering (#17425)wxiaoguang2021-10-251-0/+6
|
* Fix issue content history problems, improve UI (#17404)wxiaoguang2021-10-231-2/+2
| | | | | * Improve: make diff result better, make the HTML element fit the full height in the content history diff dialog * Bug fix: when edit the main issue, the poster is wrongly set to the issue poster
* Fix issue markdown bugs (#17411)wxiaoguang2021-10-231-1/+4
| | | | * Bug fix: render Markdown http://AppURL/org/repo/issues/4?a=1&b=2#comment-123 test to HTML correctly, close #17394 * Bug fix: fix the positions of checkboxes in rendered HTML, close #17395
* Fix context popup error (#17398)wxiaoguang2021-10-223-2/+29
| | | * Fix context popup error
* Fix the click behavior for <tr> and <td> with [data-href] (#17388)wxiaoguang2021-10-211-8/+13
|
* Fix SVG side by side comparison link (#17375)Mario Lubenka2021-10-211-1/+0
| | | | | | | | | | | | | | | | | * Remove swipe-bar z-index Fixes position of swipe-bar so it does not overlay other UI components when scrolling. Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Unique names for image tabs in pull request Define unique names for image tabs in pull requests, in order to toggle tabs correctly when multiple are displayed on one page. Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Frontend refactor, PascalCase to camelCase, remove unused code (#17365)wxiaoguang2021-10-2133-137/+137
| | | | | * Frontend refactor, PascalCase to camelCase, remove unused code * fix
* Prevent NPE in CSV diff rendering when column removed (#17018)Richard Mahn2021-10-203-0/+10
| | | | | | | | | | | | | | | | Fixes #16837 if a column is deleted. We were clobbering the columns that were added by looping through the aline (base) and then when bline (head) was looped through, it clobbered what was in the "cells" array that is show in the diff, and then left a nil cell because nothing was shifted. This fix properly shifts the cells, and properly puts the b cell either at its location or after, according to what the aline placed in the cells. This includes test, adding a new test function since adding/removing cells works best with three columns, not two, which results in 4 columns of the resulting cells because it has a deleted column and an added column. If you try this locally, you can try those cases and others, such as adding a column. There was no need to do anything special for the rows when `aline == 0 || bline == 0` so that was removed. This allows the same code to be used for removed or added lines, with the bcell text always being the RightCell, acell text being the LeftCell. I still added the patch zeripath gave at https://github.com/go-gitea/gitea/issues/16837#issuecomment-913007382 so that just in case for some reason a cell is nil (which shouldn't happen now) it doesn't throw a 500 error, so the user can at least view the raw diff. Also fixes in the [view.go](https://github.com/go-gitea/gitea/pull/17018/files#diff-43a7f4747c7ba8bff888c9be11affaafd595fd55d27f3333840eb19df9fad393L521) file how if a CSV file is empty (either created empty or if you edit it and remove all contents) it throws a huge 500 error when you then save it (when you view the file). Since we allow creating, saving and pushing empty files, we shouldn't throw an error on an empty CSV file, but just show its empty contents. This doesn't happen if it is a Markdown file or other type of file that is empty. EDIT: Now handled in the markup/csv renderer code
* "Copy branch name" button in pull request (#17323)Mario Lubenka2021-10-192-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | * Drop data-original from clipboard data-original attribute was removed. Instead, the original value from data-content is set after success/fail message was displayed. Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * "Copy branch name" button in pull request Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update templates/repo/issue/view_title.tmpl Co-authored-by: silverwind <me@silverwind.io> * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net>
* Re-allow clipboard copy on non-https sites (#17118)Netduma Luke M2021-10-191-1/+32
| | | | * Re-allow clipboard copy on non-https sites * fallback clipboard functions
* Update JS dependencies (#17357)silverwind2021-10-192-2/+2
| | | | | | | | | | | | | * Update JS dependencies - Upgrade to eslint 8 and add new plugin rules - Adapt to various API changes - Rebuild SVGs * fix webpack warning on license * order options alphabetically Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix dashboard repolist alignment and repolisting (#17355)zeripath2021-10-192-0/+8
| | | | | | | | | | | | | | Unfortunately #17301 broke the restriction of the dashboard repolist to the user's repos because it stopped passing in the uid for the current user. This PR restores this. There is also a weird alignment problem - not caused by that PR - where the menu items in the repolist spread over multiple lines. This PR simply reduces the padding on these items and switches the justification of the flex elements to space-evenly. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Disable form autofill (#17291)wxiaoguang2021-10-191-3/+6
| | | | | | | ]* fix aria-hidden and tabindex * use {{template "base/disable_form_autofill"}} instead of {{DisableFormAutofill}} Co-authored-by: zeripath <art27@cantab.net>
* fix: repository summary on mobile (#17322)kolaente2021-10-171-0/+11
| | | | | | | | | | | This PR fixes the repository summary on mobile. Most of it is vertically centering things and some spacing. #### Before: ![Screen Shot 2021-10-15 at 19 12 25](https://user-images.githubusercontent.com/13721712/137528901-021867b5-73c3-4f48-8408-18bc573f5ee7.png) #### After: ![Screen Shot 2021-10-15 at 19 28 06](https://user-images.githubusercontent.com/13721712/137528970-058a66fd-d5d9-44ea-ba5f-998bf8cbf4fe.png)
* Ensure popup text is aligned left (#17327)Mario Lubenka2021-10-171-0/+4
| | | | Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Fix the PR review form bug during frontend refactor (#17332)wxiaoguang2021-10-161-1/+1
|
* Split `index.js` to separate files (#17315)wxiaoguang2021-10-1740-3494/+3686
| | | | | | | | | | | | | | | | | | * split `index.js` to separate files * tune clipboard * fix promise * fix document * remove intermediate empty file * fix async event listener * use `export function` instead of `export {}`, add more comments Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* fix: issue close/comment buttons on mobile (#17317)kolaente2021-10-151-29/+39
| | | | | | | | * fix: issue close/comment buttons on mobile * fix: lint Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* fix: code review comments on mobile (#17321)kolaente2021-10-162-2/+56
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add buttons to allow loading of incomplete diffs (#16829)zeripath2021-10-152-0/+26
| | | | | | | | | | | | | | | | | This PR adds two buttons to the stats and the end of the diffs list to load the (some of) the remaining incomplete diff sections. Contains #16775 Signed-off-by: Andrew Thornton <art27@cantab.net> ## Screenshots ### Show more button at the end of the diff ![Screenshot from 2021-09-04 11-12-37](https://user-images.githubusercontent.com/1824502/132091009-b1f6113e-2c04-4be5-8a04-b8ecea56887b.png) ### Show more button at the end of the diff stats box ![Screenshot from 2021-09-04 11-14-54](https://user-images.githubusercontent.com/1824502/132091063-86da5a6d-6628-4b82-bea9-3655cd9f40f6.png)
* Frontend refactor: move Vue related code from `index.js` to `components` ↵wxiaoguang2021-10-158-587/+629
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dir, and remove unused codes. (#17301) * frontend refactor * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> * Update templates/base/head.tmpl Co-authored-by: delvh <dev.lh@web.de> * Update docs/content/doc/developers/guidelines-frontend.md Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> * fix typo * fix typo * refactor PageData to pageData * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> * Simply for the visual difference. Co-authored-by: delvh <dev.lh@web.de> * Revert "Apply suggestions from code review" This reverts commit 4d78ad9b0e96ca180e0823de17659a2e0814c099. Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* Show direct match on top for user search (#17303)Maximilian Weiler2021-10-151-2/+8
| | | | | | | | | This PR makes sure that direct matches in the user search always show on top of the result list. The following places were checked to follow the desired behavior now: - Search when adding a user to a team - Search when adding a user as a collaborator to a repository Signed-off-by: Maximilian Weiler <16721506+maweil@users.noreply.github.com>
* Add user status filter to admin user management page (#16770)wxiaoguang2021-10-122-0/+34
| | | | | | | | | | | | | | | | | | | | It makes Admin's life easier to filter users by various status. * introduce window.config.PageData to pass template data to javascript module and small refactor move legacy window.ActivityTopAuthors to window.config.PageData.ActivityTopAuthors make HTML structure more IDE-friendly in footer.tmpl and head.tmpl remove incorrect <style class="list-search-style"></style> in head.tmpl use log.Error instead of log.Critical in admin user search * use LEFT JOIN instead of SubQuery when admin filters users by 2fa. revert non-en locale. * use OptionalBool instead of status map * refactor SearchUserOptions.toConds to SearchUserOptions.toSearchQueryBase * add unit test for user search * only allow admin to use filters to search users
* Save and view issue/comment content history (#16909)wxiaoguang2021-10-103-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * issue content history * Use timeutil.TimeStampNow() for content history time instead of issue/comment.UpdatedUnix (which are not updated in time) * i18n for frontend * refactor * clean up * fix refactor * re-format * temp refactor * follow db refactor * rename IssueContentHistory to ContentHistory, remove empty model tags * fix html * use avatar refactor to generate avatar url * add unit test, keep at most 20 history revisions. * re-format * syntax nit * Add issue content history table * Update models/migrations/v197.go Co-authored-by: 6543 <6543@obermui.de> * fix merge Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Move add deploy key form before the list and add a cancel button (#17228)qwerty2872021-10-081-0/+3
|
* Defer Last Commit Info (#16467)zeripath2021-10-082-0/+42
| | | | | | | | | | | One of the biggest reasons for slow repository browsing is that we wait until last commit information has been generated for all files in the repository. This PR proposes deferring this generation to a new POST endpoint that does the look up outside of the main page request. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Reference in new issue modal: dont pre-populate issue title (#17208)Norwin2021-10-021-2/+0
| | | | | * dont prepopulate issue title * cleanup
* Add option to copy line permalink (#17145)qwerty2872021-10-021-26/+25
| | | | | | | | | | | * Add option to copy line permalink * Fix lint * Apply review suggestions * Update code and fix lint * Use features/clipboard.js framework
* Kanban colored boards (#16647)Romain2021-09-295-23/+116
| | | Add a column Color in ProjectBoard and color picker in new / edit project board form.
* Use light/dark theme based on system preference (#17051)Gwyneth Morgan2021-09-272-1/+10
| | | | | | | | Add a new default theme `auto`, which will automatically switch between `gitea` (light) and `arc-green` (dark) themes depending on the user's operating system settings. Closes: #8183