chore: fix frontend formatting checks
This commit is contained in:
@@ -487,7 +487,9 @@
|
|||||||
|
|
||||||
function canUseInstallGuides(settings = appSettings, sub = subscription) {
|
function canUseInstallGuides(settings = appSettings, sub = subscription) {
|
||||||
const enabled =
|
const enabled =
|
||||||
settings === appSettings ? installGuidesEnabled : Boolean(settings?.subscription_guides_enabled);
|
settings === appSettings
|
||||||
|
? installGuidesEnabled
|
||||||
|
: Boolean(settings?.subscription_guides_enabled);
|
||||||
return Boolean(enabled && sub?.active);
|
return Boolean(enabled && sub?.active);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,12 +729,12 @@
|
|||||||
await appendStylesheetWithFallback(
|
await appendStylesheetWithFallback(
|
||||||
"subscription-webapp-admin-css",
|
"subscription-webapp-admin-css",
|
||||||
cssHref,
|
cssHref,
|
||||||
"subscription_webapp_admin.css",
|
"subscription_webapp_admin.css"
|
||||||
);
|
);
|
||||||
await appendScriptWithFallback(
|
await appendScriptWithFallback(
|
||||||
"subscription-webapp-admin-js",
|
"subscription-webapp-admin-js",
|
||||||
jsSrc,
|
jsSrc,
|
||||||
"subscription_webapp_admin.js",
|
"subscription_webapp_admin.js"
|
||||||
);
|
);
|
||||||
const loaded = readAdminBundleApi();
|
const loaded = readAdminBundleApi();
|
||||||
if (!loaded) throw new Error("admin_bundle_missing_mount");
|
if (!loaded) throw new Error("admin_bundle_missing_mount");
|
||||||
@@ -1408,7 +1410,9 @@
|
|||||||
{currentLang}
|
{currentLang}
|
||||||
telegramPlatform={tg?.platform || ""}
|
telegramPlatform={tg?.platform || ""}
|
||||||
user={{}}
|
user={{}}
|
||||||
subscription={publicInstallSubscription || { install_share_token: publicInstallToken }}
|
subscription={publicInstallSubscription || {
|
||||||
|
install_share_token: publicInstallToken,
|
||||||
|
}}
|
||||||
{goHome}
|
{goHome}
|
||||||
openConnectLink={openPublicConnectLink}
|
openConnectLink={openPublicConnectLink}
|
||||||
{openExternalLink}
|
{openExternalLink}
|
||||||
|
|||||||
@@ -285,7 +285,9 @@
|
|||||||
|
|
||||||
function fieldPlaceholderText(field) {
|
function fieldPlaceholderText(field) {
|
||||||
const fallback = field.placeholder || "";
|
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) {
|
function subsectionTitle(group) {
|
||||||
|
|||||||
@@ -73,9 +73,12 @@ const INSTALL_GUIDES_CONFIG = {
|
|||||||
svgLibrary: {
|
svgLibrary: {
|
||||||
App: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="5" y="3" width="14" height="18" rx="3"/><path d="M9 7h6M9 17h6"/></svg>',
|
App: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="5" y="3" width="14" height="18" rx="3"/><path d="M9 7h6M9 17h6"/></svg>',
|
||||||
Copy: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="8" y="8" width="10" height="10" rx="2"/><path d="M6 16H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',
|
Copy: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="8" y="8" width="10" height="10" rx="2"/><path d="M6 16H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',
|
||||||
Desktop: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg>',
|
Desktop:
|
||||||
Download: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M5 21h14"/></svg>',
|
'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg>',
|
||||||
Phone: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="7" y="2" width="10" height="20" rx="2"/><path d="M11 18h2"/></svg>',
|
Download:
|
||||||
|
'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M5 21h14"/></svg>',
|
||||||
|
Phone:
|
||||||
|
'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"><rect x="7" y="2" width="10" height="20" rx="2"/><path d="M11 18h2"/></svg>',
|
||||||
},
|
},
|
||||||
platforms: {
|
platforms: {
|
||||||
ios: {
|
ios: {
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ export function sectionFromPath(pathname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function publicInstallTokenFromPath(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);
|
const match = normalized.match(/^\/s\/([a-f0-9]{32})$/i);
|
||||||
return match ? match[1].toLowerCase() : "";
|
return match ? match[1].toLowerCase() : "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,11 @@
|
|||||||
$: if (platforms.length && !selectedPlatformKey) {
|
$: if (platforms.length && !selectedPlatformKey) {
|
||||||
selectedPlatformKey = detectedPlatformKey || platforms[0].key;
|
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;
|
selectedPlatformKey = platforms[0].key;
|
||||||
}
|
}
|
||||||
$: selectedPlatform =
|
$: selectedPlatform =
|
||||||
@@ -92,7 +96,10 @@
|
|||||||
$: selectedApp = apps[selectedAppIndex] || apps[0] || null;
|
$: selectedApp = apps[selectedAppIndex] || apps[0] || null;
|
||||||
$: guideSubscription = guideState?.subscription || subscription || {};
|
$: guideSubscription = guideState?.subscription || subscription || {};
|
||||||
$: finalSubscriptionLink =
|
$: 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 || "";
|
$: shareUrl = guideSubscription?.share_url || subscription?.install_share_url || "";
|
||||||
$: if (finalSubscriptionLink !== lastQrValue) {
|
$: if (finalSubscriptionLink !== lastQrValue) {
|
||||||
lastQrValue = finalSubscriptionLink;
|
lastQrValue = finalSubscriptionLink;
|
||||||
@@ -102,7 +109,9 @@
|
|||||||
function localized(value, fallback = "") {
|
function localized(value, fallback = "") {
|
||||||
if (typeof value === "string") return value;
|
if (typeof value === "string") return value;
|
||||||
if (!value || typeof value !== "object") return fallback;
|
if (!value || typeof value !== "object") return fallback;
|
||||||
const lang = String(currentLang || "ru").split("-")[0].toLowerCase();
|
const lang = String(currentLang || "ru")
|
||||||
|
.split("-")[0]
|
||||||
|
.toLowerCase();
|
||||||
return (
|
return (
|
||||||
value[lang] ||
|
value[lang] ||
|
||||||
value.ru ||
|
value.ru ||
|
||||||
@@ -153,7 +162,8 @@
|
|||||||
if (userAgentDataPlatform.includes("linux")) candidates.push("linux");
|
if (userAgentDataPlatform.includes("linux")) candidates.push("linux");
|
||||||
|
|
||||||
if (ua.includes("apple tv")) candidates.push("appleTV");
|
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 (/iphone|ipad|ipod/.test(ua)) candidates.push("ios");
|
||||||
if (ua.includes("android")) candidates.push("android");
|
if (ua.includes("android")) candidates.push("android");
|
||||||
if (ua.includes("windows")) candidates.push("windows");
|
if (ua.includes("windows")) candidates.push("windows");
|
||||||
@@ -182,7 +192,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isUnsafeUrl(value) {
|
function isUnsafeUrl(value) {
|
||||||
const url = String(value || "").trim().toLowerCase();
|
const url = String(value || "")
|
||||||
|
.trim()
|
||||||
|
.toLowerCase();
|
||||||
return !url || hasControlChars(url) || /^(javascript|data|vbscript):/.test(url);
|
return !url || hasControlChars(url) || /^(javascript|data|vbscript):/.test(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +288,12 @@
|
|||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
<div>
|
<div>
|
||||||
<h1>{localized(config?.baseTranslations?.installationGuideHeader, t("wa_install_title", {}, "Install"))}</h1>
|
<h1>
|
||||||
|
{localized(
|
||||||
|
config?.baseTranslations?.installationGuideHeader,
|
||||||
|
t("wa_install_title", {}, "Install")
|
||||||
|
)}
|
||||||
|
</h1>
|
||||||
<p>{t("wa_install_subtitle", {}, "Choose your platform and app.")}</p>
|
<p>{t("wa_install_subtitle", {}, "Choose your platform and app.")}</p>
|
||||||
</div>
|
</div>
|
||||||
{#if guideState?.enabled && config && platforms.length}
|
{#if guideState?.enabled && config && platforms.length}
|
||||||
@@ -295,7 +312,9 @@
|
|||||||
{#if selectedPlatform}
|
{#if selectedPlatform}
|
||||||
{@const SelectedFallbackIcon = platformFallbackIcon(selectedPlatform.key)}
|
{@const SelectedFallbackIcon = platformFallbackIcon(selectedPlatform.key)}
|
||||||
{#if iconSvg(selectedPlatform.svgIconKey)}
|
{#if iconSvg(selectedPlatform.svgIconKey)}
|
||||||
<span class="install-svg" aria-hidden="true">{@html iconSvg(selectedPlatform.svgIconKey)}</span>
|
<span class="install-svg" aria-hidden="true"
|
||||||
|
>{@html iconSvg(selectedPlatform.svgIconKey)}</span
|
||||||
|
>
|
||||||
{:else}
|
{:else}
|
||||||
<svelte:component this={SelectedFallbackIcon} size={19} />
|
<svelte:component this={SelectedFallbackIcon} size={19} />
|
||||||
{/if}
|
{/if}
|
||||||
@@ -304,7 +323,12 @@
|
|||||||
</span>
|
</span>
|
||||||
<ChevronsUpDown size={16} />
|
<ChevronsUpDown size={16} />
|
||||||
</Select.Trigger>
|
</Select.Trigger>
|
||||||
<Select.Content class="install-platform-content" side="bottom" align="start" sideOffset={6}>
|
<Select.Content
|
||||||
|
class="install-platform-content"
|
||||||
|
side="bottom"
|
||||||
|
align="start"
|
||||||
|
sideOffset={6}
|
||||||
|
>
|
||||||
<Select.Viewport class="install-platform-viewport">
|
<Select.Viewport class="install-platform-viewport">
|
||||||
{#each platforms as platform}
|
{#each platforms as platform}
|
||||||
{@const PlatformFallbackIcon = platformFallbackIcon(platform.key)}
|
{@const PlatformFallbackIcon = platformFallbackIcon(platform.key)}
|
||||||
@@ -315,7 +339,9 @@
|
|||||||
>
|
>
|
||||||
<span class="install-platform-item-main">
|
<span class="install-platform-item-main">
|
||||||
{#if iconSvg(platform.svgIconKey)}
|
{#if iconSvg(platform.svgIconKey)}
|
||||||
<span class="install-svg" aria-hidden="true">{@html iconSvg(platform.svgIconKey)}</span>
|
<span class="install-svg" aria-hidden="true"
|
||||||
|
>{@html iconSvg(platform.svgIconKey)}</span
|
||||||
|
>
|
||||||
{:else}
|
{:else}
|
||||||
<svelte:component this={PlatformFallbackIcon} size={18} />
|
<svelte:component this={PlatformFallbackIcon} size={18} />
|
||||||
{/if}
|
{/if}
|
||||||
@@ -349,7 +375,6 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</Card>
|
</Card>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
||||||
{#key selectedPlatformKey}
|
{#key selectedPlatformKey}
|
||||||
{#if apps.length > 1}
|
{#if apps.length > 1}
|
||||||
<section
|
<section
|
||||||
@@ -384,7 +409,8 @@
|
|||||||
<AttentionDot class="install-feature-star" />
|
<AttentionDot class="install-feature-star" />
|
||||||
{/if}
|
{/if}
|
||||||
{#if iconSvg(app.svgIconKey)}
|
{#if iconSvg(app.svgIconKey)}
|
||||||
<span class="install-svg" aria-hidden="true">{@html iconSvg(app.svgIconKey)}</span>
|
<span class="install-svg" aria-hidden="true">{@html iconSvg(app.svgIconKey)}</span
|
||||||
|
>
|
||||||
{/if}
|
{/if}
|
||||||
<span>{app.name}</span>
|
<span>{app.name}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -412,7 +438,11 @@
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Card class="install-step">
|
<Card class="install-step">
|
||||||
<div class="install-step-icon" style={iconColorStyle(block.svgIconColor)} aria-hidden="true">
|
<div
|
||||||
|
class="install-step-icon"
|
||||||
|
style={iconColorStyle(block.svgIconColor)}
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
{#if iconSvg(block.svgIconKey)}
|
{#if iconSvg(block.svgIconKey)}
|
||||||
{@html iconSvg(block.svgIconKey)}
|
{@html iconSvg(block.svgIconKey)}
|
||||||
{:else}
|
{:else}
|
||||||
@@ -446,11 +476,7 @@
|
|||||||
</section>
|
</section>
|
||||||
{/key}
|
{/key}
|
||||||
{#if finalSubscriptionLink && !publicMode}
|
{#if finalSubscriptionLink && !publicMode}
|
||||||
<div
|
<div class="install-qr-divider" aria-hidden="true" in:fade={{ duration: 180 }}>
|
||||||
class="install-qr-divider"
|
|
||||||
aria-hidden="true"
|
|
||||||
in:fade={{ duration: 180 }}
|
|
||||||
>
|
|
||||||
<svg viewBox="0 0 240 18" preserveAspectRatio="none">
|
<svg viewBox="0 0 240 18" preserveAspectRatio="none">
|
||||||
<path
|
<path
|
||||||
d="M0 9 Q 4 2 8 9 T 16 9 T 24 9 T 32 9 T 40 9 T 48 9 T 56 9 T 64 9 T 72 9 T 80 9 T 88 9 T 96 9 T 104 9 T 112 9 T 120 9 T 128 9 T 136 9 T 144 9 T 152 9 T 160 9 T 168 9 T 176 9 T 184 9 T 192 9 T 200 9 T 208 9 T 216 9 T 224 9 T 232 9 T 240 9"
|
d="M0 9 Q 4 2 8 9 T 16 9 T 24 9 T 32 9 T 40 9 T 48 9 T 56 9 T 64 9 T 72 9 T 80 9 T 88 9 T 96 9 T 104 9 T 112 9 T 120 9 T 128 9 T 136 9 T 144 9 T 152 9 T 160 9 T 168 9 T 176 9 T 184 9 T 192 9 T 200 9 T 208 9 T 216 9 T 224 9 T 232 9 T 240 9"
|
||||||
@@ -468,12 +494,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="install-subscription-heading">
|
<div class="install-subscription-heading">
|
||||||
<h2>{t("wa_install_subscription_link", {}, "Subscription link")}</h2>
|
<h2>{t("wa_install_subscription_link", {}, "Subscription link")}</h2>
|
||||||
<p>{t("wa_install_subscription_link_hint", {}, "Scan the QR code or copy the link.")}</p>
|
<p>
|
||||||
|
{t("wa_install_subscription_link_hint", {}, "Scan the QR code or copy the link.")}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="install-subscription-body">
|
<div class="install-subscription-body">
|
||||||
{#if qrDataUrl}
|
{#if qrDataUrl}
|
||||||
<div class="install-qr-wrap" in:scale={{ start: 0.96, duration: 180, easing: cubicOut }}>
|
<div
|
||||||
|
class="install-qr-wrap"
|
||||||
|
in:scale={{ start: 0.96, duration: 180, easing: cubicOut }}
|
||||||
|
>
|
||||||
<img src={qrDataUrl} alt={t("wa_install_qr_alt", {}, "Subscription QR code")} />
|
<img src={qrDataUrl} alt={t("wa_install_qr_alt", {}, "Subscription QR code")} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user