Merge branch 'main' into isMaximized-in-renderer
This commit is contained in:
commit
41787042cc
11 changed files with 1121 additions and 605 deletions
|
@ -28,6 +28,24 @@
|
||||||
</screenshot>
|
</screenshot>
|
||||||
</screenshots>
|
</screenshots>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="1.5.1" date="2024-03-12" type="stable">
|
||||||
|
<url>https://github.com/Vencord/Vesktop/releases/tag/v1.5.1</url>
|
||||||
|
<description>
|
||||||
|
<p>New Features</p>
|
||||||
|
<ul>
|
||||||
|
<li>Added categories to Vesktop settings to reduce visual clutter by @justin13888</li>
|
||||||
|
<li>Added support for Vencord's transparent window options</li>
|
||||||
|
</ul>
|
||||||
|
<p>Fixes</p>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed ugly error popups when starting Vesktop without working internet connection</li>
|
||||||
|
<li>Fixed popout title bars on Windows</li>
|
||||||
|
<li>Fixed spellcheck entries</li>
|
||||||
|
<li>Fixed screenshare audio using microphone on debian, by @Curve</li>
|
||||||
|
<li>Fixed a bug where autostart on Linux won't preserve command line flags</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
<release version="1.5.0" date="2024-01-16" type="stable">
|
<release version="1.5.0" date="2024-01-16" type="stable">
|
||||||
<url>https://github.com/Vencord/Vesktop/releases/tag/v1.5.0</url>
|
<url>https://github.com/Vencord/Vesktop/releases/tag/v1.5.0</url>
|
||||||
<description>
|
<description>
|
||||||
|
@ -176,4 +194,4 @@
|
||||||
<keyword>Privacy</keyword>
|
<keyword>Privacy</keyword>
|
||||||
<keyword>Mod</keyword>
|
<keyword>Mod</keyword>
|
||||||
</keywords>
|
</keywords>
|
||||||
</component>
|
</component>
|
34
package.json
34
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "vesktop",
|
"name": "vesktop",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "",
|
"description": "",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
@ -31,29 +31,29 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
||||||
"@types/node": "^20.11.2",
|
"@types/node": "^20.11.26",
|
||||||
"@types/react": "^18.2.48",
|
"@types/react": "^18.2.65",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
||||||
"@typescript-eslint/parser": "^6.19.0",
|
"@typescript-eslint/parser": "^7.2.0",
|
||||||
"@vencord/types": "^0.1.2",
|
"@vencord/types": "^0.1.2",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.4.5",
|
||||||
"electron": "^28.1.3",
|
"electron": "^29.1.1",
|
||||||
"electron-builder": "^24.9.1",
|
"electron-builder": "^24.13.3",
|
||||||
"esbuild": "^0.19.11",
|
"esbuild": "^0.20.1",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-import-resolver-alias": "^1.1.2",
|
"eslint-import-resolver-alias": "^1.1.2",
|
||||||
"eslint-plugin-license-header": "^0.6.0",
|
"eslint-plugin-license-header": "^0.6.0",
|
||||||
"eslint-plugin-path-alias": "^1.0.0",
|
"eslint-plugin-path-alias": "^1.0.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
||||||
"eslint-plugin-unused-imports": "^3.0.0",
|
"eslint-plugin-unused-imports": "^3.1.0",
|
||||||
"prettier": "^3.2.2",
|
"prettier": "^3.2.5",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"tsx": "^4.7.0",
|
"tsx": "^4.7.1",
|
||||||
"type-fest": "^4.9.0",
|
"type-fest": "^4.12.0",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.4.2",
|
||||||
"xml-formatter": "^3.6.0"
|
"xml-formatter": "^3.6.2"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@8.11.0",
|
"packageManager": "pnpm@8.11.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
1531
pnpm-lock.yaml
1531
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -8,4 +8,4 @@ import "./utils/dotenv";
|
||||||
|
|
||||||
import { spawnNodeModuleBin } from "./utils/spawn.mjs";
|
import { spawnNodeModuleBin } from "./utils/spawn.mjs";
|
||||||
|
|
||||||
spawnNodeModuleBin("electron", [".", ...(process.env.ELECTRON_LAUNCH_FLAGS?.split(" ") ?? [])]);
|
spawnNodeModuleBin("electron", [process.cwd(), ...(process.env.ELECTRON_LAUNCH_FLAGS?.split(" ") ?? [])]);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { app } from "electron";
|
import { app } from "electron";
|
||||||
import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
import { existsSync, mkdirSync, renameSync, rmSync, writeFileSync } from "fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
interface AutoStart {
|
interface AutoStart {
|
||||||
|
@ -17,7 +17,16 @@ interface AutoStart {
|
||||||
function makeAutoStartLinux(): AutoStart {
|
function makeAutoStartLinux(): AutoStart {
|
||||||
const configDir = process.env.XDG_CONFIG_HOME || join(process.env.HOME!, ".config");
|
const configDir = process.env.XDG_CONFIG_HOME || join(process.env.HOME!, ".config");
|
||||||
const dir = join(configDir, "autostart");
|
const dir = join(configDir, "autostart");
|
||||||
const file = join(dir, "vencord.desktop");
|
const file = join(dir, "vesktop.desktop");
|
||||||
|
|
||||||
|
// IM STUPID
|
||||||
|
const legacyName = join(dir, "vencord.desktop");
|
||||||
|
if (existsSync(legacyName)) renameSync(legacyName, file);
|
||||||
|
|
||||||
|
// "Quoting must be done by enclosing the argument between double quotes and escaping the double quote character,
|
||||||
|
// backtick character ("`"), dollar sign ("$") and backslash character ("\") by preceding it with an additional backslash character"
|
||||||
|
// https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
|
||||||
|
const commandLine = process.argv.map(arg => '"' + arg.replace(/["$`\\]/g, "\\$&") + '"').join(" ");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isEnabled: () => existsSync(file),
|
isEnabled: () => existsSync(file),
|
||||||
|
@ -25,12 +34,11 @@ function makeAutoStartLinux(): AutoStart {
|
||||||
const desktopFile = `
|
const desktopFile = `
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Version=1.0
|
Name=Vesktop
|
||||||
Name=Vencord
|
Comment=Vesktop autostart script
|
||||||
Comment=Vencord autostart script
|
Exec=${commandLine}
|
||||||
Exec=${process.execPath}
|
|
||||||
Terminal=false
|
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
|
Terminal=false
|
||||||
`.trim();
|
`.trim();
|
||||||
|
|
||||||
mkdirSync(dir, { recursive: true });
|
mkdirSync(dir, { recursive: true });
|
||||||
|
|
|
@ -48,14 +48,14 @@ export const DEFAULT_HEIGHT = 720;
|
||||||
|
|
||||||
export const DISCORD_HOSTNAMES = ["discord.com", "canary.discord.com", "ptb.discord.com"];
|
export const DISCORD_HOSTNAMES = ["discord.com", "canary.discord.com", "ptb.discord.com"];
|
||||||
|
|
||||||
const UserAgents = {
|
const BrowserUserAgents = {
|
||||||
darwin: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
darwin: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
|
||||||
linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
|
||||||
windows:
|
windows:
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UserAgent = UserAgents[process.platform] || UserAgents.windows;
|
export const BrowserUserAgent = BrowserUserAgents[process.platform] || BrowserUserAgents.windows;
|
||||||
|
|
||||||
export const enum MessageBoxChoice {
|
export const enum MessageBoxChoice {
|
||||||
Default,
|
Default,
|
||||||
|
|
|
@ -25,13 +25,13 @@ import { ICON_PATH } from "../shared/paths";
|
||||||
import { createAboutWindow } from "./about";
|
import { createAboutWindow } from "./about";
|
||||||
import { initArRPC } from "./arrpc";
|
import { initArRPC } from "./arrpc";
|
||||||
import {
|
import {
|
||||||
|
BrowserUserAgent,
|
||||||
DATA_DIR,
|
DATA_DIR,
|
||||||
DEFAULT_HEIGHT,
|
DEFAULT_HEIGHT,
|
||||||
DEFAULT_WIDTH,
|
DEFAULT_WIDTH,
|
||||||
MessageBoxChoice,
|
MessageBoxChoice,
|
||||||
MIN_HEIGHT,
|
MIN_HEIGHT,
|
||||||
MIN_WIDTH,
|
MIN_WIDTH,
|
||||||
UserAgent,
|
|
||||||
VENCORD_FILES_DIR
|
VENCORD_FILES_DIR
|
||||||
} from "./constants";
|
} from "./constants";
|
||||||
import { Settings, State, VencordSettings } from "./settings";
|
import { Settings, State, VencordSettings } from "./settings";
|
||||||
|
@ -435,7 +435,7 @@ function createMainWindow() {
|
||||||
initSpellCheck(win);
|
initSpellCheck(win);
|
||||||
initMaximizedHook(win);
|
initMaximizedHook(win);
|
||||||
|
|
||||||
win.webContents.setUserAgent(UserAgent);
|
win.webContents.setUserAgent(BrowserUserAgent);
|
||||||
|
|
||||||
const subdomain =
|
const subdomain =
|
||||||
Settings.store.discordBranch === "canary" || Settings.store.discordBranch === "ptb"
|
Settings.store.discordBranch === "canary" || Settings.store.discordBranch === "ptb"
|
||||||
|
|
|
@ -5,41 +5,54 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createWriteStream } from "fs";
|
import { createWriteStream } from "fs";
|
||||||
import type { IncomingMessage } from "http";
|
import { Readable } from "stream";
|
||||||
import { get, RequestOptions } from "https";
|
import { pipeline } from "stream/promises";
|
||||||
import { finished } from "stream/promises";
|
import { setTimeout } from "timers/promises";
|
||||||
|
|
||||||
export async function downloadFile(url: string, file: string, options: RequestOptions = {}) {
|
interface FetchieOptions {
|
||||||
const res = await simpleReq(url, options);
|
retryOnNetworkError?: boolean;
|
||||||
await finished(
|
}
|
||||||
res.pipe(
|
|
||||||
createWriteStream(file, {
|
export async function downloadFile(url: string, file: string, options: RequestInit = {}, fetchieOpts?: FetchieOptions) {
|
||||||
autoClose: true
|
const res = await fetchie(url, options, fetchieOpts);
|
||||||
})
|
await pipeline(
|
||||||
)
|
// @ts-expect-error odd type error
|
||||||
|
Readable.fromWeb(res.body!),
|
||||||
|
createWriteStream(file, {
|
||||||
|
autoClose: true
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function simpleReq(url: string, options: RequestOptions = {}) {
|
const ONE_MINUTE_MS = 1000 * 60;
|
||||||
return new Promise<IncomingMessage>((resolve, reject) => {
|
|
||||||
get(url, options, res => {
|
|
||||||
const { statusCode, statusMessage, headers } = res;
|
|
||||||
if (statusCode! >= 400) return void reject(`${statusCode}: ${statusMessage} - ${url}`);
|
|
||||||
if (statusCode! >= 300) return simpleReq(headers.location!, options).then(resolve).catch(reject);
|
|
||||||
|
|
||||||
resolve(res);
|
export async function fetchie(url: string, options?: RequestInit, { retryOnNetworkError }: FetchieOptions = {}) {
|
||||||
});
|
let res: Response | undefined;
|
||||||
});
|
|
||||||
}
|
try {
|
||||||
|
res = await fetch(url, options);
|
||||||
export async function simpleGet(url: string, options: RequestOptions = {}) {
|
} catch (err) {
|
||||||
const res = await simpleReq(url, options);
|
if (retryOnNetworkError) {
|
||||||
|
console.error("Failed to fetch", url + ".", "Gonna retry with backoff.");
|
||||||
return new Promise<Buffer>((resolve, reject) => {
|
|
||||||
const chunks = [] as Buffer[];
|
for (let tries = 0, delayMs = 500; tries < 20; tries++, delayMs = Math.min(2 * delayMs, ONE_MINUTE_MS)) {
|
||||||
|
await setTimeout(delayMs);
|
||||||
res.once("error", reject);
|
try {
|
||||||
res.on("data", chunk => chunks.push(chunk));
|
res = await fetch(url, options);
|
||||||
res.once("end", () => resolve(Buffer.concat(chunks)));
|
break;
|
||||||
});
|
} catch {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!res) throw new Error(`Failed to fetch ${url}\n${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.ok) return res;
|
||||||
|
|
||||||
|
let msg = `Got non-OK response for ${url}: ${res.status} ${res.statusText}`;
|
||||||
|
|
||||||
|
const reason = await res.text().catch(() => "");
|
||||||
|
if (reason) msg += `\n${reason}`;
|
||||||
|
|
||||||
|
throw new Error(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { existsSync, mkdirSync } from "fs";
|
import { existsSync, mkdirSync } from "fs";
|
||||||
import type { RequestOptions } from "https";
|
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
import { USER_AGENT, VENCORD_FILES_DIR } from "../constants";
|
import { USER_AGENT, VENCORD_FILES_DIR } from "../constants";
|
||||||
import { downloadFile, simpleGet } from "./http";
|
import { downloadFile, fetchie } from "./http";
|
||||||
|
|
||||||
const API_BASE = "https://api.github.com";
|
const API_BASE = "https://api.github.com";
|
||||||
|
|
||||||
|
@ -31,27 +30,29 @@ export interface ReleaseData {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function githubGet(endpoint: string) {
|
export async function githubGet(endpoint: string) {
|
||||||
const opts: RequestOptions = {
|
const opts: RequestInit = {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/vnd.github+json",
|
Accept: "application/vnd.github+json",
|
||||||
"User-Agent": USER_AGENT
|
"User-Agent": USER_AGENT
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.env.GITHUB_TOKEN) opts.headers!.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
if (process.env.GITHUB_TOKEN) (opts.headers! as any).Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
||||||
|
|
||||||
return simpleGet(API_BASE + endpoint, opts);
|
return fetchie(API_BASE + endpoint, opts, { retryOnNetworkError: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadVencordFiles() {
|
export async function downloadVencordFiles() {
|
||||||
const release = await githubGet("/repos/Vendicated/Vencord/releases/latest");
|
const release = await githubGet("/repos/Vendicated/Vencord/releases/latest");
|
||||||
|
|
||||||
const { assets } = JSON.parse(release.toString("utf-8")) as ReleaseData;
|
const { assets }: ReleaseData = await release.json();
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
assets
|
assets
|
||||||
.filter(({ name }) => FILES_TO_DOWNLOAD.some(f => name.startsWith(f)))
|
.filter(({ name }) => FILES_TO_DOWNLOAD.some(f => name.startsWith(f)))
|
||||||
.map(({ name, browser_download_url }) => downloadFile(browser_download_url, join(VENCORD_FILES_DIR, name)))
|
.map(({ name, browser_download_url }) =>
|
||||||
|
downloadFile(browser_download_url, join(VENCORD_FILES_DIR, name), {}, { retryOnNetworkError: true })
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
import { addContextMenuPatch } from "@vencord/types/api/ContextMenu";
|
import { addContextMenuPatch } from "@vencord/types/api/ContextMenu";
|
||||||
import { findStoreLazy } from "@vencord/types/webpack";
|
import { findStoreLazy } from "@vencord/types/webpack";
|
||||||
import { ContextMenu, FluxDispatcher, Menu } from "@vencord/types/webpack/common";
|
import { FluxDispatcher, Menu, useStateFromStores } from "@vencord/types/webpack/common";
|
||||||
|
|
||||||
import { addPatch } from "./shared";
|
import { addPatch } from "./shared";
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ addPatch({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addContextMenuPatch("textarea-context", children => () => {
|
addContextMenuPatch("textarea-context", children => {
|
||||||
|
const spellCheckEnabled = useStateFromStores([SpellCheckStore], () => SpellCheckStore.isEnabled());
|
||||||
const hasCorrections = Boolean(word && corrections?.length);
|
const hasCorrections = Boolean(word && corrections?.length);
|
||||||
|
|
||||||
children.push(
|
children.push(
|
||||||
|
@ -71,11 +72,9 @@ addContextMenuPatch("textarea-context", children => () => {
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
id="vcd-spellcheck-enabled"
|
id="vcd-spellcheck-enabled"
|
||||||
label="Enable Spellcheck"
|
label="Enable Spellcheck"
|
||||||
checked={SpellCheckStore.isEnabled()}
|
checked={spellCheckEnabled}
|
||||||
action={() => {
|
action={() => {
|
||||||
FluxDispatcher.dispatch({ type: "SPELLCHECK_TOGGLE" });
|
FluxDispatcher.dispatch({ type: "SPELLCHECK_TOGGLE" });
|
||||||
// Haven't found a good way to update state, so just close for now 🤷♀️
|
|
||||||
ContextMenu.close();
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Menu.MenuGroup>
|
</Menu.MenuGroup>
|
||||||
|
|
|
@ -81,7 +81,7 @@ export async function checkUpdates() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const raw = await githubGet("/repos/Vencord/Vesktop/releases/latest");
|
const raw = await githubGet("/repos/Vencord/Vesktop/releases/latest");
|
||||||
const data = JSON.parse(raw.toString("utf-8")) as ReleaseData;
|
const data: ReleaseData = await raw.json();
|
||||||
|
|
||||||
const oldVersion = app.getVersion();
|
const oldVersion = app.getVersion();
|
||||||
const newVersion = data.tag_name.replace(/^v/, "");
|
const newVersion = data.tag_name.replace(/^v/, "");
|
||||||
|
|
Reference in a new issue