feat(admin): overlay system settings from SuperAdmin program-settings
Fetch /api/public/program-settings with 3-host retry and hide the local advanced-configuration editor in favor of SuperAdmin. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+37
-21
@@ -18,8 +18,8 @@
|
||||
const VERSION_UPDATE_LOCK_KEY = 'version_update_lock';
|
||||
const VERSION_LAST_RELOAD_KEY = 'version_last_reload';
|
||||
const AUTH_TOKEN_KEY = 'peransa_token';
|
||||
const VERSION_RETRY_ROUNDS = 5;
|
||||
const CONFIG_RETRY_ROUNDS = 5;
|
||||
const VERSION_RETRY_ROUNDS = 3;
|
||||
const CONFIG_RETRY_ROUNDS = 3;
|
||||
const CONFIG_TIMEOUT = 12000;
|
||||
|
||||
let configTimeoutId;
|
||||
@@ -37,33 +37,50 @@
|
||||
return host;
|
||||
}
|
||||
|
||||
function isDevHost() {
|
||||
const host = String(window.location.hostname || '').trim();
|
||||
return host === 'localhost' || host === '127.0.0.1';
|
||||
}
|
||||
|
||||
function getVersionUrls() {
|
||||
const domain = encodeURIComponent(resolveTenantDomain());
|
||||
|
||||
return [
|
||||
const urls = [
|
||||
'https://adm.montzar.ir/get_version?domain=' + domain,
|
||||
'https://adm.montech.ir/get_version?domain=' + domain,
|
||||
'https://adm.montest.ir/get_version?domain=' + domain,
|
||||
'https://tablo.talasevin.ir/get_version',
|
||||
'https://abshode-service.montgit.ir/server/get_version',
|
||||
getProtocol() + '//212.23.201.173:8381/get_version',
|
||||
getProtocol() + '//91.212.174.137:4040/server/get_version'
|
||||
'https://adm.montest.ir/get_version?domain=' + domain
|
||||
];
|
||||
|
||||
if (isDevHost()) {
|
||||
urls.push(
|
||||
'https://tablo.talasevin.ir/get_version',
|
||||
'https://abshode-service.montgit.ir/server/get_version',
|
||||
getProtocol() + '//212.23.201.173:8381/get_version',
|
||||
getProtocol() + '//91.212.174.137:4040/server/get_version'
|
||||
);
|
||||
}
|
||||
|
||||
return urls;
|
||||
}
|
||||
|
||||
function getConfigUrls() {
|
||||
const protocol = getProtocol();
|
||||
const domain = encodeURIComponent(resolveTenantDomain());
|
||||
|
||||
return [
|
||||
const urls = [
|
||||
'https://adm.montzar.ir/get_user?domain=' + domain,
|
||||
'https://adm.montech.ir/get_user?domain=' + domain,
|
||||
'https://adm.montest.ir/get_user?domain=' + domain,
|
||||
protocol + '//tablo.talasevin.ir/get_user',
|
||||
protocol + '//abshode-service.montgit.ir/server/get_user',
|
||||
protocol + '//212.23.201.173:8381/get_user',
|
||||
protocol + '//91.212.174.137:4040/server/get_user'
|
||||
'https://adm.montest.ir/get_user?domain=' + domain
|
||||
];
|
||||
|
||||
if (isDevHost()) {
|
||||
urls.push(
|
||||
protocol + '//tablo.talasevin.ir/get_user',
|
||||
protocol + '//abshode-service.montgit.ir/server/get_user',
|
||||
protocol + '//212.23.201.173:8381/get_user',
|
||||
protocol + '//91.212.174.137:4040/server/get_user'
|
||||
);
|
||||
}
|
||||
|
||||
return urls;
|
||||
}
|
||||
|
||||
function sortUrls(urls, successKey) {
|
||||
@@ -367,8 +384,9 @@
|
||||
'<div style="min-height:100vh;display:flex;align-items:center;justify-content:center;direction:rtl;font-family:sans-serif;padding:24px;background:#fff;color:#111827;">' +
|
||||
'<div style="width:min(420px,100%);text-align:center;border:1px solid rgba(15,23,42,0.08);border-radius:24px;padding:28px 22px;">' +
|
||||
'<div style="font-size:42px;margin-bottom:12px;">⚠️</div>' +
|
||||
'<h2 style="margin:0 0 20px;font-size:20px;">خطا در برقراری ارتباط با سرور</h2>' +
|
||||
'<button type="button" onclick="location.reload()" style="padding:11px 22px;border:0;border-radius:12px;background:#2563eb;color:#fff;cursor:pointer;font-weight:700;">تلاش مجدد</button>' +
|
||||
'<h2 style="margin:0 0 12px;font-size:20px;">خطا در برقراری ارتباط با سرور</h2>' +
|
||||
'<p style="margin:0 0 20px;color:rgba(15,23,42,0.62);line-height:2;font-size:14px;">برقراری ارتباط با سرور امکانپذیر نیست. لطفاً اتصال اینترنت خود را بررسی کرده و صفحه را تازهسازی نمایید.</p>' +
|
||||
'<button type="button" onclick="location.reload()" style="padding:11px 22px;border:0;border-radius:12px;background:#2563eb;color:#fff;cursor:pointer;font-weight:700;">تازهسازی صفحه</button>' +
|
||||
'</div></div>';
|
||||
}
|
||||
|
||||
@@ -477,9 +495,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
window.__APP_CONFIG__ = {};
|
||||
window.__CONFIG_READY__ = true;
|
||||
finishConfigLoad({}, error);
|
||||
showServerUnavailable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user