File tree 3 files changed +8
-8
lines changed
3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
import $ from 'jquery' ;
2
+ import { checkAppUrl } from '../common-global.js' ;
2
3
3
4
const { csrfToken} = window . config ;
4
5
5
6
export function initAdminCommon ( ) {
6
- if ( $ ( '.admin' ) . length === 0 ) {
7
+ if ( $ ( '.page-content. admin' ) . length === 0 ) {
7
8
return ;
8
9
}
9
10
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
+
10
15
// New user
11
16
if ( $ ( '.admin.new.user' ) . length > 0 || $ ( '.admin.edit.user' ) . length > 0 ) {
12
17
$ ( '#login_type' ) . on ( 'change' , function ( ) {
Original file line number Diff line number Diff line change @@ -381,9 +381,6 @@ export function checkAppUrl() {
381
381
if ( curUrl . startsWith ( appUrl ) || `${ curUrl } /` === appUrl ) {
382
382
return ;
383
383
}
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.` ) ;
389
386
}
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ import {
48
48
initCommitStatuses ,
49
49
} from './features/repo-commit.js' ;
50
50
import {
51
- checkAppUrl ,
52
51
initFootLanguageMenu ,
53
52
initGlobalButtonClickOnEnter ,
54
53
initGlobalButtons ,
@@ -199,5 +198,4 @@ $(document).ready(() => {
199
198
initUserAuthWebAuthnRegister ( ) ;
200
199
initUserSettings ( ) ;
201
200
initViewedCheckboxListenerFor ( ) ;
202
- checkAppUrl ( ) ;
203
201
} ) ;
You can’t perform that action at this time.
0 commit comments