From 4f5935be9b9917a2f33a14d9faa4110770e9025a Mon Sep 17 00:00:00 2001 From: thororen <78185467+thororen1234@users.noreply.github.com> Date: Thu, 24 Sep 2026 16:59:57 -0400 Subject: [PATCH] fix some random destructoring --- .../elementHighlighter.dev/index.tsx | 18 +- src/equicordplugins/fileUpload/settings.tsx | 243 +++++++++--------- .../musicControls/settings.tsx | 12 +- src/equicordplugins/randomVoice/index.tsx | 46 ++-- .../richPresence/services/jellyfin.ts | 41 ++- .../streamingCodecDisabler/index.ts | 11 +- 6 files changed, 175 insertions(+), 196 deletions(-) diff --git a/src/equicordplugins/elementHighlighter.dev/index.tsx b/src/equicordplugins/elementHighlighter.dev/index.tsx index c466b1449..ecea642f2 100644 --- a/src/equicordplugins/elementHighlighter.dev/index.tsx +++ b/src/equicordplugins/elementHighlighter.dev/index.tsx @@ -227,14 +227,12 @@ function buildTooltipContent(el: Element, computed: CSSStyleDeclaration, rect: D html += `
${colorVar}
`; html += `
${hex}
`; - const { store } = settings; - - if (store.showId) { + if (settings.store.showId) { const { id } = el; if (id) html += `
id: #${id}
`; } - if (store.showClasses) { + if (settings.store.showClasses) { const classes = el.className; if (classes && typeof classes === "string") { const truncated = classes.length > 60 ? classes.slice(0, 60) + "…" : classes; @@ -242,28 +240,28 @@ function buildTooltipContent(el: Element, computed: CSSStyleDeclaration, rect: D } } - if (store.showFont) { + if (settings.store.showFont) { const font = computed.fontFamily.split(",")[0].replace(/["']/g, ""); const size = computed.fontSize; html += `
font: ${font} ${size}
`; } - if (store.showPadding) { + if (settings.store.showPadding) { const padding = formatBoxValue(computed.padding); if (padding) html += `
padding: ${padding}
`; } - if (store.showMargin) { + if (settings.store.showMargin) { const margin = formatBoxValue(computed.margin); if (margin) html += `
margin: ${margin}
`; } - if (store.showBorderRadius) { + if (settings.store.showBorderRadius) { const radius = formatBoxValue(computed.borderRadius); if (radius) html += `
radius: ${radius}
`; } - if (store.showPosition) { + if (settings.store.showPosition) { const pos = computed.position; if (pos !== "static") { const zIndex = computed.zIndex !== "auto" ? ` z:${computed.zIndex}` : ""; @@ -271,7 +269,7 @@ function buildTooltipContent(el: Element, computed: CSSStyleDeclaration, rect: D } } - if (store.showDisplay) { + if (settings.store.showDisplay) { const { display } = computed; let extra = ""; if (display === "flex" || display === "inline-flex") { diff --git a/src/equicordplugins/fileUpload/settings.tsx b/src/equicordplugins/fileUpload/settings.tsx index f59247958..74643650e 100644 --- a/src/equicordplugins/fileUpload/settings.tsx +++ b/src/equicordplugins/fileUpload/settings.tsx @@ -449,10 +449,9 @@ function ServicePicker(props: { function FallbackOrderSettings() { const update = useForceUpdater(); - const { store } = settings; const [dragIndex, setDragIndex] = React.useState(null); const [order, setOrder] = React.useState(() => { - const configured = (store.fallbackOrder || defaultFallbackOrder) + const configured = (settings.store.fallbackOrder || defaultFallbackOrder) .split(/[\n,]/) .map(entry => entry.trim()) .filter((entry): entry is ServiceType => Object.values(ServiceType).includes(entry as ServiceType)); @@ -464,7 +463,7 @@ function FallbackOrderSettings() { const commitOrder = (nextOrder: ServiceType[]) => { setOrder(nextOrder); - store.fallbackOrder = nextOrder.join(","); + settings.store.fallbackOrder = nextOrder.join(","); update(); }; @@ -515,24 +514,12 @@ function FallbackOrderSettings() { export function SettingsComponent() { const update = useForceUpdater(); - const { store } = settings; const sharexFileInputRef = React.useRef(null); - const isNest = store.serviceType === ServiceType.NEST; - const isEzHost = store.serviceType === ServiceType.EZHOST; - const isEncryptingHost = store.serviceType === ServiceType.ENCRYPTINGHOST; - const isS3 = store.serviceType === ServiceType.S3; - const isZipline = store.serviceType === ServiceType.ZIPLINE; - const isCatbox = store.serviceType === ServiceType.CATBOX; - const isLitterbox = store.serviceType === ServiceType.LITTERBOX; - const isGofile = store.serviceType === ServiceType.GOFILE; - const isPixelVault = store.serviceType === ServiceType.PIXELVAULT; - const isPixelDrain = store.serviceType === ServiceType.PIXELDRAIN; - const isShareX = store.serviceType === ServiceType.SHAREX; - const isWebdav = store.serviceType === ServiceType.WEBDAV; + const { serviceType } = settings.store; const validateShareXConfig = () => { try { - parseShareXConfig(store.sharexConfig || ""); + parseShareXConfig(settings.store.sharexConfig || ""); showToast("ShareX config is valid", Toasts.Type.SUCCESS); } catch (error) { const message = error instanceof Error ? error.message : "Invalid ShareX config"; @@ -553,7 +540,7 @@ export function SettingsComponent() { try { const content = String(e.target?.result || ""); const parsed = parseShareXConfig(content); - store.sharexConfig = JSON.stringify(parsed, null, 2); + settings.store.sharexConfig = JSON.stringify(parsed, null, 2); update(); showToast("Imported ShareX config", Toasts.Type.SUCCESS); } catch (error) { @@ -569,79 +556,79 @@ export function SettingsComponent() { <> { - store.serviceType = service; + settings.store.serviceType = service; update(); }} /> - {isZipline && ( + {serviceType === ServiceType.ZIPLINE && ( store.serviceUrl = v} + value={settings.store.serviceUrl} + onChange={v => settings.store.serviceUrl = v} placeholder="https://your-zipline-instance.com" /> store.ziplineToken = v} + value={settings.store.ziplineToken} + onChange={v => settings.store.ziplineToken = v} placeholder="Your Zipline API token" /> store.folderId = v} + value={settings.store.folderId} + onChange={v => settings.store.folderId = v} placeholder="Leave empty for no folder" /> )} - {isEzHost && ( + {serviceType === ServiceType.EZHOST && ( store.ezHostKey = v} + value={settings.store.ezHostKey} + onChange={v => settings.store.ezHostKey = v} placeholder="Your E-Z Host API key" /> )} - {isNest && ( + {serviceType === ServiceType.NEST && ( store.nestToken = v} + value={settings.store.nestToken} + onChange={v => settings.store.nestToken = v} placeholder="Your Nest API token" /> )} - {isEncryptingHost && ( + {serviceType === ServiceType.ENCRYPTINGHOST && ( (store as { encryptingHostKey?: string; }).encryptingHostKey = v} + value={(settings.store as { encryptingHostKey?: string; }).encryptingHostKey || ""} + onChange={v => (settings.store as { encryptingHostKey?: string; }).encryptingHostKey = v} placeholder="Your Encrypting.host API key" />