From dcb7a593e5741dcedc21a7c1d4ec5f0e01e80e8a Mon Sep 17 00:00:00 2001 From: Sukka Date: Sun, 16 Mar 2025 01:32:14 +0800 Subject: [PATCH 1/2] Replace unpkg with jsDelivr (#3291) --- src/main/index.ts | 2 +- src/utils/dependencies.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 5519d47a..4cc2e0db 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -101,7 +101,7 @@ if (IS_VESKTOP || !IS_VANILLA) { // TODO: Restrict this to only imported packages with fixed version. // Perhaps auto generate with esbuild csp["script-src"] ??= []; - csp["script-src"].push("'unsafe-eval'", "https://unpkg.com", "https://cdnjs.cloudflare.com"); + csp["script-src"].push("'unsafe-eval'", "https://cdn.jsdelivr.net", "https://cdnjs.cloudflare.com"); headers[header] = [stringifyPolicy(csp)]; } }; diff --git a/src/utils/dependencies.ts b/src/utils/dependencies.ts index d8c361e8..6db180a4 100644 --- a/src/utils/dependencies.ts +++ b/src/utils/dependencies.ts @@ -69,8 +69,8 @@ export interface ApngFrameData { // The below code is only used on the Desktop (electron) build of Vencord. // Browser (extension) builds do not contain these remote imports. -export const shikiWorkerSrc = `https://unpkg.com/@vap/shiki-worker@0.0.8/dist/${IS_DEV ? "index.js" : "index.min.js"}`; -export const shikiOnigasmSrc = "https://unpkg.com/@vap/shiki@0.10.3/dist/onig.wasm"; +export const shikiWorkerSrc = `https://cdn.jsdelivr.net/npm/@vap/shiki-worker@0.0.8/dist/${IS_DEV ? "index.js" : "index.min.js"}`; +export const shikiOnigasmSrc = "https://cdn.jsdelivr.net/npm/@vap/shiki@0.10.3/dist/onig.wasm"; // @ts-expect-error -export const getStegCloak = /* #__PURE__*/ makeLazy(() => import("https://unpkg.com/stegcloak-dist@1.0.0/index.js")); +export const getStegCloak = /* #__PURE__*/ makeLazy(() => import("https://cdn.jsdelivr.net/npm/stegcloak-dist@1.0.0/index.js")); From 48868f01fe03a2e87ac9f872fb493a00303ecc18 Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Mon, 17 Mar 2025 22:49:52 -0400 Subject: [PATCH 2/2] MessageLatency: Fix off by one error on some deltas (#3297) --- src/plugins/messageLatency/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/messageLatency/index.tsx b/src/plugins/messageLatency/index.tsx index f0d5f960..460b95a8 100644 --- a/src/plugins/messageLatency/index.tsx +++ b/src/plugins/messageLatency/index.tsx @@ -63,11 +63,11 @@ export default definePlugin({ stringDelta(delta: number, showMillis: boolean) { const diff: Diff = { - days: Math.round(delta / (60 * 60 * 24 * 1000)), - hours: Math.round((delta / (60 * 60 * 1000)) % 24), - minutes: Math.round((delta / (60 * 1000)) % 60), - seconds: Math.round(delta / 1000 % 60), - milliseconds: Math.round(delta % 1000) + days: Math.floor(delta / (60 * 60 * 24 * 1000)), + hours: Math.floor((delta / (60 * 60 * 1000)) % 24), + minutes: Math.floor((delta / (60 * 1000)) % 60), + seconds: Math.floor(delta / 1000 % 60), + milliseconds: Math.floor(delta % 1000) }; const str = (k: DiffKey) => diff[k] > 0 ? `${diff[k]} ${diff[k] > 1 ? k : k.substring(0, k.length - 1)}` : null;