diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a756681c..d4746d67 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,6 @@ name: test on: push: - branches: - - main - - dev pull_request: branches: - main diff --git a/.vscode/settings.json b/.vscode/settings.json index 426ff680..fa543b38 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "[typescript]": { "editor.defaultFormatter": "vscode.typescript-language-features" diff --git a/package.json b/package.json index 72ea2b79..464237e3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.6.4", + "version": "1.6.5", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": { diff --git a/scripts/build/build.mjs b/scripts/build/build.mjs index a2e0e002..0c2a930a 100755 --- a/scripts/build/build.mjs +++ b/scripts/build/build.mjs @@ -76,7 +76,11 @@ const globNativesPlugin = { if (!await existsAsync(dirPath)) continue; const plugins = await readdir(dirPath); for (const p of plugins) { - if (!await existsAsync(join(dirPath, p, "native.ts"))) continue; + const nativePath = join(dirPath, p, "native.ts"); + const indexNativePath = join(dirPath, p, "native/index.ts"); + + if (!(await existsAsync(nativePath)) && !(await existsAsync(indexNativePath))) + continue; const nameParts = p.split("."); const namePartsWithoutTarget = nameParts.length === 1 ? nameParts : nameParts.slice(0, -1); diff --git a/scripts/generateReport.ts b/scripts/generateReport.ts index a75a5985..54db96e6 100644 --- a/scripts/generateReport.ts +++ b/scripts/generateReport.ts @@ -335,15 +335,15 @@ function runTime(token: string) { await (wreq as any).el(sym); delete Object.prototype[sym]; - const validChunksEntryPoints = [] as string[]; - const validChunks = [] as string[]; - const invalidChunks = [] as string[]; + const validChunksEntryPoints = new Set(); + const validChunks = new Set(); + const invalidChunks = new Set(); if (!chunks) throw new Error("Failed to get chunks"); - chunksLoop: for (const entryPoint in chunks) { const chunkIds = chunks[entryPoint]; + let invalidEntryPoint = false; for (const id of chunkIds) { if (!wreq.u(id)) continue; @@ -353,14 +353,16 @@ function runTime(token: string) { .then(t => t.includes(".module.wasm") || !t.includes("(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push")); if (isWasm) { - invalidChunks.push(id); - continue chunksLoop; + invalidChunks.add(id); + invalidEntryPoint = true; + continue; } - validChunks.push(id); + validChunks.add(id); } - validChunksEntryPoints.push(entryPoint); + if (!invalidEntryPoint) + validChunksEntryPoints.add(entryPoint); } for (const entryPoint of validChunksEntryPoints) { @@ -373,7 +375,7 @@ function runTime(token: string) { const allChunks = Function("return " + (wreq.u.toString().match(/(?<=\()\{.+?\}/s)?.[0] ?? "null"))() as Record | null; if (!allChunks) throw new Error("Failed to get all chunks"); const chunksLeft = Object.keys(allChunks).filter(id => { - return !(validChunks.includes(id) || invalidChunks.includes(id)); + return !(validChunks.has(id) || invalidChunks.has(id)); }); for (const id of chunksLeft) { diff --git a/src/api/Commands/commandHelpers.ts b/src/api/Commands/commandHelpers.ts index ebcc4e2f..8f4a88e4 100644 --- a/src/api/Commands/commandHelpers.ts +++ b/src/api/Commands/commandHelpers.ts @@ -25,7 +25,7 @@ import type { PartialDeep } from "type-fest"; import { Argument } from "./types"; -const MessageSender = findByPropsLazy("receiveMessage"); +const MessageCreator = findByPropsLazy("createBotMessage"); export function generateId() { return `-${SnowflakeUtils.fromTimestamp(Date.now())}`; @@ -38,9 +38,9 @@ export function generateId() { * @returns {Message} */ export function sendBotMessage(channelId: string, message: PartialDeep): Message { - const botMessage = MessageActions.createBotMessage({ channelId, content: "", embeds: [] }); + const botMessage = MessageCreator.createBotMessage({ channelId, content: "", embeds: [] }); - MessageSender.receiveMessage(channelId, mergeDefaults(message, botMessage)); + MessageActions.receiveMessage(channelId, mergeDefaults(message, botMessage)); return message as Message; } diff --git a/src/api/Settings.ts b/src/api/Settings.ts index 8e2a1c79..887d9d4c 100644 --- a/src/api/Settings.ts +++ b/src/api/Settings.ts @@ -38,7 +38,21 @@ export interface Settings { frameless: boolean; transparent: boolean; winCtrlQ: boolean; - macosTranslucency: boolean; + macosVibrancyStyle: + | "content" + | "fullscreen-ui" + | "header" + | "hud" + | "menu" + | "popover" + | "selection" + | "sidebar" + | "titlebar" + | "tooltip" + | "under-page" + | "window" + | undefined; + macosTranslucency: boolean | undefined; disableMinSize: boolean; winNativeTitleBar: boolean; plugins: { @@ -80,7 +94,9 @@ const DefaultSettings: Settings = { frameless: false, transparent: false, winCtrlQ: false, - macosTranslucency: false, + // Replaced by macosVibrancyStyle + macosTranslucency: undefined, + macosVibrancyStyle: undefined, disableMinSize: false, winNativeTitleBar: false, plugins: {}, diff --git a/src/components/VencordSettings/PatchHelperTab.tsx b/src/components/VencordSettings/PatchHelperTab.tsx index 0b869a51..35f46ef5 100644 --- a/src/components/VencordSettings/PatchHelperTab.tsx +++ b/src/components/VencordSettings/PatchHelperTab.tsx @@ -108,7 +108,7 @@ function ReplacementComponent({ module, match, replacement, setReplacementError function renderDiff() { return diff?.map(p => { const color = p.added ? "lime" : p.removed ? "red" : "grey"; - return
{p.value}
; + return
{p.value}
; }); } diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx index a8e9ea5b..07d777eb 100644 --- a/src/components/VencordSettings/VencordTab.tsx +++ b/src/components/VencordSettings/VencordTab.tsx @@ -48,6 +48,15 @@ function VencordSettings() { const isWindows = navigator.platform.toLowerCase().startsWith("win"); const isMac = navigator.platform.toLowerCase().startsWith("mac"); + const needsVibrancySettings = IS_DISCORD_DESKTOP && isMac; + + // One-time migration of the old setting to the new one if necessary. + React.useEffect(() => { + if (settings.macosTranslucency === true && !settings.macosVibrancyStyle) { + settings.macosVibrancyStyle = "sidebar"; + settings.macosTranslucency = undefined; + } + }, []); const Switches: Array; @@ -89,11 +98,6 @@ function VencordSettings() { title: "Disable minimum window size", note: "Requires a full restart" }, - IS_DISCORD_DESKTOP && isMac && { - key: "macosTranslucency", - title: "Enable translucent window", - note: "Requires a full restart" - } ]; return ( @@ -152,6 +156,71 @@ function VencordSettings() { + {needsVibrancySettings && <> + Window vibrancy style (requires restart) +