Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
310e661326
32 changed files with 1927 additions and 1472 deletions
|
@ -1,69 +0,0 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
}
|
31
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
31
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -14,15 +14,29 @@ body:
|
|||
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:
|
||||
- Purely graphical glitches like flickering, scaling issues, etc: Issue with your gpu. Nothing we can do, update drivers or disable hardware acceleration
|
||||
- Purely graphical glitches like flickering, scaling issues[^1]
|
||||
- App crashing / not showing window with mentions of the gpu process in the stacktrace[^1]
|
||||
- Screenshare not starting, black screening or crashing[^2]
|
||||
- Vencord related issues: This is the Vesktop repo, not Vencord
|
||||
- **SCREENSHARE NOT STARTING** / black screening on Linux: Issue with your desktop environment, specifically its xdg-desktop-portal.
|
||||
If you're on flatpak, try using native version. If that also doesn't work, you have to fix your systen. Inspect errors and google around.
|
||||
- Captchas[^3]
|
||||
- Issues with opening URLs[^4]
|
||||
- Issues with Notifications[^4]
|
||||
- Issues with Input Methods[^4]
|
||||
- Issues with File Drag and Drop[^5]
|
||||
- Network Errors[^6]
|
||||
|
||||
Linux users: Please only report issues with supported packages (flatpak and any builds from the README / releases).
|
||||
We do not support other packages, like the AUR or Nix packages, so please first make sure your issue is reproducible with official releases,
|
||||
like [our Flatpak](https://flathub.org/apps/dev.vencord.Vesktop) or [AppImage](https://vencord.dev/download/vesktop/amd64/appimage)
|
||||
|
||||
|
||||
[^1]: GPU issue. Disable hardware acceleration in Vesktop Settings or run with `--disable-gpu`
|
||||
[^2]: System issue. You will have to fix it
|
||||
[^3]: If you are receiving a lot of captchas, it means Discord thinks you might be a bot. Make sure you're not using a VPN/Proxy
|
||||
[^4]: These things are handled by Chromium / Electron, not us. If they don't work, it's either an issue with your system or a bug with Chromium.
|
||||
[^5]: You are likely using the Vesktop flatpak and trying to drop a file the flatpak can't access. You can fix this by installing Flatseal and using it to grant Vesktop full access to your files
|
||||
[^6]: Issue on your end, you have to fix it. Try changing your DNS to [1.1.1.1 (Cloudflare DNS)](https://developers.cloudflare.com/1.1.1.1/setup/)
|
||||
|
||||
- type: input
|
||||
id: discord
|
||||
attributes:
|
||||
|
@ -50,6 +64,15 @@ body:
|
|||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: install-type
|
||||
attributes:
|
||||
label: Package Type
|
||||
description: What kind of Vesktop package are you using? (Setup exe, Portable, Flatpak, AppImage, Deb, etc)
|
||||
placeholder: Flatpak
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: bug-description
|
||||
attributes:
|
||||
|
@ -85,7 +108,7 @@ body:
|
|||
id: debug-logs
|
||||
attributes:
|
||||
label: Debug Logs
|
||||
description: Run vesktop from the command line. Include the relevant command line output here
|
||||
description: Run vesktop from the command line. Include the relevant command line output here. If there are any lines that seem relevant, try googling them or searching existing issues
|
||||
value: |
|
||||
```
|
||||
Replace this text with your crash-log. Do not remove the backticks
|
||||
|
|
2
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
2
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
|
@ -14,6 +14,8 @@ body:
|
|||
This form is only meant for **Vesktop feature requests**.
|
||||
For plugin requests or Vencord feature requests, go [here](https://github.com/Vencord/plugin-requests/issues/new?template=request.yml) instead!
|
||||
|
||||
**DO NOT** make any icon related requests or you will be blocked.
|
||||
|
||||
- type: input
|
||||
id: discord
|
||||
attributes:
|
||||
|
|
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
|
@ -47,7 +47,13 @@ jobs:
|
|||
- name: Run Electron Builder
|
||||
if: ${{ matrix.platform == 'mac' }}
|
||||
run: |
|
||||
echo "$API_KEY" > apple.p8
|
||||
pnpm electron-builder --${{ matrix.platform }} --publish always
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CSC_LINK: ${{ secrets.APPLE_SIGNING_CERT }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.APPLE_SIGNING_CERT_PASSWORD }}
|
||||
API_KEY: ${{ secrets.APPLE_API_KEY }}
|
||||
APPLE_API_KEY: apple.p8
|
||||
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
|
||||
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
|
||||
|
|
2
.github/workflows/winget-submission.yml
vendored
2
.github/workflows/winget-submission.yml
vendored
|
@ -16,7 +16,7 @@ jobs:
|
|||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Submit package to Winget Community Repo
|
||||
uses: vedantmgoyal2009/winget-releaser@4614300d5812e5df91cb02ef0edbece623d5dea8
|
||||
uses: vedantmgoyal2009/winget-releaser@0db4f0a478166abd0fa438c631849f0b8dcfb99f
|
||||
with:
|
||||
identifier: Vencord.Vesktop
|
||||
token: ${{ secrets.WINGET_PAT }}
|
||||
|
|
13
README.md
13
README.md
|
@ -21,15 +21,14 @@ Vesktop is a custom Discord desktop app
|
|||
|
||||
If you don't know the difference, pick the Installer.
|
||||
|
||||
- [Installer](https://vencord.dev/download/vesktop/amd64/windows)
|
||||
- [Portable](https://vencord.dev/download/vesktop/amd64/windows-portable)
|
||||
- [Installer](https://vencord.dev/download/vesktop/universal/windows)
|
||||
- Portable:
|
||||
- [x64 / amd64](https://vencord.dev/download/vesktop/amd64/windows-portable)
|
||||
- [Arm® 64](https://vencord.dev/download/vesktop/arm64/windows-portable)
|
||||
|
||||
### Mac
|
||||
|
||||
If you don't know the difference, pick the Intel build.
|
||||
|
||||
- [Intel build (amd64)](https://vencord.dev/download/vesktop/amd64/dmg)
|
||||
- [Apple Silicon (arm64)](https://vencord.dev/download/vesktop/arm64/dmg)
|
||||
[Vesktop.dmg](https://vencord.dev/download/vesktop/universal/dmg)
|
||||
|
||||
### Linux
|
||||
|
||||
|
@ -42,7 +41,7 @@ If you don't know the difference, pick amd64.
|
|||
- [Ubuntu/Debian (.deb)](https://vencord.dev/download/vesktop/amd64/deb)
|
||||
- [Fedora/RHEL (.rpm)](https://vencord.dev/download/vesktop/amd64/rpm)
|
||||
- [tarball](https://vencord.dev/download/vesktop/amd64/tar)
|
||||
- arm64 / aarch64
|
||||
- Arm® 64 / aarch64
|
||||
- [AppImage](https://vencord.dev/download/vesktop/arm64/appimage)
|
||||
- [Ubuntu/Debian (.deb)](https://vencord.dev/download/vesktop/arm64/deb)
|
||||
- [Fedora/RHEL (.rpm)](https://vencord.dev/download/vesktop/arm64/rpm)
|
||||
|
|
102
eslint.config.mjs
Normal file
102
eslint.config.mjs
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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"
|
||||
}
|
||||
}
|
||||
);
|
|
@ -28,6 +28,34 @@
|
|||
</screenshot>
|
||||
</screenshots>
|
||||
<releases>
|
||||
<release version="1.5.3" date="2024-07-04" type="stable">
|
||||
<url>https://github.com/Vencord/Vesktop/releases/tag/v1.5.3</url>
|
||||
<description>
|
||||
<p>Features</p>
|
||||
<ul>
|
||||
<li>added arm64 Windows support</li>
|
||||
<li>windows & macOS builds are now universal</li>
|
||||
<li>added option to configure spellcheck languages</li>
|
||||
<li>will auto-update from now on</li>
|
||||
<li>updated electron to 31 & Chromium to 126</li>
|
||||
<li>macOS: Added customized dmg background by @khcrysalis</li>
|
||||
<li>Windows Portable: store settings in portable folder by @MrGarlic1</li>
|
||||
<li>linux audioshare: added granular selection, more options, better ui by @Curve</li>
|
||||
<li>changed default screen-sharing quality to 720p 30 FPS by @Tiagoquix</li>
|
||||
</ul>
|
||||
<p>Fixes</p>
|
||||
<ul>
|
||||
<li>macOS: Added workaround for making things in draggable area clickable by @HAHALOSAH</li>
|
||||
<li>fixed Screenshare UI for non-linux systems by @PolisanTheEasyNick</li>
|
||||
<li>fixed opening on screen that was disconnected by @MrGarlic1</li>
|
||||
<li>mac: hide native window controls with custom titlebar enabled by @MrGarlic1</li>
|
||||
<li>fixed some broken patches by @D3SOX</li>
|
||||
<li>fixed framerate in constraints by @kittykel</li>
|
||||
<li>fixed some first launch switches not applying</li>
|
||||
<li>fixed potential sandbox escape via custom vencord location</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="1.5.2" date="2024-05-01" type="stable">
|
||||
<url>https://github.com/Vencord/Vesktop/releases/tag/v1.5.2</url>
|
||||
<description>
|
||||
|
|
59
package.json
59
package.json
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "vesktop",
|
||||
"version": "1.5.2",
|
||||
"version": "1.5.3",
|
||||
"private": true,
|
||||
"description": "",
|
||||
"description": "Vesktop is a custom Discord desktop app",
|
||||
"keywords": [],
|
||||
"homepage": "https://vencord.dev/",
|
||||
"license": "GPL-3.0",
|
||||
|
@ -13,7 +13,7 @@
|
|||
"build:dev": "pnpm build --dev",
|
||||
"package": "pnpm build && electron-builder",
|
||||
"package:dir": "pnpm build && electron-builder --dir",
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.mts,.mjs",
|
||||
"lint": "eslint",
|
||||
"lint:fix": "pnpm lint --fix",
|
||||
"start": "pnpm build && electron .",
|
||||
"start:dev": "pnpm build:dev && electron .",
|
||||
|
@ -24,7 +24,8 @@
|
|||
"updateMeta": "tsx scripts/utils/updateMeta.mts"
|
||||
},
|
||||
"dependencies": {
|
||||
"arrpc": "github:OpenAsar/arrpc#c62ec6a04c8d870530aa6944257fe745f6c59a24"
|
||||
"arrpc": "github:OpenAsar/arrpc#5aadc307cb9bf4479f0a12364a253b07a77ace22",
|
||||
"electron-updater": "^6.3.4"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@vencord/venmic": "^6.1.0",
|
||||
|
@ -32,29 +33,28 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
||||
"@types/node": "^20.11.26",
|
||||
"@types/react": "^18.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
||||
"@typescript-eslint/parser": "^7.2.0",
|
||||
"@stylistic/eslint-plugin": "^2.8.0",
|
||||
"@types/node": "^22.5.5",
|
||||
"@types/react": "^18.3.8",
|
||||
"@vencord/types": "^1.8.4",
|
||||
"dotenv": "^16.4.5",
|
||||
"electron": "^31.0.1",
|
||||
"electron-builder": "^24.13.3",
|
||||
"esbuild": "^0.20.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"electron": "^32.1.2",
|
||||
"electron-builder": "^25.0.5",
|
||||
"esbuild": "^0.23.1",
|
||||
"eslint": "^9.11.0",
|
||||
"eslint-import-resolver-alias": "^1.1.2",
|
||||
"eslint-plugin-license-header": "^0.6.0",
|
||||
"eslint-plugin-path-alias": "^1.0.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-simple-import-sort": "^12.0.0",
|
||||
"eslint-plugin-unused-imports": "^3.1.0",
|
||||
"prettier": "^3.2.5",
|
||||
"eslint-plugin-path-alias": "^2.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-simple-header": "^1.2.1",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"eslint-plugin-unused-imports": "^4.1.4",
|
||||
"prettier": "^3.3.3",
|
||||
"source-map-support": "^0.5.21",
|
||||
"tsx": "^4.7.1",
|
||||
"type-fest": "^4.12.0",
|
||||
"typescript": "^5.4.2",
|
||||
"xml-formatter": "^3.6.2"
|
||||
"tsx": "^4.19.1",
|
||||
"type-fest": "^4.26.1",
|
||||
"typescript": "^5.6.2",
|
||||
"typescript-eslint": "^8.6.0",
|
||||
"xml-formatter": "^3.6.3"
|
||||
},
|
||||
"packageManager": "pnpm@9.1.0",
|
||||
"engines": {
|
||||
|
@ -124,13 +124,15 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"category": "Network",
|
||||
"category": "public.app-category.social-networking",
|
||||
"darkModeSupport": true,
|
||||
"extendInfo": {
|
||||
"NSMicrophoneUsageDescription": "This app needs access to the microphone",
|
||||
"NSCameraUsageDescription": "This app needs access to the camera",
|
||||
"com.apple.security.device.audio-input": true,
|
||||
"com.apple.security.device.camera": true
|
||||
}
|
||||
},
|
||||
"notarize": true
|
||||
},
|
||||
"dmg": {
|
||||
"background": "build/background.tiff",
|
||||
|
@ -177,11 +179,16 @@
|
|||
},
|
||||
"publish": {
|
||||
"provider": "github"
|
||||
},
|
||||
"rpm": {
|
||||
"fpm": [
|
||||
"--rpm-rpmbuild-define=_build_id_links none"
|
||||
]
|
||||
}
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"arrpc@3.4.0": "patches/arrpc@3.4.0.patch"
|
||||
"arrpc@3.5.0": "patches/arrpc@3.5.0.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2681
pnpm-lock.yaml
2681
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -63,12 +63,6 @@ await Promise.all([
|
|||
outfile: "dist/js/preload.js",
|
||||
footer: { js: "//# sourceURL=VCDPreload" }
|
||||
}),
|
||||
createContext({
|
||||
...NodeCommonOpts,
|
||||
entryPoints: ["src/updater/preload.ts"],
|
||||
outfile: "dist/js/updaterPreload.js",
|
||||
footer: { js: "//# sourceURL=VCDUpdaterPreload" }
|
||||
}),
|
||||
createContext({
|
||||
...CommonOpts,
|
||||
globalName: "Vesktop",
|
||||
|
|
|
@ -37,7 +37,8 @@ if (existsSync(LEGACY_DATA_DIR)) {
|
|||
console.error("Migration failed", e);
|
||||
}
|
||||
}
|
||||
app.setPath("sessionData", join(DATA_DIR, "sessionData"));
|
||||
const SESSION_DATA_DIR = join(DATA_DIR, "sessionData");
|
||||
app.setPath("sessionData", SESSION_DATA_DIR);
|
||||
|
||||
export const VENCORD_SETTINGS_DIR = join(DATA_DIR, "settings");
|
||||
export const VENCORD_QUICKCSS_FILE = join(VENCORD_SETTINGS_DIR, "quickCss.css");
|
||||
|
@ -47,7 +48,8 @@ export const VENCORD_THEMES_DIR = join(DATA_DIR, "themes");
|
|||
// needs to be inline require because of circular dependency
|
||||
// as otherwise "DATA_DIR" (which is used by ./settings) will be uninitialised
|
||||
export const VENCORD_FILES_DIR =
|
||||
(require("./settings") as typeof import("./settings")).Settings.store.vencordDir || join(DATA_DIR, "vencordDist");
|
||||
(require("./settings") as typeof import("./settings")).State.store.vencordDir ||
|
||||
join(SESSION_DATA_DIR, "vencordFiles");
|
||||
|
||||
export const USER_AGENT = `Vesktop/${app.getVersion()} (https://github.com/Vencord/Vesktop)`;
|
||||
|
||||
|
@ -59,11 +61,11 @@ export const DEFAULT_HEIGHT = 720;
|
|||
|
||||
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 = {
|
||||
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/122.0.0.0 Safari/537.36",
|
||||
windows:
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
|
||||
darwin: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ${VersionString}`,
|
||||
linux: `Mozilla/5.0 (X11; Linux x86_64) ${VersionString}`,
|
||||
windows: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) ${VersionString}`
|
||||
};
|
||||
|
||||
export const BrowserUserAgent = BrowserUserAgents[process.platform] || BrowserUserAgents.windows;
|
||||
|
|
|
@ -18,11 +18,11 @@ import { Settings, State } from "./settings";
|
|||
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
|
||||
|
||||
interface Data {
|
||||
minimizeToTray: boolean;
|
||||
discordBranch: "stable" | "canary" | "ptb";
|
||||
autoStart: boolean;
|
||||
importSettings: boolean;
|
||||
richPresence: boolean;
|
||||
minimizeToTray?: "on";
|
||||
autoStart?: "on";
|
||||
importSettings?: "on";
|
||||
richPresence?: "on";
|
||||
}
|
||||
|
||||
export function createFirstLaunchTour() {
|
||||
|
@ -44,10 +44,11 @@ export function createFirstLaunchTour() {
|
|||
if (!msg.startsWith("form:")) return;
|
||||
const data = JSON.parse(msg.slice(5)) as Data;
|
||||
|
||||
console.log(data);
|
||||
State.store.firstLaunch = false;
|
||||
Settings.store.minimizeToTray = data.minimizeToTray;
|
||||
Settings.store.discordBranch = data.discordBranch;
|
||||
Settings.store.arRPC = data.richPresence;
|
||||
Settings.store.minimizeToTray = !!data.minimizeToTray;
|
||||
Settings.store.arRPC = !!data.richPresence;
|
||||
|
||||
if (data.autoStart) autoStart.enable();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import "./ipc";
|
||||
|
||||
import { app, BrowserWindow, nativeTheme } from "electron";
|
||||
import { checkUpdates } from "updater/main";
|
||||
import { autoUpdater } from "electron-updater";
|
||||
|
||||
import { DATA_DIR } from "./constants";
|
||||
import { createFirstLaunchTour } from "./firstLaunch";
|
||||
|
@ -19,6 +19,8 @@ import { isDeckGameMode } from "./utils/steamOS";
|
|||
|
||||
if (IS_DEV) {
|
||||
require("source-map-support").install();
|
||||
} else {
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
}
|
||||
|
||||
// Make the Vencord files use our DATA_DIR
|
||||
|
@ -74,7 +76,6 @@ function init() {
|
|||
});
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
checkUpdates();
|
||||
if (process.platform === "win32") app.setAppUserModelId("dev.vencord.vesktop");
|
||||
|
||||
registerScreenShareHandler();
|
||||
|
|
|
@ -19,7 +19,7 @@ import { setBadgeCount } from "./appBadge";
|
|||
import { autoStart } from "./autoStart";
|
||||
import { VENCORD_FILES_DIR, VENCORD_QUICKCSS_FILE, VENCORD_THEMES_DIR } from "./constants";
|
||||
import { mainWin } from "./mainWindow";
|
||||
import { Settings } from "./settings";
|
||||
import { Settings, State } from "./settings";
|
||||
import { handle, handleSync } from "./utils/ipcWrappers";
|
||||
import { PopoutWindows } from "./utils/popout";
|
||||
import { isDeckGameMode, showGamePage } from "./utils/steamOS";
|
||||
|
@ -105,7 +105,14 @@ handle(IpcEvents.SPELLCHECK_ADD_TO_DICTIONARY, (e, word: string) => {
|
|||
e.sender.session.addWordToSpellCheckerDictionary(word);
|
||||
});
|
||||
|
||||
handle(IpcEvents.SELECT_VENCORD_DIR, async () => {
|
||||
handleSync(IpcEvents.GET_VENCORD_DIR, e => (e.returnValue = State.store.vencordDir));
|
||||
|
||||
handle(IpcEvents.SELECT_VENCORD_DIR, async (_e, value?: null) => {
|
||||
if (value === null) {
|
||||
delete State.store.vencordDir;
|
||||
return "ok";
|
||||
}
|
||||
|
||||
const res = await dialog.showOpenDialog(mainWin!, {
|
||||
properties: ["openDirectory"]
|
||||
});
|
||||
|
@ -114,7 +121,9 @@ handle(IpcEvents.SELECT_VENCORD_DIR, async () => {
|
|||
const dir = res.filePaths[0];
|
||||
if (!isValidVencordInstall(dir)) return "invalid";
|
||||
|
||||
return dir;
|
||||
State.store.vencordDir = dir;
|
||||
|
||||
return "ok";
|
||||
});
|
||||
|
||||
handle(IpcEvents.SET_BADGE_COUNT, (_, count: number) => setBadgeCount(count));
|
||||
|
|
|
@ -91,7 +91,7 @@ function initTray(win: BrowserWindow) {
|
|||
click: createAboutWindow
|
||||
},
|
||||
{
|
||||
label: "Update Vencord",
|
||||
label: "Repair Vencord",
|
||||
async click() {
|
||||
await downloadVencordFiles();
|
||||
app.relaunch();
|
||||
|
@ -108,14 +108,14 @@ function initTray(win: BrowserWindow) {
|
|||
type: "separator"
|
||||
},
|
||||
{
|
||||
label: "Relaunch",
|
||||
label: "Restart",
|
||||
click() {
|
||||
app.relaunch();
|
||||
app.quit();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Quit Vesktop",
|
||||
label: "Quit",
|
||||
click() {
|
||||
isQuitting = true;
|
||||
app.quit();
|
||||
|
@ -503,5 +503,17 @@ 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();
|
||||
}
|
||||
|
|
|
@ -41,14 +41,7 @@ export const VencordSettings = loadSettings<any>(VENCORD_SETTINGS_FILE, "Vencord
|
|||
if (Object.hasOwn(Settings.plain, "firstLaunch") && !existsSync(STATE_FILE)) {
|
||||
console.warn("legacy state in settings.json detected. migrating to state.json");
|
||||
const state = {} as TState;
|
||||
for (const prop of [
|
||||
"firstLaunch",
|
||||
"maximized",
|
||||
"minimized",
|
||||
"skippedUpdate",
|
||||
"steamOSLayoutVersion",
|
||||
"windowBounds"
|
||||
] as const) {
|
||||
for (const prop of ["firstLaunch", "maximized", "minimized", "steamOSLayoutVersion", "windowBounds"] as const) {
|
||||
state[prop] = Settings.plain[prop];
|
||||
delete Settings.plain[prop];
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||
*/
|
||||
|
||||
import { existsSync, mkdirSync } from "fs";
|
||||
import { mkdirSync } from "fs";
|
||||
import { access, constants as FsConstants } from "fs/promises";
|
||||
import { join } from "path";
|
||||
|
||||
import { USER_AGENT, VENCORD_FILES_DIR } from "../constants";
|
||||
|
@ -56,12 +57,18 @@ export async function downloadVencordFiles() {
|
|||
);
|
||||
}
|
||||
|
||||
export function isValidVencordInstall(dir: string) {
|
||||
return FILES_TO_DOWNLOAD.every(f => existsSync(join(dir, f)));
|
||||
const existsAsync = (path: string) =>
|
||||
access(path, FsConstants.F_OK)
|
||||
.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() {
|
||||
if (isValidVencordInstall(VENCORD_FILES_DIR)) return;
|
||||
if (await isValidVencordInstall(VENCORD_FILES_DIR)) return;
|
||||
|
||||
mkdirSync(VENCORD_FILES_DIR, { recursive: true });
|
||||
|
||||
await downloadVencordFiles();
|
||||
|
|
|
@ -72,7 +72,7 @@ ipcMain.handle(IpcEvents.VIRT_MIC_LIST, () => {
|
|||
const { granularSelect } = Settings.store.audio ?? {};
|
||||
|
||||
const targets = obtainVenmic()
|
||||
?.list(granularSelect ? ["application.process.id"] : undefined)
|
||||
?.list(granularSelect ? ["node.name"] : undefined)
|
||||
.filter(s => s["application.process.id"] !== audioPid);
|
||||
|
||||
return targets ? { ok: true, targets, hasPipewirePulse } : { ok: false, isGlibCxxOutdated };
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
import { Node } from "@vencord/venmic";
|
||||
import { ipcRenderer } from "electron";
|
||||
import type { Settings } from "shared/settings";
|
||||
import type { LiteralUnion } from "type-fest";
|
||||
|
||||
import { IpcEvents } from "../shared/IpcEvents";
|
||||
import { invoke, sendSync } from "./typedIpc";
|
||||
|
@ -34,7 +33,8 @@ export const VesktopNative = {
|
|||
},
|
||||
fileManager: {
|
||||
showItemInFolder: (path: string) => invoke<void>(IpcEvents.SHOW_ITEM_IN_FOLDER, path),
|
||||
selectVencordDir: () => invoke<LiteralUnion<"cancelled" | "invalid", string>>(IpcEvents.SELECT_VENCORD_DIR)
|
||||
getVencordDir: () => sendSync<string | undefined>(IpcEvents.GET_VENCORD_DIR),
|
||||
selectVencordDir: (value?: null) => invoke<"cancelled" | "invalid" | "ok">(IpcEvents.SELECT_VENCORD_DIR, value)
|
||||
},
|
||||
settings: {
|
||||
get: () => sendSync<Settings>(IpcEvents.GET_SETTINGS),
|
||||
|
|
|
@ -254,7 +254,13 @@ function AudioSettingsModal({
|
|||
</Switch>
|
||||
<Switch
|
||||
hideBorder
|
||||
onChange={v => (Settings.audio = { ...Settings.audio, ignoreDevices: v })}
|
||||
onChange={v =>
|
||||
(Settings.audio = {
|
||||
...Settings.audio,
|
||||
ignoreDevices: v,
|
||||
deviceSelect: v ? false : Settings.audio?.deviceSelect
|
||||
})
|
||||
}
|
||||
value={Settings.audio?.ignoreDevices ?? true}
|
||||
note={<>Exclude device nodes, such as nodes belonging to microphones or speakers.</>}
|
||||
>
|
||||
|
@ -271,6 +277,23 @@ function AudioSettingsModal({
|
|||
>
|
||||
Granular Selection
|
||||
</Switch>
|
||||
<Switch
|
||||
hideBorder
|
||||
onChange={value => {
|
||||
Settings.audio = { ...Settings.audio, deviceSelect: value };
|
||||
setAudioSources("None");
|
||||
}}
|
||||
value={Settings.audio?.deviceSelect ?? false}
|
||||
disabled={Settings.audio?.ignoreDevices}
|
||||
note={
|
||||
<>
|
||||
Allow to select devices such as microphones. Requires <b>Ignore Devices</b> to be turned
|
||||
off.
|
||||
</>
|
||||
}
|
||||
>
|
||||
Device Selection
|
||||
</Switch>
|
||||
</Modals.ModalContent>
|
||||
<Modals.ModalFooter className="vcd-screen-picker-footer">
|
||||
<Button color={Button.Colors.TRANSPARENT} onClick={close}>
|
||||
|
@ -423,6 +446,7 @@ function StreamSettings({
|
|||
openSettings={openSettings}
|
||||
includeSources={settings.includeSources}
|
||||
excludeSources={settings.excludeSources}
|
||||
deviceSelect={Settings.audio?.deviceSelect}
|
||||
granularSelect={Settings.audio?.granularSelect}
|
||||
setIncludeSources={sources => setSettings(s => ({ ...s, includeSources: sources }))}
|
||||
setExcludeSources={sources => setSettings(s => ({ ...s, excludeSources: sources }))}
|
||||
|
@ -441,13 +465,23 @@ function hasMatchingProps(value: Node, other: Node) {
|
|||
return Object.keys(value).every(key => value[key] === other[key]);
|
||||
}
|
||||
|
||||
function mapToAudioItem(node: AudioSource, granularSelect?: boolean): AudioItem[] {
|
||||
function mapToAudioItem(node: AudioSource, granularSelect?: boolean, deviceSelect?: boolean): AudioItem[] {
|
||||
if (isSpecialSource(node)) {
|
||||
return [{ name: node, value: node }];
|
||||
}
|
||||
|
||||
const rtn: AudioItem[] = [];
|
||||
|
||||
const mediaClass = node["media.class"];
|
||||
|
||||
if (mediaClass?.includes("Video") || mediaClass?.includes("Midi")) {
|
||||
return rtn;
|
||||
}
|
||||
|
||||
if (!deviceSelect && node["device.id"]) {
|
||||
return rtn;
|
||||
}
|
||||
|
||||
const name = node["application.name"];
|
||||
|
||||
if (name) {
|
||||
|
@ -458,9 +492,15 @@ function mapToAudioItem(node: AudioSource, granularSelect?: boolean): AudioItem[
|
|||
return rtn;
|
||||
}
|
||||
|
||||
const binary = node["application.process.binary"];
|
||||
const rawName = node["node.name"];
|
||||
|
||||
if (!name) {
|
||||
rtn.push({ name: rawName, value: { "node.name": rawName } });
|
||||
}
|
||||
|
||||
const binary = node["application.process.binary"];
|
||||
|
||||
if (!name && binary) {
|
||||
rtn.push({ name: binary, value: { "application.process.binary": binary } });
|
||||
}
|
||||
|
||||
|
@ -469,10 +509,12 @@ function mapToAudioItem(node: AudioSource, granularSelect?: boolean): AudioItem[
|
|||
const first = rtn[0];
|
||||
const firstValues = first.value as Node;
|
||||
|
||||
if (pid) {
|
||||
rtn.push({
|
||||
name: `${first.name} (${pid})`,
|
||||
value: { ...firstValues, "application.process.id": pid }
|
||||
});
|
||||
}
|
||||
|
||||
const mediaName = node["media.name"];
|
||||
|
||||
|
@ -483,16 +525,12 @@ function mapToAudioItem(node: AudioSource, granularSelect?: boolean): AudioItem[
|
|||
});
|
||||
}
|
||||
|
||||
const mediaClass = node["media.class"];
|
||||
|
||||
if (!mediaClass) {
|
||||
return rtn;
|
||||
}
|
||||
|
||||
if (mediaClass) {
|
||||
rtn.push({
|
||||
name: `${first.name} [${mediaClass}]`,
|
||||
value: { ...firstValues, "media.class": mediaClass }
|
||||
});
|
||||
}
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
@ -535,6 +573,7 @@ function updateItems(setSources: (s: AudioSources) => void, sources?: AudioSourc
|
|||
function AudioSourcePickerLinux({
|
||||
includeSources,
|
||||
excludeSources,
|
||||
deviceSelect,
|
||||
granularSelect,
|
||||
openSettings,
|
||||
setIncludeSources,
|
||||
|
@ -542,6 +581,7 @@ function AudioSourcePickerLinux({
|
|||
}: {
|
||||
includeSources?: AudioSources;
|
||||
excludeSources?: AudioSources;
|
||||
deviceSelect?: boolean;
|
||||
granularSelect?: boolean;
|
||||
openSettings: () => void;
|
||||
setIncludeSources: (s: AudioSources) => void;
|
||||
|
@ -592,7 +632,7 @@ function AudioSourcePickerLinux({
|
|||
|
||||
const allSources = sources.ok
|
||||
? [...specialSources, ...sources.targets]
|
||||
.map(target => mapToAudioItem(target, granularSelect))
|
||||
.map(target => mapToAudioItem(target, granularSelect, deviceSelect))
|
||||
.flat()
|
||||
.filter(uniqueName)
|
||||
: [];
|
||||
|
@ -721,7 +761,7 @@ function ModalComponent({
|
|||
|
||||
const constraints = {
|
||||
...track.getConstraints(),
|
||||
frameRate,
|
||||
frameRate: { min: frameRate, ideal: frameRate },
|
||||
width: { min: 640, ideal: width, max: width },
|
||||
height: { min: 480, ideal: height, max: height },
|
||||
advanced: [{ width: width, height: height }],
|
||||
|
|
|
@ -102,15 +102,7 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
|
|||
defaultValue: false
|
||||
}
|
||||
],
|
||||
"Notifications & Updates": [
|
||||
NotificationBadgeToggle,
|
||||
{
|
||||
key: "checkUpdates",
|
||||
title: "Check for updates",
|
||||
description: "Automatically check for Vesktop updates",
|
||||
defaultValue: true
|
||||
}
|
||||
],
|
||||
Notifications: [NotificationBadgeToggle],
|
||||
Miscelleanous: [
|
||||
{
|
||||
key: "arRPC",
|
||||
|
|
|
@ -4,24 +4,28 @@
|
|||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||
*/
|
||||
|
||||
import { useForceUpdater } from "@vencord/types/utils";
|
||||
import { Button, Forms, Toasts } from "@vencord/types/webpack/common";
|
||||
|
||||
import { SettingsComponent } from "./Settings";
|
||||
|
||||
export const VencordLocationPicker: SettingsComponent = ({ settings }) => {
|
||||
const forceUpdate = useForceUpdater();
|
||||
const vencordDir = VesktopNative.fileManager.getVencordDir();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Forms.FormText>
|
||||
Vencord files are loaded from{" "}
|
||||
{settings.vencordDir ? (
|
||||
{vencordDir ? (
|
||||
<a
|
||||
href="about:blank"
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
VesktopNative.fileManager.showItemInFolder(settings.vencordDir!);
|
||||
VesktopNative.fileManager.showItemInFolder(vencordDir!);
|
||||
}}
|
||||
>
|
||||
{settings.vencordDir}
|
||||
{vencordDir}
|
||||
</a>
|
||||
) : (
|
||||
"the default location"
|
||||
|
@ -34,7 +38,14 @@ export const VencordLocationPicker: SettingsComponent = ({ settings }) => {
|
|||
const choice = await VesktopNative.fileManager.selectVencordDir();
|
||||
switch (choice) {
|
||||
case "cancelled":
|
||||
return;
|
||||
break;
|
||||
case "ok":
|
||||
Toasts.show({
|
||||
message: "Vencord install changed. Fully restart Vesktop to apply.",
|
||||
id: Toasts.genId(),
|
||||
type: Toasts.Type.SUCCESS
|
||||
});
|
||||
break;
|
||||
case "invalid":
|
||||
Toasts.show({
|
||||
message:
|
||||
|
@ -42,9 +53,9 @@ export const VencordLocationPicker: SettingsComponent = ({ settings }) => {
|
|||
id: Toasts.genId(),
|
||||
type: Toasts.Type.FAILURE
|
||||
});
|
||||
return;
|
||||
break;
|
||||
}
|
||||
settings.vencordDir = choice;
|
||||
forceUpdate();
|
||||
}}
|
||||
>
|
||||
Change
|
||||
|
@ -52,7 +63,10 @@ export const VencordLocationPicker: SettingsComponent = ({ settings }) => {
|
|||
<Button
|
||||
size={Button.Sizes.SMALL}
|
||||
color={Button.Colors.RED}
|
||||
onClick={() => (settings.vencordDir = void 0)}
|
||||
onClick={async () => {
|
||||
await VesktopNative.fileManager.selectVencordDir(null);
|
||||
forceUpdate();
|
||||
}}
|
||||
>
|
||||
Reset
|
||||
</Button>
|
||||
|
|
|
@ -9,3 +9,8 @@
|
|||
scrollbar-width: unset !important;
|
||||
scrollbar-color: unset !important;
|
||||
}
|
||||
|
||||
/* Workaround for making things in the draggable area clickable again on macOS */
|
||||
.platform-osx [class*=topic_], .platform-osx [class*=notice_] button {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ console.log("read if cute :3");
|
|||
|
||||
export * as Components from "./components";
|
||||
import { findByPropsLazy, onceReady } from "@vencord/types/webpack";
|
||||
import { FluxDispatcher } from "@vencord/types/webpack/common";
|
||||
import { Alerts, FluxDispatcher } from "@vencord/types/webpack/common";
|
||||
|
||||
import SettingsUi from "./components/settings/Settings";
|
||||
import { Settings } from "./settings";
|
||||
|
@ -59,3 +59,19 @@ VesktopNative.arrpc.onActivity(async data => {
|
|||
|
||||
arRPC.handleEvent(new MessageEvent("message", { data }));
|
||||
});
|
||||
|
||||
// TODO: remove soon
|
||||
const vencordDir = "vencordDir" as keyof typeof Settings.store;
|
||||
if (Settings.store[vencordDir]) {
|
||||
onceReady.then(() =>
|
||||
setTimeout(
|
||||
() =>
|
||||
Alerts.show({
|
||||
title: "Custom Vencord Location",
|
||||
body: "Due to security hardening changes in Vesktop, your custom Vencord location had to be reset. Please configure it again in the settings.",
|
||||
onConfirm: () => delete Settings.store[vencordDir]
|
||||
}),
|
||||
5000
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ if (isLinux) {
|
|||
|
||||
const constraints = {
|
||||
...track.getConstraints(),
|
||||
frameRate,
|
||||
frameRate: { min: frameRate, ideal: frameRate },
|
||||
width: { min: 640, ideal: width, max: width },
|
||||
height: { min: 480, ideal: height, max: height },
|
||||
advanced: [{ width: width, height: height }],
|
||||
|
|
|
@ -23,6 +23,7 @@ export const enum IpcEvents {
|
|||
GET_SETTINGS = "VCD_GET_SETTINGS",
|
||||
SET_SETTINGS = "VCD_SET_SETTINGS",
|
||||
|
||||
GET_VENCORD_DIR = "VCD_GET_VENCORD_DIR",
|
||||
SELECT_VENCORD_DIR = "VCD_SELECT_VENCORD_DIR",
|
||||
|
||||
UPDATER_GET_DATA = "VCD_UPDATER_GET_DATA",
|
||||
|
|
8
src/shared/settings.d.ts
vendored
8
src/shared/settings.d.ts
vendored
|
@ -8,7 +8,6 @@ import type { Rectangle } from "electron";
|
|||
|
||||
export interface Settings {
|
||||
discordBranch?: "stable" | "canary" | "ptb";
|
||||
vencordDir?: string;
|
||||
transparencyOption?: "none" | "mica" | "tabbed" | "acrylic";
|
||||
tray?: boolean;
|
||||
minimizeToTray?: boolean;
|
||||
|
@ -23,8 +22,6 @@ export interface Settings {
|
|||
clickTrayToShowHide?: boolean;
|
||||
customTitleBar?: boolean;
|
||||
|
||||
checkUpdates?: boolean;
|
||||
|
||||
splashTheming?: boolean;
|
||||
splashColor?: string;
|
||||
splashBackground?: string;
|
||||
|
@ -33,6 +30,8 @@ export interface Settings {
|
|||
|
||||
audio?: {
|
||||
workaround?: boolean;
|
||||
|
||||
deviceSelect?: boolean;
|
||||
granularSelect?: boolean;
|
||||
|
||||
ignoreVirtual?: boolean;
|
||||
|
@ -50,8 +49,9 @@ export interface State {
|
|||
windowBounds?: Rectangle;
|
||||
displayid: int;
|
||||
|
||||
skippedUpdate?: string;
|
||||
firstLaunch?: boolean;
|
||||
|
||||
steamOSLayoutVersion?: number;
|
||||
|
||||
vencordDir?: string;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,19 @@ export class SettingsStore<T extends object> {
|
|||
self.pathListeners.get(setPath)?.forEach(cb => cb(value));
|
||||
|
||||
return true;
|
||||
},
|
||||
deleteProperty(target, key: string) {
|
||||
if (!(key in target)) return true;
|
||||
|
||||
const res = Reflect.deleteProperty(target, key);
|
||||
if (!res) return false;
|
||||
|
||||
const setPath = `${path}${path && "."}${key}`;
|
||||
|
||||
self.globalListeners.forEach(cb => cb(root, setPath));
|
||||
self.pathListeners.get(setPath)?.forEach(cb => cb(undefined));
|
||||
|
||||
return res;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,115 +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
|
||||
*/
|
||||
|
||||
import { app, BrowserWindow, shell } from "electron";
|
||||
import { PORTABLE } from "main/constants";
|
||||
import { Settings, State } from "main/settings";
|
||||
import { handle } from "main/utils/ipcWrappers";
|
||||
import { makeLinksOpenExternally } from "main/utils/makeLinksOpenExternally";
|
||||
import { githubGet, ReleaseData } from "main/utils/vencordLoader";
|
||||
import { join } from "path";
|
||||
import { IpcEvents } from "shared/IpcEvents";
|
||||
import { ICON_PATH, VIEW_DIR } from "shared/paths";
|
||||
|
||||
export interface UpdateData {
|
||||
currentVersion: string;
|
||||
latestVersion: string;
|
||||
release: ReleaseData;
|
||||
}
|
||||
|
||||
let updateData: UpdateData;
|
||||
|
||||
handle(IpcEvents.UPDATER_GET_DATA, () => updateData);
|
||||
handle(IpcEvents.UPDATER_DOWNLOAD, () => {
|
||||
const { assets } = updateData.release;
|
||||
const url = (() => {
|
||||
switch (process.platform) {
|
||||
case "win32":
|
||||
return assets.find(a => {
|
||||
return a.name.endsWith(PORTABLE ? "win.zip" : ".exe");
|
||||
})!.browser_download_url;
|
||||
case "darwin":
|
||||
return assets.find(a =>
|
||||
process.arch === "arm64"
|
||||
? a.name.endsWith("-arm64-mac.zip")
|
||||
: a.name.endsWith("-mac.zip") && !a.name.includes("arm64")
|
||||
)!.browser_download_url;
|
||||
case "linux":
|
||||
return updateData.release.html_url;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${process.platform}`);
|
||||
}
|
||||
})();
|
||||
|
||||
shell.openExternal(url);
|
||||
});
|
||||
|
||||
handle(IpcEvents.UPDATE_IGNORE, () => {
|
||||
State.store.skippedUpdate = updateData.latestVersion;
|
||||
});
|
||||
|
||||
function isOutdated(oldVersion: string, newVersion: string) {
|
||||
const oldParts = oldVersion.split(".");
|
||||
const newParts = newVersion.split(".");
|
||||
|
||||
if (oldParts.length !== newParts.length)
|
||||
throw new Error(`Incompatible version strings (old: ${oldVersion}, new: ${newVersion})`);
|
||||
|
||||
for (let i = 0; i < oldParts.length; i++) {
|
||||
const oldPart = Number(oldParts[i]);
|
||||
const newPart = Number(newParts[i]);
|
||||
|
||||
if (isNaN(oldPart) || isNaN(newPart))
|
||||
throw new Error(`Invalid version string (old: ${oldVersion}, new: ${newVersion})`);
|
||||
|
||||
if (oldPart < newPart) return true;
|
||||
if (oldPart > newPart) return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export async function checkUpdates() {
|
||||
if (Settings.store.checkUpdates === false) return;
|
||||
|
||||
try {
|
||||
const raw = await githubGet("/repos/Vencord/Vesktop/releases/latest");
|
||||
const data: ReleaseData = await raw.json();
|
||||
|
||||
const oldVersion = app.getVersion();
|
||||
const newVersion = data.tag_name.replace(/^v/, "");
|
||||
updateData = {
|
||||
currentVersion: oldVersion,
|
||||
latestVersion: newVersion,
|
||||
release: data
|
||||
};
|
||||
|
||||
if (State.store.skippedUpdate !== newVersion && isOutdated(oldVersion, newVersion)) {
|
||||
openNewUpdateWindow();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("AppUpdater: Failed to check for updates\n", e);
|
||||
}
|
||||
}
|
||||
|
||||
function openNewUpdateWindow() {
|
||||
const win = new BrowserWindow({
|
||||
width: 500,
|
||||
autoHideMenuBar: true,
|
||||
alwaysOnTop: true,
|
||||
webPreferences: {
|
||||
preload: join(__dirname, "updaterPreload.js"),
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
sandbox: true
|
||||
},
|
||||
icon: ICON_PATH
|
||||
});
|
||||
|
||||
makeLinksOpenExternally(win);
|
||||
|
||||
win.loadFile(join(VIEW_DIR, "updater.html"));
|
||||
}
|
|
@ -1,21 +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
|
||||
*/
|
||||
|
||||
import { contextBridge } from "electron";
|
||||
import { invoke } from "preload/typedIpc";
|
||||
import { IpcEvents } from "shared/IpcEvents";
|
||||
|
||||
import type { UpdateData } from "./main";
|
||||
|
||||
contextBridge.exposeInMainWorld("Updater", {
|
||||
getData: () => invoke<UpdateData>(IpcEvents.UPDATER_GET_DATA),
|
||||
download: () => {
|
||||
invoke<void>(IpcEvents.UPDATER_DOWNLOAD);
|
||||
invoke<void>(IpcEvents.CLOSE);
|
||||
},
|
||||
ignore: () => invoke<void>(IpcEvents.UPDATE_IGNORE),
|
||||
close: () => invoke<void>(IpcEvents.CLOSE)
|
||||
});
|
Loading…
Reference in a new issue