mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-26 03:46:25 -08:00
Improve theme loading disclaimers and chat preview setting options
This commit is contained in:
7 files changed
+252
-42
No files matched your search
@@ -71,6 +71,10 @@ const getMediaType = (url: string) => {
|
||||
return null;
|
||||
};
|
||||
|
||||
const isSableChatEmbedCandidate = (url: string): boolean =>
|
||||
/^https:\/\//i.test(url) &&
|
||||
(/\.preview\.sable\.css(\?|#|$)/i.test(url) || isHttpsFullSableCssUrl(url));
|
||||
|
||||
const CAPTION_STYLE = { marginTop: config.space.S200 };
|
||||
|
||||
function RenderMessageContentInternal({
|
||||
@@ -93,7 +97,7 @@ function RenderMessageContentInternal({
|
||||
|
||||
const [autoplayGifs] = useSetting(settingsAtom, 'autoplayGifs');
|
||||
const [captionPosition] = useSetting(settingsAtom, 'captionPosition');
|
||||
const [themeChatAny] = useSetting(settingsAtom, 'themeChatPreviewAnyUrl');
|
||||
const [themeChatSableWidgets] = useSetting(settingsAtom, 'themeChatSableWidgetsEnabled');
|
||||
const [multiplePreviews] = useSetting(settingsAtom, 'multiplePreviews');
|
||||
const settingsLinkBaseUrl = useSettingsLinkBaseUrl();
|
||||
const captionPositionMap = {
|
||||
@@ -124,12 +128,14 @@ function RenderMessageContentInternal({
|
||||
);
|
||||
if (filteredUrls.length === 0) return undefined;
|
||||
|
||||
const themePreviewUrls = themeChatAny
|
||||
? filteredUrls.filter((u) => /\.preview\.sable\.css(\?|#|$)/i.test(u))
|
||||
const themePreviewUrls = themeChatSableWidgets
|
||||
? filteredUrls.filter(
|
||||
(u) => /^https:\/\//i.test(u) && /\.preview\.sable\.css(\?|#|$)/i.test(u)
|
||||
)
|
||||
: [];
|
||||
const themeToRender = themePreviewUrls.filter((u) => /^https:\/\//i.test(u));
|
||||
|
||||
const tweakCandidateUrls = themeChatAny
|
||||
const tweakCandidateUrls = themeChatSableWidgets
|
||||
? filteredUrls.filter((u) => isHttpsFullSableCssUrl(u))
|
||||
: [];
|
||||
|
||||
@@ -155,6 +161,7 @@ function RenderMessageContentInternal({
|
||||
if (type) {
|
||||
return <UrlPreviewCard urlPreview key={url} url={url} ts={ts} mediaType={type} />;
|
||||
}
|
||||
if (!themeChatSableWidgets && isSableChatEmbedCandidate(url)) return null;
|
||||
if (clientUrlPreview && youtubeUrl(url)) {
|
||||
return <ClientPreview key={url} url={url} />;
|
||||
}
|
||||
@@ -166,7 +173,7 @@ function RenderMessageContentInternal({
|
||||
</UrlPreviewHolder>
|
||||
);
|
||||
},
|
||||
[multiplePreviews, themeChatAny, settingsLinkBaseUrl, clientUrlPreview, urlPreview, ts]
|
||||
[multiplePreviews, themeChatSableWidgets, settingsLinkBaseUrl, clientUrlPreview, urlPreview, ts]
|
||||
);
|
||||
const renderBundledPreviews = useCallback(
|
||||
(bundles: IPreviewUrlResponse[]) => (
|
||||
@@ -183,7 +190,7 @@ function RenderMessageContentInternal({
|
||||
),
|
||||
[urlPreview]
|
||||
);
|
||||
const messageUrlsPreview = urlPreview || themeChatAny ? renderUrlsPreview : undefined;
|
||||
const messageUrlsPreview = urlPreview || themeChatSableWidgets ? renderUrlsPreview : undefined;
|
||||
const messageBundlePreview = bundledPreview ? renderBundledPreviews : undefined;
|
||||
|
||||
const renderCaption = () => {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import { Box, Button, Text, config, toRem } from 'folds';
|
||||
|
||||
import { ThemeThirdPartyBanner } from './ThemeThirdPartyBanner';
|
||||
|
||||
export type SableChatPreviewPlaceholderProps = {
|
||||
kind: 'theme' | 'tweak';
|
||||
url: string;
|
||||
hostLabel: string;
|
||||
isApprovedHost: boolean;
|
||||
onLoadPreview: () => void;
|
||||
};
|
||||
|
||||
export function SableChatPreviewPlaceholder({
|
||||
kind,
|
||||
url,
|
||||
hostLabel,
|
||||
isApprovedHost,
|
||||
onLoadPreview,
|
||||
}: SableChatPreviewPlaceholderProps) {
|
||||
const title = kind === 'theme' ? 'Theme preview' : 'Tweak preview';
|
||||
const bodyApproved =
|
||||
kind === 'theme'
|
||||
? 'This message links to a catalog theme preview. Nothing is fetched until you load it.'
|
||||
: 'This message links to a catalog tweak. Nothing is fetched until you load it.';
|
||||
const bodyThirdParty =
|
||||
kind === 'theme'
|
||||
? 'This message links to third-party theme CSS. Nothing is fetched until you confirm. Only load previews you trust.'
|
||||
: 'This message links to third-party tweak CSS. Nothing is fetched until you confirm. Only load previews you trust.';
|
||||
|
||||
return (
|
||||
<Box
|
||||
direction="Column"
|
||||
gap="300"
|
||||
style={{
|
||||
width: '400px',
|
||||
maxWidth: '100%',
|
||||
flexShrink: 0,
|
||||
boxSizing: 'border-box',
|
||||
padding: toRem(12),
|
||||
borderRadius: config.radii.R300,
|
||||
border: `${toRem(1)} solid var(--sable-surface-container-line)`,
|
||||
background: 'var(--sable-surface-container)',
|
||||
}}
|
||||
>
|
||||
<Box direction="Column" gap="100" style={{ minWidth: 0 }}>
|
||||
<Text size="H6">{title}</Text>
|
||||
{!isApprovedHost ? <ThemeThirdPartyBanner kind={kind} hostLabel={hostLabel} /> : null}
|
||||
<Text size="T200" priority="300" style={{ wordBreak: 'break-word' }}>
|
||||
{isApprovedHost ? bodyApproved : bodyThirdParty}
|
||||
</Text>
|
||||
<Text size="T200" priority="300">
|
||||
{isApprovedHost ? 'Official catalog' : hostLabel}
|
||||
</Text>
|
||||
<Text
|
||||
size="T200"
|
||||
priority="300"
|
||||
style={{
|
||||
wordBreak: 'break-all',
|
||||
fontFamily: 'monospace',
|
||||
opacity: 0.85,
|
||||
}}
|
||||
>
|
||||
{url}
|
||||
</Text>
|
||||
</Box>
|
||||
<Button variant="Primary" fill="Soft" outlined size="300" radii="300" onClick={onLoadPreview}>
|
||||
<Text size="B300">Load preview</Text>
|
||||
</Button>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { putCachedThemeCss } from '../../theme/cache';
|
||||
import { fullUrlFromPreviewUrl } from '../../theme/previewUrls';
|
||||
import { isApprovedCatalogHostUrl } from '../../theme/themeApproval';
|
||||
import { ThemePreviewCard } from '../theme/ThemePreviewCard';
|
||||
import { SableChatPreviewPlaceholder } from './SableChatPreviewPlaceholder';
|
||||
import { ThemeThirdPartyBanner } from './ThemeThirdPartyBanner';
|
||||
|
||||
function isHttps(url: string): boolean {
|
||||
@@ -54,22 +55,36 @@ export function ThemePreviewUrlCard({ url }: { url: string }) {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const [chatAny] = useSetting(settingsAtom, 'themeChatPreviewAnyUrl');
|
||||
const [autoPreviewApproved] = useSetting(settingsAtom, 'themeChatAutoPreviewApprovedUrls');
|
||||
const [autoPreviewAny] = useSetting(settingsAtom, 'themeChatAutoPreviewAnyUrl');
|
||||
const [favorites] = useSetting(settingsAtom, 'themeRemoteFavorites');
|
||||
const [systemTheme] = useSetting(settingsAtom, 'useSystemTheme');
|
||||
const [manualRemoteFullUrl] = useSetting(settingsAtom, 'themeRemoteManualFullUrl');
|
||||
const [lightRemoteFullUrl] = useSetting(settingsAtom, 'themeRemoteLightFullUrl');
|
||||
const [darkRemoteFullUrl] = useSetting(settingsAtom, 'themeRemoteDarkFullUrl');
|
||||
|
||||
const allowed = useMemo(() => {
|
||||
if (!chatAny) return false;
|
||||
return isHttps(url) && isPreviewThemeUrl(url);
|
||||
}, [chatAny, url]);
|
||||
const isEligibleUrl = useMemo(() => isHttps(url) && isPreviewThemeUrl(url), [url]);
|
||||
|
||||
const prefixes = clientConfig.themeCatalogApprovedHostPrefixes;
|
||||
|
||||
const isOfficial = useMemo(() => isApprovedCatalogHostUrl(url, prefixes), [prefixes, url]);
|
||||
|
||||
const shouldAutoFetch = useMemo(
|
||||
() => (isOfficial && autoPreviewApproved) || (!isOfficial && autoPreviewAny),
|
||||
[isOfficial, autoPreviewApproved, autoPreviewAny]
|
||||
);
|
||||
|
||||
const [userTriggeredLoad, setUserTriggeredLoad] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setUserTriggeredLoad(false);
|
||||
}, [url]);
|
||||
|
||||
const fetchEnabled = useMemo(
|
||||
() => isEligibleUrl && (shouldAutoFetch || userTriggeredLoad),
|
||||
[isEligibleUrl, shouldAutoFetch, userTriggeredLoad]
|
||||
);
|
||||
|
||||
const showThirdPartyBanner = useMemo(
|
||||
() => !isApprovedCatalogHostUrl(url, prefixes),
|
||||
[prefixes, url]
|
||||
@@ -77,7 +92,7 @@ export function ThemePreviewUrlCard({ url }: { url: string }) {
|
||||
|
||||
const previewQuery = useQuery({
|
||||
queryKey: ['theme-preview-embed', url],
|
||||
enabled: allowed,
|
||||
enabled: fetchEnabled,
|
||||
staleTime: 10 * 60_000,
|
||||
queryFn: async () => {
|
||||
const res = await fetch(url, { mode: 'cors' });
|
||||
@@ -360,7 +375,21 @@ export function ThemePreviewUrlCard({ url }: { url: string }) {
|
||||
store,
|
||||
]);
|
||||
|
||||
if (!allowed) return null;
|
||||
if (!isEligibleUrl) return null;
|
||||
|
||||
if (!shouldAutoFetch && !userTriggeredLoad) {
|
||||
return (
|
||||
<SableChatPreviewPlaceholder
|
||||
kind="theme"
|
||||
url={url}
|
||||
hostLabel={baseLabel(url)}
|
||||
isApprovedHost={isOfficial}
|
||||
onLoadPreview={() => {
|
||||
setUserTriggeredLoad(true);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const title = previewQuery.data?.displayName ?? 'Theme preview';
|
||||
let kindLabel = 'Theme';
|
||||
|
||||
@@ -2,9 +2,17 @@ import { Box, Icon, Icons, Text, toRem, config } from 'folds';
|
||||
|
||||
type ThemeThirdPartyBannerProps = {
|
||||
hostLabel: string;
|
||||
/** Default `theme` for backward compatibility. */
|
||||
kind?: 'theme' | 'tweak';
|
||||
};
|
||||
|
||||
export function ThemeThirdPartyBanner({ hostLabel }: ThemeThirdPartyBannerProps) {
|
||||
export function ThemeThirdPartyBanner({ hostLabel, kind = 'theme' }: ThemeThirdPartyBannerProps) {
|
||||
const title = kind === 'tweak' ? 'Third-party tweak' : 'Third-party theme';
|
||||
const body =
|
||||
kind === 'tweak'
|
||||
? `This tweak is hosted on ${hostLabel}, outside the Sable catalog allowlist. Saving or enabling applies CSS from that host. Only use tweaks from providers you trust.`
|
||||
: `This preview is hosted on ${hostLabel}, outside the Sable catalog allowlist. Saving or applying installs full theme CSS from that host. Only use themes from providers you trust.`;
|
||||
|
||||
return (
|
||||
<Box
|
||||
direction="Column"
|
||||
@@ -21,12 +29,10 @@ export function ThemeThirdPartyBanner({ hostLabel }: ThemeThirdPartyBannerProps)
|
||||
<Icon src={Icons.Warning} size="100" filled />
|
||||
<Box direction="Column" gap="100" grow="Yes" style={{ minWidth: 0 }}>
|
||||
<Text size="T300" style={{ fontWeight: 600 }}>
|
||||
Third-party theme
|
||||
{title}
|
||||
</Text>
|
||||
<Text size="T200" priority="300" style={{ wordBreak: 'break-word' }}>
|
||||
This preview is hosted on {hostLabel}, outside the Sable catalog allowlist. Saving or
|
||||
applying installs full theme CSS from that host. Only use themes from Providers you
|
||||
trust.
|
||||
{body}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import {
|
||||
Box,
|
||||
@@ -25,6 +25,7 @@ import { getSableCssPackageKind, parseSableTweakMetadata } from '../../theme/met
|
||||
import { isHttpsFullSableCssUrl } from '../../theme/previewUrls';
|
||||
import { buildPreviewStyleBlock, extractSafePreviewCustomProperties } from '../../theme/previewCss';
|
||||
import { isApprovedCatalogHostUrl, isThirdPartyThemeUrl } from '../../theme/themeApproval';
|
||||
import { SableChatPreviewPlaceholder } from './SableChatPreviewPlaceholder';
|
||||
import { ThemeThirdPartyBanner } from './ThemeThirdPartyBanner';
|
||||
|
||||
function baseLabel(url: string): string {
|
||||
@@ -73,18 +74,35 @@ export function TweakPreviewUrlCard({ url }: { url: string }) {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const [chatAny] = useSetting(settingsAtom, 'themeChatPreviewAnyUrl');
|
||||
const [autoPreviewApproved] = useSetting(settingsAtom, 'themeChatAutoPreviewApprovedUrls');
|
||||
const [autoPreviewAny] = useSetting(settingsAtom, 'themeChatAutoPreviewAnyUrl');
|
||||
const [tweakFavorites] = useSetting(settingsAtom, 'themeRemoteTweakFavorites');
|
||||
const [enabledTweakFullUrls] = useSetting(settingsAtom, 'themeRemoteEnabledTweakFullUrls');
|
||||
|
||||
const [copied, setCopied] = useTimeoutToggle();
|
||||
|
||||
const allowed = useMemo(() => chatAny && isHttpsFullSableCssUrl(url), [chatAny, url]);
|
||||
const isEligibleUrl = useMemo(() => isHttpsFullSableCssUrl(url), [url]);
|
||||
|
||||
const prefixes = clientConfig.themeCatalogApprovedHostPrefixes;
|
||||
|
||||
const isOfficial = useMemo(() => isApprovedCatalogHostUrl(url, prefixes), [prefixes, url]);
|
||||
|
||||
const shouldAutoFetch = useMemo(
|
||||
() => (isOfficial && autoPreviewApproved) || (!isOfficial && autoPreviewAny),
|
||||
[isOfficial, autoPreviewApproved, autoPreviewAny]
|
||||
);
|
||||
|
||||
const [userTriggeredLoad, setUserTriggeredLoad] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setUserTriggeredLoad(false);
|
||||
}, [url]);
|
||||
|
||||
const fetchEnabled = useMemo(
|
||||
() => isEligibleUrl && (shouldAutoFetch || userTriggeredLoad),
|
||||
[isEligibleUrl, shouldAutoFetch, userTriggeredLoad]
|
||||
);
|
||||
|
||||
const showThirdPartyBanner = useMemo(
|
||||
() => !isApprovedCatalogHostUrl(url, prefixes),
|
||||
[prefixes, url]
|
||||
@@ -92,7 +110,7 @@ export function TweakPreviewUrlCard({ url }: { url: string }) {
|
||||
|
||||
const tweakPreviewQuery = useQuery({
|
||||
queryKey: ['tweak-preview-embed', url],
|
||||
enabled: allowed,
|
||||
enabled: fetchEnabled,
|
||||
staleTime: 10 * 60_000,
|
||||
queryFn: async (): Promise<TweakPreviewData | null> => {
|
||||
const res = await fetch(url, { mode: 'cors' });
|
||||
@@ -187,7 +205,21 @@ export function TweakPreviewUrlCard({ url }: { url: string }) {
|
||||
[data, enabledTweakFullUrls, patchSettings, tweakFavorites, url]
|
||||
);
|
||||
|
||||
if (!allowed) return null;
|
||||
if (!isEligibleUrl) return null;
|
||||
|
||||
if (!shouldAutoFetch && !userTriggeredLoad) {
|
||||
return (
|
||||
<SableChatPreviewPlaceholder
|
||||
kind="tweak"
|
||||
url={url}
|
||||
hostLabel={baseLabel(url)}
|
||||
isApprovedHost={isOfficial}
|
||||
onLoadPreview={() => {
|
||||
setUserTriggeredLoad(true);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (tweakPreviewQuery.isPending) {
|
||||
return (
|
||||
@@ -313,7 +345,9 @@ export function TweakPreviewUrlCard({ url }: { url: string }) {
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{showThirdPartyBanner ? <ThemeThirdPartyBanner hostLabel={baseLabel(url)} /> : undefined}
|
||||
{showThirdPartyBanner ? (
|
||||
<ThemeThirdPartyBanner kind="tweak" hostLabel={baseLabel(url)} />
|
||||
) : undefined}
|
||||
|
||||
{styleBlock ? (
|
||||
<>
|
||||
|
||||
@@ -216,7 +216,18 @@ export function ThemeCatalogSettings({
|
||||
const [manualRemoteFullUrl] = useSetting(settingsAtom, 'themeRemoteManualFullUrl');
|
||||
const [lightRemoteFullUrl] = useSetting(settingsAtom, 'themeRemoteLightFullUrl');
|
||||
const [darkRemoteFullUrl] = useSetting(settingsAtom, 'themeRemoteDarkFullUrl');
|
||||
const [chatAny, setChatAny] = useSetting(settingsAtom, 'themeChatPreviewAnyUrl');
|
||||
const [sableChatWidgets, setSableChatWidgets] = useSetting(
|
||||
settingsAtom,
|
||||
'themeChatSableWidgetsEnabled'
|
||||
);
|
||||
const [autoPreviewApprovedUrls, setAutoPreviewApprovedUrls] = useSetting(
|
||||
settingsAtom,
|
||||
'themeChatAutoPreviewApprovedUrls'
|
||||
);
|
||||
const [autoPreviewAnyUrl, setAutoPreviewAnyUrl] = useSetting(
|
||||
settingsAtom,
|
||||
'themeChatAutoPreviewAnyUrl'
|
||||
);
|
||||
|
||||
const [themeSearch, setThemeSearch] = useState('');
|
||||
const [tweakSearch, setTweakSearch] = useState('');
|
||||
@@ -1410,19 +1421,59 @@ export function ThemeCatalogSettings({
|
||||
)}
|
||||
|
||||
{isChatMode && (
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Theme & tweak previews from URLs"
|
||||
focusId="theme-chat-preview-any"
|
||||
description="When enabled, messages linking to .preview.sable.css may fetch and show theme previews, and links to full .sable.css files with @sable-tweak metadata may show tweak metadata. Third-party CSS is not necessarily safe."
|
||||
after={<Switch variant="Primary" value={chatAny} onChange={setChatAny} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Theme & tweak links in chat"
|
||||
focusId="theme-chat-sable-widgets"
|
||||
description="When disabled, messages do not show theme or tweak cards (or placeholders) for Sable CSS links — only the normal link text."
|
||||
after={
|
||||
<Switch variant="Primary" value={sableChatWidgets} onChange={setSableChatWidgets} />
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Theme & tweak previews from URLs"
|
||||
focusId="theme-chat-auto-approved"
|
||||
description="When enabled, approved catalog hosts automatically fetch and show a preview. When disabled, a “Load preview” control is shown for those links instead (this message only)."
|
||||
after={
|
||||
<Switch
|
||||
variant="Primary"
|
||||
value={autoPreviewApprovedUrls}
|
||||
onChange={setAutoPreviewApprovedUrls}
|
||||
disabled={!sableChatWidgets}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Theme & tweak previews from any URL"
|
||||
focusId="theme-chat-auto-any"
|
||||
description="When enabled, non-catalog (third-party) Sable CSS links also fetch automatically. Strongly discouraged. When disabled, those links never load until you use Load preview on the card."
|
||||
after={
|
||||
<Switch
|
||||
variant="Primary"
|
||||
value={autoPreviewAnyUrl}
|
||||
onChange={setAutoPreviewAnyUrl}
|
||||
disabled={!sableChatWidgets}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{sableChatWidgets && autoPreviewAnyUrl && (
|
||||
<Text size="T200" priority="400" style={{ color: 'var(--sable-warn-on-container)' }}>
|
||||
Third-party CSS can change how Sable looks and may not be safe. Prefer keeping this
|
||||
off and loading previews manually only when you trust the link.
|
||||
</Text>
|
||||
)}
|
||||
</SequenceCard>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -155,8 +155,9 @@ export interface Settings {
|
||||
themeCatalogOnboardingDone: boolean;
|
||||
themeRemoteFavorites: ThemeRemoteFavorite[];
|
||||
themeRemoteCatalogEnabled: boolean;
|
||||
themeChatPreviewAnyUrl: boolean;
|
||||
themeChatPreviewApprovedCatalogOnly: boolean;
|
||||
themeChatSableWidgetsEnabled: boolean;
|
||||
themeChatAutoPreviewApprovedUrls: boolean;
|
||||
themeChatAutoPreviewAnyUrl: boolean;
|
||||
themeRemoteManualFullUrl?: string;
|
||||
themeRemoteLightFullUrl?: string;
|
||||
themeRemoteDarkFullUrl?: string;
|
||||
@@ -271,8 +272,9 @@ export const defaultSettings: Settings = {
|
||||
themeCatalogOnboardingDone: false,
|
||||
themeRemoteFavorites: [],
|
||||
themeRemoteCatalogEnabled: false,
|
||||
themeChatPreviewAnyUrl: false,
|
||||
themeChatPreviewApprovedCatalogOnly: false,
|
||||
themeChatSableWidgetsEnabled: true,
|
||||
themeChatAutoPreviewApprovedUrls: true,
|
||||
themeChatAutoPreviewAnyUrl: false,
|
||||
themeRemoteManualFullUrl: undefined,
|
||||
themeRemoteLightFullUrl: undefined,
|
||||
themeRemoteDarkFullUrl: undefined,
|
||||
@@ -309,6 +311,16 @@ export const getSettings = () => {
|
||||
parsed.renderUserCards = 'both';
|
||||
}
|
||||
|
||||
const parsedRecord = parsed as Record<string, unknown>;
|
||||
if (
|
||||
typeof parsedRecord.themeChatAutoPreviewAnyUrl !== 'boolean' &&
|
||||
typeof parsedRecord.themeChatPreviewAnyUrl === 'boolean'
|
||||
) {
|
||||
parsedRecord.themeChatAutoPreviewAnyUrl = parsedRecord.themeChatPreviewAnyUrl;
|
||||
}
|
||||
delete parsedRecord.themeChatPreviewAnyUrl;
|
||||
delete parsedRecord.themeChatPreviewApprovedCatalogOnly;
|
||||
|
||||
return {
|
||||
...defaultSettings,
|
||||
...(parsed as Settings),
|
||||
|
||||
Reference in new issue
Block a user