Skip to content

Commit 58476c9

Browse files
committed
improve
1 parent 29aea36 commit 58476c9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Diff for: web_src/js/features/admin/common.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import $ from 'jquery';
2+
import {checkAppUrl} from '../common-global.js';
23

34
const {csrfToken} = window.config;
45

56
export function initAdminCommon() {
6-
if ($('.admin').length === 0) {
7+
if ($('.page-content.admin').length === 0) {
78
return;
89
}
910

11+
// check whether appUrl(ROOT_URL) is correct, if not, show an error message
12+
// only admin pages need this check because most templates are using relative URLs now
13+
checkAppUrl();
14+
1015
// New user
1116
if ($('.admin.new.user').length > 0 || $('.admin.edit.user').length > 0) {
1217
$('#login_type').on('change', function () {

Diff for: web_src/js/features/common-global.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,6 @@ export function checkAppUrl() {
381381
if (curUrl.startsWith(appUrl) || `${curUrl}/` === appUrl) {
382382
return;
383383
}
384-
if (document.querySelector('.page-content.install')) {
385-
return; // no need to show the message on the installation page
386-
}
387-
showGlobalErrorMessage(`Your ROOT_URL in app.ini is ${appUrl} but you are visiting ${curUrl}
388-
You should set ROOT_URL correctly, otherwise the web may not work correctly.`);
384+
showGlobalErrorMessage(`Your ROOT_URL in app.ini is "${appUrl}", it's unlikely matching the site you are visiting.
385+
Mismatched ROOT_URL config causes wrong URL links for web UI/mail content/webhook notification.`);
389386
}

Diff for: web_src/js/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import {
4848
initCommitStatuses,
4949
} from './features/repo-commit.js';
5050
import {
51-
checkAppUrl,
5251
initFootLanguageMenu,
5352
initGlobalButtonClickOnEnter,
5453
initGlobalButtons,
@@ -199,5 +198,4 @@ $(document).ready(() => {
199198
initUserAuthWebAuthnRegister();
200199
initUserSettings();
201200
initViewedCheckboxListenerFor();
202-
checkAppUrl();
203201
});

0 commit comments

Comments
 (0)