mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 13:28:25 +00:00 
			
		
		
		
	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. 
This commit is contained in:
		@@ -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 () {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user