diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 7d7a75040..468aa117f 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -85,7 +85,7 @@ const settings = definePluginSettings({ description: "Size of the emojis when sending", type: OptionType.SLIDER, default: 48, - markers: [32, 48, 64, 96, 128, 160, 256, 512] + markers: [32, 48, 56, 64, 96, 128, 160, 256, 512] }, transformEmojis: { description: "Whether to transform fake emojis into real ones", @@ -867,6 +867,7 @@ export default definePlugin({ const url = new URL(link); url.searchParams.set("name", sticker.name); + url.searchParams.set("lossless", "true"); const linkText = s.hyperLinkText.replaceAll("{{NAME}}", sticker.name); @@ -886,9 +887,9 @@ export default definePlugin({ const url = new URL(IconUtils.getEmojiURL({ id: emoji.id, animated: emoji.animated, size: s.emojiSize })); url.searchParams.set("size", s.emojiSize.toString()); url.searchParams.set("name", emoji.name); - if (emoji.animated) { - url.pathname = url.pathname.replace(".webp", ".gif"); - } + url.searchParams.set("lossless", "true"); + + if (emoji.animated) url.pathname = url.pathname.replace(".webp", ".gif"); const linkText = s.hyperLinkText.replaceAll("{{NAME}}", emoji.name); @@ -922,6 +923,7 @@ export default definePlugin({ const url = new URL(IconUtils.getEmojiURL({ id: emoji.id, animated: emoji.animated, size: s.emojiSize })); url.searchParams.set("size", s.emojiSize.toString()); url.searchParams.set("name", emoji.name); + url.searchParams.set("lossless", "true"); const linkText = s.hyperLinkText.replaceAll("{{NAME}}", emoji.name); diff --git a/src/plugins/fixImagesQuality/index.tsx b/src/plugins/fixImagesQuality/index.tsx index 527c8f416..98945c933 100644 --- a/src/plugins/fixImagesQuality/index.tsx +++ b/src/plugins/fixImagesQuality/index.tsx @@ -74,11 +74,10 @@ export default definePlugin({ const url = new URL(src); if (!url.pathname.startsWith("/attachments/")) return; - if (freeze) { - url.searchParams.set("animated", "false"); - - if (url.pathname.endsWith(".gif")) - url.searchParams.set("format", "webp"); + url.searchParams.set("animated", String(!freeze)); + if (freeze && url.pathname.endsWith(".gif")) { + // gifs don't support animated=false, so we have no choice but to use webp + url.searchParams.set("format", "webp"); } const isModal = !!trigger; diff --git a/src/plugins/voiceMessages/native.ts b/src/plugins/voiceMessages/native.ts index ea49498f2..9a0f80c94 100644 --- a/src/plugins/voiceMessages/native.ts +++ b/src/plugins/voiceMessages/native.ts @@ -5,18 +5,18 @@ */ import { app } from "electron"; -import { readFile } from "fs/promises"; +import { readFile, rm } from "fs/promises"; import { basename, normalize } from "path"; export async function readRecording(_: any, filePath: string) { filePath = normalize(filePath); const filename = basename(filePath); - const userDataDir = normalize(app.getPath("userData") + "/"); - - if (!filename.endsWith("recording.ogg") || !filePath.startsWith(userDataDir)) return null; + const discordBaseDirWithTrailingSlash = normalize(app.getPath("userData") + "/"); + if (!/^\d*recording\.ogg$/.test(filename) || !filePath.startsWith(discordBaseDirWithTrailingSlash)) return null; try { const buf = await readFile(filePath); + rm(filePath).catch(() => { }); return new Uint8Array(buf.buffer); } catch { return null;