Merge branch 'dev' into feature/install-page

# Conflicts:
#	backend/bot/app/web/admin_api_impl/settings.py
#	backend/bot/app/web/webapp/cache_helpers.py
#	frontend/src/admin/sections/SettingsSection.svelte
#	tests/test_admin_settings_manifest_i18n.py
This commit is contained in:
3252a8
2026-05-22 22:57:24 +03:00
31 changed files with 2093 additions and 219 deletions
+43 -6
View File
@@ -200,7 +200,7 @@
showLogin,
telegramSdk,
getTg: () => tg,
telegramOAuthClientId,
telegramOAuthClientId: () => telegramOAuthClientId,
currentLang: () => currentLang,
normalizeLangCode,
updateLocalData: (updatedLanguage) => {
@@ -405,6 +405,7 @@
$: telegramOAuthClientId = Number(CFG.telegramOAuthClientId || telegramLoginBotId || 0);
$: telegramMiniAppInitData = tg?.initData || readTelegramMiniAppInitDataFromLocation();
$: telegramMiniAppAuthAvailable = Boolean(telegramMiniAppInitData);
$: telegramMiniAppContext = hasTelegramLaunchParams();
$: telegramLoginUnavailable =
!telegramMiniAppAuthAvailable && !telegramOAuthClientId && telegramSdkStatus !== "loading";
$: telegramLoginChecking =
@@ -660,7 +661,10 @@
link.rel = "stylesheet";
link.href = href;
link.onload = () => resolve();
link.onerror = () => reject(new Error(`stylesheet_load_failed:${href}`));
link.onerror = () => {
link.remove();
reject(new Error(`stylesheet_load_failed:${href}`));
};
document.head.appendChild(link);
});
}
@@ -673,11 +677,34 @@
script.src = src;
script.async = true;
script.onload = () => resolve();
script.onerror = () => reject(new Error(`script_load_failed:${src}`));
script.onerror = () => {
script.remove();
reject(new Error(`script_load_failed:${src}`));
};
document.head.appendChild(script);
});
}
async function appendStylesheetWithFallback(id, href, fallbackName) {
const fallbackHref = resolveWebappAssetPath("", fallbackName);
try {
await appendStylesheetOnce(id, href);
} catch (error) {
if (!fallbackHref || href === fallbackHref) throw error;
await appendStylesheetOnce(id, fallbackHref);
}
}
async function appendScriptWithFallback(id, src, fallbackName) {
const fallbackSrc = resolveWebappAssetPath("", fallbackName);
try {
await appendScriptOnce(id, src);
} catch (error) {
if (!fallbackSrc || src === fallbackSrc) throw error;
await appendScriptOnce(id, fallbackSrc);
}
}
function readAdminBundleApi() {
const bundle = window.SubscriptionWebAppAdmin;
return bundle?.mount ? bundle : null;
@@ -697,8 +724,16 @@
adminBundlePromise = (async () => {
const cssHref = resolveWebappAssetPath(CFG.adminCssAsset, "subscription_webapp_admin.css");
const jsSrc = resolveWebappAssetPath(CFG.adminJsAsset, "subscription_webapp_admin.js");
await appendStylesheetOnce("subscription-webapp-admin-css", cssHref);
await appendScriptOnce("subscription-webapp-admin-js", jsSrc);
await appendStylesheetWithFallback(
"subscription-webapp-admin-css",
cssHref,
"subscription_webapp_admin.css",
);
await appendScriptWithFallback(
"subscription-webapp-admin-js",
jsSrc,
"subscription_webapp_admin.js",
);
const loaded = readAdminBundleApi();
if (!loaded) throw new Error("admin_bundle_missing_mount");
adminBundleApi = loaded;
@@ -1513,7 +1548,9 @@
{user}
{userAgreementUrl}
{userLanguage}
linkTelegramAccount={accountStore.linkTelegramAccount}
showLogout={!telegramMiniAppContext}
linkTelegramAccount={() =>
accountStore.linkTelegramAccount(() => telegramMiniAppInitData)}
logout={accountStore.logout}
{openAdminPanel}
{openExternalLink}