Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
5dbd59a4d8
3 changed files with 14 additions and 13 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue