feat: load program-settings from SuperAdmin with 3-host failover

Use /api/public/program-settings only and retry montzar/montech/montest
three rounds before showing the bootstrap error.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-18 16:10:35 +03:30
co-authored by Cursor
parent 5d3ca82236
commit a9d0cba909
7 changed files with 250 additions and 89 deletions
+31 -18
View File
@@ -341,34 +341,47 @@
]
}
function isDevHost() {
var host = String(window.location.hostname || '').trim()
return host === 'localhost' || host === '127.0.0.1'
}
function getVersionUrls() {
var protocol = getProtocol()
var domain = encodeURIComponent(resolveTenantDomain())
var urls = getSuperAdminBases().map(function (base) {
return base + '/get_version?domain=' + domain
})
return urls.concat([
'https://tablo.talasevin.ir/get_version',
'https://abshode-service.montgit.ir/server/get_version',
protocol + '//212.23.201.173:8381/get_version',
protocol + '//91.212.174.137:4040/server/get_version'
])
if (isDevHost()) {
var protocol = getProtocol()
urls = urls.concat([
'https://tablo.talasevin.ir/get_version',
'https://abshode-service.montgit.ir/server/get_version',
protocol + '//212.23.201.173:8381/get_version',
protocol + '//91.212.174.137:4040/server/get_version'
])
}
return urls
}
function getConfigUrls() {
var protocol = getProtocol()
var domain = encodeURIComponent(resolveTenantDomain())
var urls = getSuperAdminBases().map(function (base) {
return base + '/get_user?domain=' + domain
})
return urls.concat([
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'
])
if (isDevHost()) {
var protocol = getProtocol()
urls = urls.concat([
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 sortVersionUrls(urls) {
@@ -646,10 +659,10 @@
'<div style="font-size: 42px; margin-bottom: 12px;">⚠️</div>' +
'<h2 style="margin: 0 0 12px; font-size: 20px;">خطا در بارگذاری برنامه</h2>' +
'<p style="margin: 0 0 20px; color: var(--boot-muted); line-height: 2; font-size: 14px;">' +
'ارتباط با سرور برقرار نشد یا فایل‌های برنامه به‌درستی دریافت نشدند.' +
'برقراری ارتباط با سرور امکان‌پذیر نیست. لطفاً اتصال اینترنت خود را بررسی کرده و صفحه را تازه‌سازی نمایید.' +
'</p>' +
'<button onclick="window.__APP_BOOT_SIMPLE_RETRY__()" style="padding: 11px 22px; border: 0; border-radius: 12px; background: var(--boot-accent); color: white; cursor: pointer; font-weight: 700;">' +
'تلاش مجدد' +
'تازه‌سازی صفحه' +
'</button>' +
'<button onclick="window.__APP_BOOT_CLEAN_RELOAD__()" style="margin-right: 8px; padding: 11px 18px; border: 1px solid var(--boot-border); border-radius: 12px; background: transparent; color: var(--boot-text); cursor: pointer; font-weight: 700;">' +
'پاک‌سازی و تلاش مجدد' +
@@ -661,8 +674,8 @@
async function cleanFetchAndReload() {
renderRecovering('در حال دریافت تنظیمات جدید برنامه...')
var version = await loadRemoteVersion(5)
var freshConfigResult = await fetchFreshConfig(5)
var version = await loadRemoteVersion(3)
var freshConfigResult = await fetchFreshConfig(3)
clearReadableCookies()
// clearLocalStorageExceptToken()