aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/bootstrap.js
Commit message (Collapse)AuthorAgeFilesLines
* Fix JS error and improve error message styles (#29963)silverwind2024-03-211-1/+1
| | | | | | | | | | | | | | | | Fixes: https://github.com/go-gitea/gitea/issues/29956. This error exposed a existing bug in the code, it was just never noticed because the jQuery expression evaluated without error before while the new one doesn't. Also improves error message styles: Before: <img width="1338" alt="Screenshot 2024-03-21 at 09 16 07" src="https://github.com/go-gitea/gitea/assets/115237/1cc1ef89-ad94-491e-bbca-75387f7547a0"> After: <img width="1335" alt="Screenshot 2024-03-21 at 09 15 44" src="https://github.com/go-gitea/gitea/assets/115237/312efc79-5353-4e2a-a703-1bccd3c01736">
* Suppress error from monaco-editor (#29684)silverwind2024-03-091-0/+8
| | | | | | | | | | | | Fixes: https://github.com/go-gitea/gitea/issues/29414 I see no way for us to catch this error, so downgrade it until https://github.com/microsoft/monaco-editor/issues/4325 is fixed, which will likely take a few weeks to propagate up from vscode. The entries in `updates.config.js` will make [`updates`](https://github.com/silverwind/updates) not upgrade these anymore and I think it's good documentation as well to have the reasons why we don't upgrade these dependencies.
* Fix/Improve `processWindowErrorEvent` (#29407)silverwind2024-02-281-21/+36
| | | | | | | | - `e.error` can be undefined in some cases which would raise an error inside this error handler, fixed that. - The displayed message mentions looking into the console, but in my case of error from `ResizeObserver` there was nothing there, so add this logging. I think this logging was once there but got lost during refactoring.
* Don't show third-party JS errors in production builds (#29303)silverwind2024-02-221-3/+12
| | | | | | | | So we don't get issues like https://github.com/go-gitea/gitea/issues/29080 and https://github.com/go-gitea/gitea/issues/29273 any more. Only active in [production builds](https://webpack.js.org/guides/production/#specify-the-mode), in non-production the errors will still show.
* Avoid duplicate JS error messages on UI (#28873)wxiaoguang2024-01-211-4/+15
| | | | | | | | | | | | | | | | Gitea treat JS errors seriously, so sometimes the JS errors caused by 3rdparty code (eg: browser extensions) would also be reported on Gitea UI: TypeError: WeakMap key undefined (caused by extension DarkReader's bug) #28861 To avoid fill the user's screen with a lot of error messages, this PR merges the same error messages into one, like this: ```js <div class="page-content"> <div class="... js-global-error" data-global-error-msg-compact="testmsg1" data-global-error-msg-count="2">test msg 1 (2)</div> <div class="... js-global-error" data-global-error-msg-compact="testmsg2" data-global-error-msg-count="1">test msg 2</div> </div> ```
* Remove joinPaths function (#26833)silverwind2023-08-311-3/+1
| | | | | | Extract from https://github.com/go-gitea/gitea/pull/25940. `assetUrlPrefix` is guaranteed to not contain trailing slashes, making this function unneeded.
* Check disabled workflow when rerun jobs (#26535)yp053272023-08-221-1/+9
| | | | | | | | In GitHub, we can not rerun jobs if the workflow is disabled. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve template system and panic recovery (#24461)wxiaoguang2023-05-041-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Partially for #24457 Major changes: 1. The old `signedUserNameStringPointerKey` is quite hacky, use `ctx.Data[SignedUser]` instead 2. Move duplicate code from `Contexter` to `CommonTemplateContextData` 3. Remove incorrect copying&pasting code `ctx.Data["Err_Password"] = true` in API handlers 4. Use one unique `RenderPanicErrorPage` for panic error page rendering 5. Move `stripSlashesMiddleware` to be the first middleware 6. Install global panic recovery handler, it works for both `install` and `web` 7. Make `500.tmpl` only depend minimal template functions/variables, avoid triggering new panics Screenshot: <details> ![image](https://user-images.githubusercontent.com/2114189/235444895-cecbabb8-e7dc-4360-a31c-b982d11946a7.png) </details>
* Show friendly 500 error page to users and developers (#24110)wxiaoguang2023-04-141-1/+11
| | | | | | | | | | | | | | | | | | | | | | Close #24104 This also introduces many tests to cover many complex error handling functions. ### Before The details are never shown in production. <details> ![image](https://user-images.githubusercontent.com/2114189/231805004-13214579-4fbe-465a-821c-be75c2749097.png) </details> ### After The details could be shown to site admin users. It is safe. ![image](https://user-images.githubusercontent.com/2114189/231803912-d5660994-416f-4b27-a4f1-a4cc962091d4.png)
* Quick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734)Xinyu Zhou2022-11-091-3/+0
| | | | | | | | | | | | fixes: https://github.com/go-gitea/gitea/issues/21733 Uncaught Error: Language id "vs.editor.nullLanguage" is not configured nor known Note that this monaco-editor worked fine on 0.33.0 and broke on 0.34.0. If upstream fixed, remove this code. Signed-off-by: Xinyu Zhou <i@sourcehut.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix mermaid-related bugs (#21431)silverwind2022-10-151-0/+4
|
* Bypass Firefox (iOS) bug (#20244)wxiaoguang2022-07-051-0/+5
| | | | | | | | | | * https://github.com/go-gitea/gitea/issues/20240 At the moment, Firefox (iOS) (10x) has an engine bug. See https://github.com/go-gitea/gitea/issues/20240 If a script inserts a newly created (and content changed) element into DOM, there will be a nonsense error event reporting: Script error: line 0, col 0. This PR ignores such nonsense error event. Fix #20240
* Show messages for users if the ROOT_URL is wrong, show JavaScript errors ↵wxiaoguang2022-03-301-0/+41
(#18971) * ROOT_URL issues: some users did wrong to there app.ini config, then: * The assets can not be loaded (AppSubUrl != "" and users try to access http://host:3000/) *The ROOT_URL is wrong, then many URLs in Gitea are broken. Now Gitea show enough information to users. * JavaScript error issues, there are many users affected by JavaScript errors, some are caused by frontend bugs, some are caused by broken customized templates. If these JS errors can be found at first time, then maintainers do not need to ask about how bug occurs again and again. * Some people like to modify the `head.tmpl`, so we separate the script part to `head_script.tmpl`, then it's much safer. * use specialized CSS class "js-global-error", end users still have a chance to hide error messages by customized CSS styles.