diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-02-10 00:14:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-09 11:14:45 -0500 |
commit | cef8f50286ce1bc04c2e5989998d5a0774870de7 (patch) | |
tree | 35caaaf535fd7c03ffde727698a4cef48d854570 /web_src/js/features/admin/common.js | |
parent | e253888a0e68d03da0616930427d7162eefa6aaf (diff) | |
download | gitea-cef8f50286ce1bc04c2e5989998d5a0774870de7.tar.gz gitea-cef8f50286ce1bc04c2e5989998d5a0774870de7.zip |
Improve AppUrl/ROOT_URL checking (#22836)
After some PRs:
* #21986
* #22795
* #22808
* #22831
* #22839
Users won't be affected by the ROOT_URL problem in most cases. Close
#19345
This PR improves AppUrl/ROOT_URL checking, only check it on the admin
page, and the message is also updated.
Feel free to suggest about more English-native messages.
![image](https://user-images.githubusercontent.com/2114189/217811809-7d44ddb7-2c4a-46d0-a5db-8ae6ee65f8c3.png)
Diffstat (limited to 'web_src/js/features/admin/common.js')
-rw-r--r-- | web_src/js/features/admin/common.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js index 2438fcf62b..d0b3e461d5 100644 --- a/web_src/js/features/admin/common.js +++ b/web_src/js/features/admin/common.js @@ -1,12 +1,17 @@ import $ from 'jquery'; +import {checkAppUrl} from '../common-global.js'; const {csrfToken} = window.config; export function initAdminCommon() { - if ($('.admin').length === 0) { + if ($('.page-content.admin').length === 0) { return; } + // check whether appUrl(ROOT_URL) is correct, if not, show an error message + // only admin pages need this check because most templates are using relative URLs now + checkAppUrl(); + // New user if ($('.admin.new.user').length > 0 || $('.admin.edit.user').length > 0) { $('#login_type').on('change', function () { |