Compare commits
4 commits
main
...
vencord-as
Author | SHA1 | Date | |
---|---|---|---|
|
358206a1c5 | ||
|
ac28db6c4d | ||
|
94a0c4dc10 | ||
|
02f386db2d |
18 changed files with 1181 additions and 922 deletions
69
.eslintrc.json
Normal file
69
.eslintrc.json
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"ignorePatterns": ["dist", "node_modules"],
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint",
|
||||||
|
"license-header",
|
||||||
|
"simple-import-sort",
|
||||||
|
"unused-imports",
|
||||||
|
"path-alias",
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"import/resolver": {
|
||||||
|
"alias": {
|
||||||
|
"map": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"license-header/header": ["error", "scripts/header.txt"],
|
||||||
|
"eqeqeq": ["error", "always", { "null": "ignore" }],
|
||||||
|
"spaced-comment": ["error", "always", { "markers": ["!"] }],
|
||||||
|
"yoda": "error",
|
||||||
|
"prefer-destructuring": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"VariableDeclarator": { "array": false, "object": true },
|
||||||
|
"AssignmentExpression": { "array": false, "object": false }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"operator-assignment": ["error", "always"],
|
||||||
|
"no-useless-computed-key": "error",
|
||||||
|
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
|
||||||
|
"no-invalid-regexp": "error",
|
||||||
|
"no-constant-condition": ["error", { "checkLoops": false }],
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-extra-semi": "error",
|
||||||
|
"dot-notation": "error",
|
||||||
|
"no-useless-escape": "error",
|
||||||
|
"no-fallthrough": "error",
|
||||||
|
"for-direction": "error",
|
||||||
|
"no-async-promise-executor": "error",
|
||||||
|
"no-cond-assign": "error",
|
||||||
|
"no-dupe-else-if": "error",
|
||||||
|
"no-duplicate-case": "error",
|
||||||
|
"no-irregular-whitespace": "error",
|
||||||
|
"no-loss-of-precision": "error",
|
||||||
|
"no-misleading-character-class": "error",
|
||||||
|
"no-prototype-builtins": "error",
|
||||||
|
"no-regex-spaces": "error",
|
||||||
|
"no-shadow-restricted-names": "error",
|
||||||
|
"no-unexpected-multiline": "error",
|
||||||
|
"no-unsafe-optional-chaining": "error",
|
||||||
|
"no-useless-backreference": "error",
|
||||||
|
"use-isnan": "error",
|
||||||
|
"prefer-const": "error",
|
||||||
|
"prefer-spread": "error",
|
||||||
|
|
||||||
|
"simple-import-sort/imports": "error",
|
||||||
|
"simple-import-sort/exports": "error",
|
||||||
|
|
||||||
|
"unused-imports/no-unused-imports": "error",
|
||||||
|
|
||||||
|
"path-alias/no-relative": "error",
|
||||||
|
|
||||||
|
"prettier/prettier": "error"
|
||||||
|
}
|
||||||
|
}
|
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -11,7 +11,7 @@ body:
|
||||||
|
|
||||||
Make sure a similar issue doesn't already exist by [searching the existing issues](https://github.com/Vencord/Vesktop/issues?q=is%3Aissue) for keywords!
|
Make sure a similar issue doesn't already exist by [searching the existing issues](https://github.com/Vencord/Vesktop/issues?q=is%3Aissue) for keywords!
|
||||||
|
|
||||||
Make sure both Vesktop and Vencord are fully up to date. You can update Vencord by right-clicking the Vesktop tray icon and pressing "Repair Vencord"
|
Make sure both Vesktop and Vencord are fully up to date. You can update Vencord by right-clicking the Vesktop tray icon and pressing "Update Vencord"
|
||||||
|
|
||||||
**DO NOT REPORT** any of the following issues:
|
**DO NOT REPORT** any of the following issues:
|
||||||
- Purely graphical glitches like flickering, scaling issues[^1]
|
- Purely graphical glitches like flickering, scaling issues[^1]
|
||||||
|
|
2
.github/workflows/meta.yml
vendored
2
.github/workflows/meta.yml
vendored
|
@ -33,6 +33,6 @@ jobs:
|
||||||
git add meta/dev.vencord.Vesktop.metainfo.xml
|
git add meta/dev.vencord.Vesktop.metainfo.xml
|
||||||
git commit -m "Insert release changes for ${{ github.event.release.tag_name }}"
|
git commit -m "Insert release changes for ${{ github.event.release.tag_name }}"
|
||||||
git push origin ci/meta-update
|
git push origin ci/meta-update
|
||||||
gh pr create -B main -H ci/meta-update -t "Metainfo for ${{ github.event.release.tag_name }}" -b "This PR updates the metainfo for release ${{ github.event.release.tag_name }}."
|
gh pr create -B main -H ci/meta-update -t "Metainfo for ${{ github.event.release.tag_name }}" -b "This PR updates the metainfo for release ${{ github.event.release.tag_name }}. @lewisakura @Vendicated"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
|
@ -52,7 +52,6 @@ jobs:
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CSC_LINK: ${{ secrets.APPLE_SIGNING_CERT }}
|
CSC_LINK: ${{ secrets.APPLE_SIGNING_CERT }}
|
||||||
CSC_KEY_PASSWORD: ${{ secrets.APPLE_SIGNING_CERT_PASSWORD }}
|
|
||||||
API_KEY: ${{ secrets.APPLE_API_KEY }}
|
API_KEY: ${{ secrets.APPLE_API_KEY }}
|
||||||
APPLE_API_KEY: apple.p8
|
APPLE_API_KEY: apple.p8
|
||||||
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
|
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
|
||||||
|
|
|
@ -24,7 +24,7 @@ If you don't know the difference, pick the Installer.
|
||||||
- [Installer](https://vencord.dev/download/vesktop/universal/windows)
|
- [Installer](https://vencord.dev/download/vesktop/universal/windows)
|
||||||
- Portable:
|
- Portable:
|
||||||
- [x64 / amd64](https://vencord.dev/download/vesktop/amd64/windows-portable)
|
- [x64 / amd64](https://vencord.dev/download/vesktop/amd64/windows-portable)
|
||||||
- [Arm® 64](https://vencord.dev/download/vesktop/arm64/windows-portable)
|
- [arm64](https://vencord.dev/download/vesktop/arm64/windows-portable)
|
||||||
|
|
||||||
### Mac
|
### Mac
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ If you don't know the difference, pick amd64.
|
||||||
- [Ubuntu/Debian (.deb)](https://vencord.dev/download/vesktop/amd64/deb)
|
- [Ubuntu/Debian (.deb)](https://vencord.dev/download/vesktop/amd64/deb)
|
||||||
- [Fedora/RHEL (.rpm)](https://vencord.dev/download/vesktop/amd64/rpm)
|
- [Fedora/RHEL (.rpm)](https://vencord.dev/download/vesktop/amd64/rpm)
|
||||||
- [tarball](https://vencord.dev/download/vesktop/amd64/tar)
|
- [tarball](https://vencord.dev/download/vesktop/amd64/tar)
|
||||||
- Arm® 64 / aarch64
|
- arm64 / aarch64
|
||||||
- [AppImage](https://vencord.dev/download/vesktop/arm64/appimage)
|
- [AppImage](https://vencord.dev/download/vesktop/arm64/appimage)
|
||||||
- [Ubuntu/Debian (.deb)](https://vencord.dev/download/vesktop/arm64/deb)
|
- [Ubuntu/Debian (.deb)](https://vencord.dev/download/vesktop/arm64/deb)
|
||||||
- [Fedora/RHEL (.rpm)](https://vencord.dev/download/vesktop/arm64/rpm)
|
- [Fedora/RHEL (.rpm)](https://vencord.dev/download/vesktop/arm64/rpm)
|
||||||
|
|
|
@ -1,102 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0
|
|
||||||
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
|
|
||||||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
|
||||||
*/
|
|
||||||
|
|
||||||
//@ts-check
|
|
||||||
|
|
||||||
import stylistic from "@stylistic/eslint-plugin";
|
|
||||||
import pathAlias from "eslint-plugin-path-alias";
|
|
||||||
import header from "eslint-plugin-simple-header";
|
|
||||||
import importSort from "eslint-plugin-simple-import-sort";
|
|
||||||
import unusedImports from "eslint-plugin-unused-imports";
|
|
||||||
import tseslint from "typescript-eslint";
|
|
||||||
import prettier from "eslint-plugin-prettier";
|
|
||||||
|
|
||||||
export default tseslint.config(
|
|
||||||
{ ignores: ["dist"] },
|
|
||||||
|
|
||||||
{
|
|
||||||
files: ["src/**/*.{tsx,ts,mts,mjs,js,jsx}"],
|
|
||||||
plugins: {
|
|
||||||
header,
|
|
||||||
stylistic,
|
|
||||||
importSort,
|
|
||||||
unusedImports,
|
|
||||||
pathAlias,
|
|
||||||
prettier
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
"import/resolver": {
|
|
||||||
alias: {
|
|
||||||
map: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
languageOptions: {
|
|
||||||
parser: tseslint.parser,
|
|
||||||
parserOptions: {
|
|
||||||
project: true,
|
|
||||||
tsconfigRootDir: import.meta.dirname
|
|
||||||
}
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
"header/header": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
files: ["scripts/header.txt"]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
// ESLint Rules
|
|
||||||
|
|
||||||
yoda: "error",
|
|
||||||
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
||||||
"prefer-destructuring": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
VariableDeclarator: { array: false, object: true },
|
|
||||||
AssignmentExpression: { array: false, object: false }
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"operator-assignment": ["error", "always"],
|
|
||||||
"no-useless-computed-key": "error",
|
|
||||||
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
||||||
"no-invalid-regexp": "error",
|
|
||||||
"no-constant-condition": ["error", { checkLoops: false }],
|
|
||||||
"no-duplicate-imports": "error",
|
|
||||||
"dot-notation": "error",
|
|
||||||
"no-useless-escape": "error",
|
|
||||||
"no-fallthrough": "error",
|
|
||||||
"for-direction": "error",
|
|
||||||
"no-async-promise-executor": "error",
|
|
||||||
"no-cond-assign": "error",
|
|
||||||
"no-dupe-else-if": "error",
|
|
||||||
"no-duplicate-case": "error",
|
|
||||||
"no-irregular-whitespace": "error",
|
|
||||||
"no-loss-of-precision": "error",
|
|
||||||
"no-misleading-character-class": "error",
|
|
||||||
"no-prototype-builtins": "error",
|
|
||||||
"no-regex-spaces": "error",
|
|
||||||
"no-shadow-restricted-names": "error",
|
|
||||||
"no-unexpected-multiline": "error",
|
|
||||||
"no-unsafe-optional-chaining": "error",
|
|
||||||
"no-useless-backreference": "error",
|
|
||||||
"use-isnan": "error",
|
|
||||||
"prefer-const": "error",
|
|
||||||
"prefer-spread": "error",
|
|
||||||
|
|
||||||
// Styling Rules
|
|
||||||
"stylistic/spaced-comment": ["error", "always", { markers: ["!"] }],
|
|
||||||
"stylistic/no-extra-semi": "error",
|
|
||||||
|
|
||||||
// Plugin Rules
|
|
||||||
"importSort/imports": "error",
|
|
||||||
"importSort/exports": "error",
|
|
||||||
"unusedImports/no-unused-imports": "error",
|
|
||||||
"pathAlias/no-relative": "error",
|
|
||||||
"prettier/prettier": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
42
package.json
42
package.json
|
@ -13,7 +13,7 @@
|
||||||
"build:dev": "pnpm build --dev",
|
"build:dev": "pnpm build --dev",
|
||||||
"package": "pnpm build && electron-builder",
|
"package": "pnpm build && electron-builder",
|
||||||
"package:dir": "pnpm build && electron-builder --dir",
|
"package:dir": "pnpm build && electron-builder --dir",
|
||||||
"lint": "eslint",
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.mts,.mjs",
|
||||||
"lint:fix": "pnpm lint --fix",
|
"lint:fix": "pnpm lint --fix",
|
||||||
"start": "pnpm build && electron .",
|
"start": "pnpm build && electron .",
|
||||||
"start:dev": "pnpm build:dev && electron .",
|
"start:dev": "pnpm build:dev && electron .",
|
||||||
|
@ -24,35 +24,36 @@
|
||||||
"updateMeta": "tsx scripts/utils/updateMeta.mts"
|
"updateMeta": "tsx scripts/utils/updateMeta.mts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"arrpc": "github:OpenAsar/arrpc#5aadc307cb9bf4479f0a12364a253b07a77ace22",
|
"arrpc": "github:OpenAsar/arrpc#c62ec6a04c8d870530aa6944257fe745f6c59a24",
|
||||||
"electron-updater": "^6.3.4"
|
"electron-updater": "^6.2.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@vencord/venmic": "^6.1.0"
|
"@vencord/venmic": "^6.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
||||||
"@stylistic/eslint-plugin": "^2.8.0",
|
"@types/node": "^20.14.11",
|
||||||
"@types/node": "^22.5.5",
|
"@types/react": "^18.3.3",
|
||||||
"@types/react": "^18.3.8",
|
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
||||||
|
"@typescript-eslint/parser": "^7.17.0",
|
||||||
"@vencord/types": "^1.8.4",
|
"@vencord/types": "^1.8.4",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"electron": "^33.0.2",
|
"electron": "^31.2.1",
|
||||||
"electron-builder": "^25.0.5",
|
"electron-builder": "^25.0.1",
|
||||||
"esbuild": "^0.23.1",
|
"esbuild": "^0.20.2",
|
||||||
"eslint": "^9.11.0",
|
"eslint": "^8.57.0",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-import-resolver-alias": "^1.1.2",
|
"eslint-import-resolver-alias": "^1.1.2",
|
||||||
"eslint-plugin-path-alias": "^2.1.0",
|
"eslint-plugin-license-header": "^0.6.1",
|
||||||
|
"eslint-plugin-path-alias": "^1.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-simple-header": "^1.2.1",
|
|
||||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
"eslint-plugin-unused-imports": "^4.1.4",
|
"eslint-plugin-unused-imports": "^3.2.0",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"tsx": "^4.19.1",
|
"tsx": "^4.16.2",
|
||||||
"type-fest": "^4.26.1",
|
"type-fest": "^4.23.0",
|
||||||
"typescript": "^5.6.2",
|
"typescript": "^5.5.4",
|
||||||
"typescript-eslint": "^8.6.0",
|
|
||||||
"xml-formatter": "^3.6.3"
|
"xml-formatter": "^3.6.3"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@9.1.0",
|
"packageManager": "pnpm@9.1.0",
|
||||||
|
@ -180,14 +181,15 @@
|
||||||
"provider": "github"
|
"provider": "github"
|
||||||
},
|
},
|
||||||
"rpm": {
|
"rpm": {
|
||||||
"fpm": [
|
"fpm": [
|
||||||
"--rpm-rpmbuild-define=_build_id_links none"
|
"--rpm-rpmbuild-define=_build_id_links none"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"arrpc@3.5.0": "patches/arrpc@3.5.0.patch"
|
"arrpc@3.4.0": "patches/arrpc@3.4.0.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1777
pnpm-lock.yaml
1777
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -22,7 +22,7 @@ const NodeCommonOpts: BuildOptions = {
|
||||||
...CommonOpts,
|
...CommonOpts,
|
||||||
format: "cjs",
|
format: "cjs",
|
||||||
platform: "node",
|
platform: "node",
|
||||||
external: ["electron"],
|
external: ["electron", "original-fs"],
|
||||||
target: ["esnext"],
|
target: ["esnext"],
|
||||||
define: {
|
define: {
|
||||||
IS_DEV: JSON.stringify(isDev)
|
IS_DEV: JSON.stringify(isDev)
|
||||||
|
|
|
@ -47,9 +47,10 @@ export const VENCORD_THEMES_DIR = join(DATA_DIR, "themes");
|
||||||
|
|
||||||
// needs to be inline require because of circular dependency
|
// needs to be inline require because of circular dependency
|
||||||
// as otherwise "DATA_DIR" (which is used by ./settings) will be uninitialised
|
// as otherwise "DATA_DIR" (which is used by ./settings) will be uninitialised
|
||||||
export const VENCORD_FILES_DIR =
|
export const VENCORD_DIR = (() => {
|
||||||
(require("./settings") as typeof import("./settings")).State.store.vencordDir ||
|
const { State } = require("./settings") as typeof import("./settings");
|
||||||
join(SESSION_DATA_DIR, "vencordFiles");
|
return State.store.vencordDir ? join(State.store.vencordDir, "vesktop") : join(SESSION_DATA_DIR, "vencord.asar");
|
||||||
|
})();
|
||||||
|
|
||||||
export const USER_AGENT = `Vesktop/${app.getVersion()} (https://github.com/Vencord/Vesktop)`;
|
export const USER_AGENT = `Vesktop/${app.getVersion()} (https://github.com/Vencord/Vesktop)`;
|
||||||
|
|
||||||
|
@ -61,11 +62,11 @@ 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 VersionString = `AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${process.versions.chrome.split(".")[0]}.0.0.0 Safari/537.36`;
|
|
||||||
const BrowserUserAgents = {
|
const BrowserUserAgents = {
|
||||||
darwin: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ${VersionString}`,
|
darwin: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
||||||
linux: `Mozilla/5.0 (X11; Linux x86_64) ${VersionString}`,
|
linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
||||||
windows: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) ${VersionString}`
|
windows:
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const BrowserUserAgent = BrowserUserAgents[process.platform] || BrowserUserAgents.windows;
|
export const BrowserUserAgent = BrowserUserAgents[process.platform] || BrowserUserAgents.windows;
|
||||||
|
|
|
@ -60,9 +60,6 @@ function init() {
|
||||||
// WidgetLayering (Vencord Added): Fix DevTools context menus https://github.com/electron/electron/issues/38790
|
// WidgetLayering (Vencord Added): Fix DevTools context menus https://github.com/electron/electron/issues/38790
|
||||||
disabledFeatures.push("WinRetrieveSuggestionsOnlyOnDemand", "HardwareMediaKeyHandling", "MediaSessionService");
|
disabledFeatures.push("WinRetrieveSuggestionsOnlyOnDemand", "HardwareMediaKeyHandling", "MediaSessionService");
|
||||||
|
|
||||||
// Support TTS on Linux using speech-dispatcher
|
|
||||||
app.commandLine.appendSwitch("enable-speech-dispatcher");
|
|
||||||
|
|
||||||
app.commandLine.appendSwitch("enable-features", [...new Set(enabledFeatures)].filter(Boolean).join(","));
|
app.commandLine.appendSwitch("enable-features", [...new Set(enabledFeatures)].filter(Boolean).join(","));
|
||||||
app.commandLine.appendSwitch("disable-features", [...new Set(disabledFeatures)].filter(Boolean).join(","));
|
app.commandLine.appendSwitch("disable-features", [...new Set(disabledFeatures)].filter(Boolean).join(","));
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { debounce } from "shared/utils/debounce";
|
||||||
import { IpcEvents } from "../shared/IpcEvents";
|
import { IpcEvents } from "../shared/IpcEvents";
|
||||||
import { setBadgeCount } from "./appBadge";
|
import { setBadgeCount } from "./appBadge";
|
||||||
import { autoStart } from "./autoStart";
|
import { autoStart } from "./autoStart";
|
||||||
import { VENCORD_FILES_DIR, VENCORD_QUICKCSS_FILE, VENCORD_THEMES_DIR } from "./constants";
|
import { VENCORD_DIR, VENCORD_QUICKCSS_FILE, VENCORD_THEMES_DIR } from "./constants";
|
||||||
import { mainWin } from "./mainWindow";
|
import { mainWin } from "./mainWindow";
|
||||||
import { Settings, State } from "./settings";
|
import { Settings, State } from "./settings";
|
||||||
import { handle, handleSync } from "./utils/ipcWrappers";
|
import { handle, handleSync } from "./utils/ipcWrappers";
|
||||||
|
@ -25,10 +25,8 @@ import { PopoutWindows } from "./utils/popout";
|
||||||
import { isDeckGameMode, showGamePage } from "./utils/steamOS";
|
import { isDeckGameMode, showGamePage } from "./utils/steamOS";
|
||||||
import { isValidVencordInstall } from "./utils/vencordLoader";
|
import { isValidVencordInstall } from "./utils/vencordLoader";
|
||||||
|
|
||||||
handleSync(IpcEvents.GET_VENCORD_PRELOAD_FILE, () => join(VENCORD_FILES_DIR, "vencordDesktopPreload.js"));
|
handleSync(IpcEvents.GET_VENCORD_PRELOAD_FILE, () => join(VENCORD_DIR, "preload.js"));
|
||||||
handleSync(IpcEvents.GET_VENCORD_RENDERER_SCRIPT, () =>
|
handleSync(IpcEvents.GET_VENCORD_RENDERER_SCRIPT, () => readFileSync(join(VENCORD_DIR, "renderer.js"), "utf-8"));
|
||||||
readFileSync(join(VENCORD_FILES_DIR, "vencordDesktopRenderer.js"), "utf-8")
|
|
||||||
);
|
|
||||||
|
|
||||||
handleSync(IpcEvents.GET_RENDERER_SCRIPT, () => readFileSync(join(__dirname, "renderer.js"), "utf-8"));
|
handleSync(IpcEvents.GET_RENDERER_SCRIPT, () => readFileSync(join(__dirname, "renderer.js"), "utf-8"));
|
||||||
handleSync(IpcEvents.GET_RENDERER_CSS_FILE, () => join(__dirname, "renderer.css"));
|
handleSync(IpcEvents.GET_RENDERER_CSS_FILE, () => join(__dirname, "renderer.css"));
|
||||||
|
|
|
@ -34,13 +34,13 @@ import {
|
||||||
MessageBoxChoice,
|
MessageBoxChoice,
|
||||||
MIN_HEIGHT,
|
MIN_HEIGHT,
|
||||||
MIN_WIDTH,
|
MIN_WIDTH,
|
||||||
VENCORD_FILES_DIR
|
VENCORD_DIR
|
||||||
} from "./constants";
|
} from "./constants";
|
||||||
import { Settings, State, VencordSettings } from "./settings";
|
import { Settings, State, VencordSettings } from "./settings";
|
||||||
import { createSplashWindow } from "./splash";
|
import { createSplashWindow } from "./splash";
|
||||||
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
|
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
|
||||||
import { applyDeckKeyboardFix, askToApplySteamLayout, isDeckGameMode } from "./utils/steamOS";
|
import { applyDeckKeyboardFix, askToApplySteamLayout, isDeckGameMode } from "./utils/steamOS";
|
||||||
import { downloadVencordFiles, ensureVencordFiles } from "./utils/vencordLoader";
|
import { downloadVencordAsar, ensureVencordFiles } from "./utils/vencordLoader";
|
||||||
|
|
||||||
let isQuitting = false;
|
let isQuitting = false;
|
||||||
let tray: Tray;
|
let tray: Tray;
|
||||||
|
@ -93,7 +93,7 @@ function initTray(win: BrowserWindow) {
|
||||||
{
|
{
|
||||||
label: "Repair Vencord",
|
label: "Repair Vencord",
|
||||||
async click() {
|
async click() {
|
||||||
await downloadVencordFiles();
|
await downloadVencordAsar();
|
||||||
app.relaunch();
|
app.relaunch();
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ function initMenuBar(win: BrowserWindow) {
|
||||||
{
|
{
|
||||||
label: "Force Update Vencord",
|
label: "Force Update Vencord",
|
||||||
async click() {
|
async click() {
|
||||||
await downloadVencordFiles();
|
await downloadVencordAsar();
|
||||||
app.relaunch();
|
app.relaunch();
|
||||||
app.quit();
|
app.quit();
|
||||||
},
|
},
|
||||||
|
@ -465,7 +465,7 @@ function createMainWindow() {
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDesktopMain.js")));
|
const runVencordMain = once(() => require(VENCORD_DIR));
|
||||||
|
|
||||||
export async function createWindows() {
|
export async function createWindows() {
|
||||||
const startMinimized = process.argv.includes("--start-minimized");
|
const startMinimized = process.argv.includes("--start-minimized");
|
||||||
|
@ -499,17 +499,5 @@ export async function createWindows() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// evil hack to fix electron 32 regression that makes devtools always light theme
|
|
||||||
// https://github.com/electron/electron/issues/43367
|
|
||||||
// TODO: remove once fixed
|
|
||||||
mainWin.webContents.on("devtools-opened", () => {
|
|
||||||
if (!nativeTheme.shouldUseDarkColors) return;
|
|
||||||
|
|
||||||
nativeTheme.themeSource = "light";
|
|
||||||
setTimeout(() => {
|
|
||||||
nativeTheme.themeSource = "dark";
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
initArRPC();
|
initArRPC();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createWriteStream } from "fs";
|
import { createWriteStream } from "original-fs";
|
||||||
import { Readable } from "stream";
|
import { Readable } from "stream";
|
||||||
import { pipeline } from "stream/promises";
|
import { pipeline } from "stream/promises";
|
||||||
import { setTimeout } from "timers/promises";
|
import { setTimeout } from "timers/promises";
|
||||||
|
|
|
@ -4,22 +4,14 @@
|
||||||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { mkdirSync } from "fs";
|
import { existsSync } from "fs";
|
||||||
import { access, constants as FsConstants } from "fs/promises";
|
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
import { USER_AGENT, VENCORD_FILES_DIR } from "../constants";
|
import { USER_AGENT, VENCORD_DIR } from "../constants";
|
||||||
import { downloadFile, fetchie } from "./http";
|
import { downloadFile, fetchie } from "./http";
|
||||||
|
|
||||||
const API_BASE = "https://api.github.com";
|
const API_BASE = "https://api.github.com";
|
||||||
|
|
||||||
export const FILES_TO_DOWNLOAD = [
|
|
||||||
"vencordDesktopMain.js",
|
|
||||||
"vencordDesktopPreload.js",
|
|
||||||
"vencordDesktopRenderer.js",
|
|
||||||
"vencordDesktopRenderer.css"
|
|
||||||
];
|
|
||||||
|
|
||||||
export interface ReleaseData {
|
export interface ReleaseData {
|
||||||
name: string;
|
name: string;
|
||||||
tag_name: string;
|
tag_name: string;
|
||||||
|
@ -43,33 +35,21 @@ export async function githubGet(endpoint: string) {
|
||||||
return fetchie(API_BASE + endpoint, opts, { retryOnNetworkError: true });
|
return fetchie(API_BASE + endpoint, opts, { retryOnNetworkError: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadVencordFiles() {
|
export async function downloadVencordAsar() {
|
||||||
const release = await githubGet("/repos/Vendicated/Vencord/releases/latest");
|
await downloadFile(
|
||||||
|
"https://github.com/Vendicated/Vencord/releases/latest/download/vesktop.asar",
|
||||||
const { assets }: ReleaseData = await release.json();
|
VENCORD_DIR,
|
||||||
|
{},
|
||||||
await Promise.all(
|
{ retryOnNetworkError: true }
|
||||||
assets
|
|
||||||
.filter(({ name }) => FILES_TO_DOWNLOAD.some(f => name.startsWith(f)))
|
|
||||||
.map(({ name, browser_download_url }) =>
|
|
||||||
downloadFile(browser_download_url, join(VENCORD_FILES_DIR, name), {}, { retryOnNetworkError: true })
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const existsAsync = (path: string) =>
|
export function isValidVencordInstall(dir: string) {
|
||||||
access(path, FsConstants.F_OK)
|
return existsSync(join(dir, "vesktop/main.js"));
|
||||||
.then(() => true)
|
|
||||||
.catch(() => false);
|
|
||||||
|
|
||||||
export async function isValidVencordInstall(dir: string) {
|
|
||||||
return Promise.all(FILES_TO_DOWNLOAD.map(f => existsAsync(join(dir, f)))).then(arr => !arr.includes(false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function ensureVencordFiles() {
|
export async function ensureVencordFiles() {
|
||||||
if (await isValidVencordInstall(VENCORD_FILES_DIR)) return;
|
if (existsSync(VENCORD_DIR)) return;
|
||||||
|
|
||||||
mkdirSync(VENCORD_FILES_DIR, { recursive: true });
|
await downloadVencordAsar();
|
||||||
|
|
||||||
await downloadVencordFiles();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,16 +33,15 @@
|
||||||
|
|
||||||
.vcd-screen-picker-grid label {
|
.vcd-screen-picker-grid label {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 8px;
|
padding: 4px 0px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: grid;
|
|
||||||
justify-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.vcd-screen-picker-grid label:hover {
|
.vcd-screen-picker-grid label:hover {
|
||||||
outline: 2px solid var(--brand-500);
|
outline: 2px solid var(--brand-500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.vcd-screen-picker-grid div {
|
.vcd-screen-picker-grid div {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
@ -102,6 +101,7 @@
|
||||||
.vcd-screen-picker-quality {
|
.vcd-screen-picker-quality {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
|
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
Notifications: [NotificationBadgeToggle],
|
Notifications: [NotificationBadgeToggle],
|
||||||
Miscellaneous: [
|
Miscelleanous: [
|
||||||
{
|
{
|
||||||
key: "arRPC",
|
key: "arRPC",
|
||||||
title: "Rich Presence",
|
title: "Rich Presence",
|
||||||
|
|
Loading…
Reference in a new issue