From fbc3e6c0841f84682c74bb4f54b1cd3ffd9b5301 Mon Sep 17 00:00:00 2001 From: 3252a8 <3252a8@proton.me> Date: Sat, 23 May 2026 16:00:27 +0300 Subject: [PATCH] chore: fix frontend formatting checks --- frontend/src/App.svelte | 12 +- .../src/admin/sections/SettingsSection.svelte | 4 +- frontend/src/lib/webapp/previewMock.js | 9 +- frontend/src/lib/webapp/routes.js | 4 +- .../webapp/screens/InstallGuideScreen.svelte | 151 +++++++++++------- 5 files changed, 111 insertions(+), 69 deletions(-) diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index cbfdc88..75a922a 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -487,7 +487,9 @@ function canUseInstallGuides(settings = appSettings, sub = subscription) { const enabled = - settings === appSettings ? installGuidesEnabled : Boolean(settings?.subscription_guides_enabled); + settings === appSettings + ? installGuidesEnabled + : Boolean(settings?.subscription_guides_enabled); return Boolean(enabled && sub?.active); } @@ -727,12 +729,12 @@ await appendStylesheetWithFallback( "subscription-webapp-admin-css", cssHref, - "subscription_webapp_admin.css", + "subscription_webapp_admin.css" ); await appendScriptWithFallback( "subscription-webapp-admin-js", jsSrc, - "subscription_webapp_admin.js", + "subscription_webapp_admin.js" ); const loaded = readAdminBundleApi(); if (!loaded) throw new Error("admin_bundle_missing_mount"); @@ -1408,7 +1410,9 @@ {currentLang} telegramPlatform={tg?.platform || ""} user={{}} - subscription={publicInstallSubscription || { install_share_token: publicInstallToken }} + subscription={publicInstallSubscription || { + install_share_token: publicInstallToken, + }} {goHome} openConnectLink={openPublicConnectLink} {openExternalLink} diff --git a/frontend/src/admin/sections/SettingsSection.svelte b/frontend/src/admin/sections/SettingsSection.svelte index aec1f18..ff8c587 100644 --- a/frontend/src/admin/sections/SettingsSection.svelte +++ b/frontend/src/admin/sections/SettingsSection.svelte @@ -285,7 +285,9 @@ function fieldPlaceholderText(field) { const fallback = field.placeholder || ""; - return field.i18n_placeholder_key ? adminText(field.i18n_placeholder_key, {}, fallback) : fallback; + return field.i18n_placeholder_key + ? adminText(field.i18n_placeholder_key, {}, fallback) + : fallback; } function subsectionTitle(group) { diff --git a/frontend/src/lib/webapp/previewMock.js b/frontend/src/lib/webapp/previewMock.js index dc9299c..d758af7 100644 --- a/frontend/src/lib/webapp/previewMock.js +++ b/frontend/src/lib/webapp/previewMock.js @@ -73,9 +73,12 @@ const INSTALL_GUIDES_CONFIG = { svgLibrary: { App: '', Copy: '', - Desktop: '', - Download: '', - Phone: '', + Desktop: + '', + Download: + '', + Phone: + '', }, platforms: { ios: { diff --git a/frontend/src/lib/webapp/routes.js b/frontend/src/lib/webapp/routes.js index 1f6846e..44155c6 100644 --- a/frontend/src/lib/webapp/routes.js +++ b/frontend/src/lib/webapp/routes.js @@ -30,7 +30,9 @@ export function sectionFromPath(pathname) { } export function publicInstallTokenFromPath(pathname) { - const normalized = String(pathname || "").trim().replace(/\/+$/, ""); + const normalized = String(pathname || "") + .trim() + .replace(/\/+$/, ""); const match = normalized.match(/^\/s\/([a-f0-9]{32})$/i); return match ? match[1].toLowerCase() : ""; } diff --git a/frontend/src/webapp/screens/InstallGuideScreen.svelte b/frontend/src/webapp/screens/InstallGuideScreen.svelte index bfa924f..673c3ef 100644 --- a/frontend/src/webapp/screens/InstallGuideScreen.svelte +++ b/frontend/src/webapp/screens/InstallGuideScreen.svelte @@ -79,7 +79,11 @@ $: if (platforms.length && !selectedPlatformKey) { selectedPlatformKey = detectedPlatformKey || platforms[0].key; } - $: if (selectedPlatformKey && platforms.length && !platforms.some((p) => p.key === selectedPlatformKey)) { + $: if ( + selectedPlatformKey && + platforms.length && + !platforms.some((p) => p.key === selectedPlatformKey) + ) { selectedPlatformKey = platforms[0].key; } $: selectedPlatform = @@ -92,7 +96,10 @@ $: selectedApp = apps[selectedAppIndex] || apps[0] || null; $: guideSubscription = guideState?.subscription || subscription || {}; $: finalSubscriptionLink = - guideSubscription?.config_link || guideSubscription?.connect_url || subscription?.config_link || ""; + guideSubscription?.config_link || + guideSubscription?.connect_url || + subscription?.config_link || + ""; $: shareUrl = guideSubscription?.share_url || subscription?.install_share_url || ""; $: if (finalSubscriptionLink !== lastQrValue) { lastQrValue = finalSubscriptionLink; @@ -102,7 +109,9 @@ function localized(value, fallback = "") { if (typeof value === "string") return value; if (!value || typeof value !== "object") return fallback; - const lang = String(currentLang || "ru").split("-")[0].toLowerCase(); + const lang = String(currentLang || "ru") + .split("-")[0] + .toLowerCase(); return ( value[lang] || value.ru || @@ -153,7 +162,8 @@ if (userAgentDataPlatform.includes("linux")) candidates.push("linux"); if (ua.includes("apple tv")) candidates.push("appleTV"); - if (ua.includes("android") && /\btv\b|aft|bravia|shield/i.test(ua)) candidates.push("androidTV"); + if (ua.includes("android") && /\btv\b|aft|bravia|shield/i.test(ua)) + candidates.push("androidTV"); if (/iphone|ipad|ipod/.test(ua)) candidates.push("ios"); if (ua.includes("android")) candidates.push("android"); if (ua.includes("windows")) candidates.push("windows"); @@ -182,7 +192,9 @@ } function isUnsafeUrl(value) { - const url = String(value || "").trim().toLowerCase(); + const url = String(value || "") + .trim() + .toLowerCase(); return !url || hasControlChars(url) || /^(javascript|data|vbscript):/.test(url); } @@ -276,57 +288,71 @@ {/if}
-

{localized(config?.baseTranslations?.installationGuideHeader, t("wa_install_title", {}, "Install"))}

+

+ {localized( + config?.baseTranslations?.installationGuideHeader, + t("wa_install_title", {}, "Install") + )} +

{t("wa_install_subtitle", {}, "Choose your platform and app.")}

{#if guideState?.enabled && config && platforms.length}
- - - - {#if selectedPlatform} - {@const SelectedFallbackIcon = platformFallbackIcon(selectedPlatform.key)} - {#if iconSvg(selectedPlatform.svgIconKey)} - - {:else} - + + + {#if selectedPlatform} + {@const SelectedFallbackIcon = platformFallbackIcon(selectedPlatform.key)} + {#if iconSvg(selectedPlatform.svgIconKey)} + + {:else} + + {/if} {/if} - {/if} - {selectedPlatformLabel} - - - - - - {#each platforms as platform} - {@const PlatformFallbackIcon = platformFallbackIcon(platform.key)} - - - {#if iconSvg(platform.svgIconKey)} - - {:else} - - {/if} - {localized(platform.displayName, platform.key)} - - - - {/each} - - - + {selectedPlatformLabel} + + + + + + {#each platforms as platform} + {@const PlatformFallbackIcon = platformFallbackIcon(platform.key)} + + + {#if iconSvg(platform.svgIconKey)} + + {:else} + + {/if} + {localized(platform.displayName, platform.key)} + + + + {/each} + + +
{/if} @@ -349,7 +375,6 @@ {:else} - {#key selectedPlatformKey} {#if apps.length > 1}
{/if} {#if iconSvg(app.svgIconKey)} - + {/if} {app.name} @@ -412,7 +438,11 @@ }} > -
{/key} {#if finalSubscriptionLink && !publicMode} -