13 Commits

Author SHA1 Message Date
Vendicated
36a751bb7b v0.2.0 2023-05-03 04:14:03 +02:00
Vendicated
6a67f07a9e Add portable target 2023-05-03 04:13:43 +02:00
V
c43871950c Update README.md 2023-04-28 02:38:59 +02:00
Vendicated
fe70701de8 Fix zoom & about menu items; add version to about page 2023-04-27 02:23:17 +02:00
Vendicated
80f5735d04 Bump to v0.1.9 2023-04-27 01:26:57 +02:00
Vendicated
3305900cb8 Do not register as media service; Fix autoplay 2023-04-27 01:19:58 +02:00
Nick
c495e71f35 Static title (#17) 2023-04-20 02:26:56 +00:00
Vendicated
4721c46d8c Fix lint 2023-04-19 23:15:07 +02:00
Vendicated
0aaddf24c6 Migrate to @vencord/types package 2023-04-19 22:47:47 +02:00
Vendicated
427fde27ad Remove AUR ci stuff 2023-04-18 01:08:15 +02:00
Vendicated
a12ba017bc bump to 0.1.8 2023-04-15 20:24:09 +02:00
Vendicated
7a2161d746 Make IS_DEV force new instance 2023-04-15 20:23:47 +02:00
Vendicated
d0e7a319d6 Spoof UserAgent as browser. Fixes VCs????? 2023-04-15 20:13:18 +02:00
19 changed files with 203 additions and 122 deletions

View File

@@ -26,19 +26,3 @@ jobs:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE: true
- name: Update AUR package
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
mkdir -p -m 700 ~/.ssh
echo $SSH_KEY > ~/.ssh/aur
echo $SSH_PUB_KEY > ~/.ssh/aur.pub
chmod 600 ~/.ssh/*
export GIT_SSH_COMMAND="ssh -i ~/.ssh/aur"
sudo ./scripts/ci/install_makepkg.sh
./scripts/ci/aur_bump.sh
env:
SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
SSH_PUB_KEY: ${{ secrets.AUR_SSH_PUB_KEY }}

View File

@@ -1,8 +1,10 @@
# Vencord Desktop
A standalone Electron app that loads Discord & Vencord
Vencord Desktop is a cross platform desktop app aiming to give you a snappier Discord experience with Vencord pre-installed
Vencord Desktop is currently in very early alpha. Bug reports, feature requests & contributions are highly appreciated!!
![image](https://user-images.githubusercontent.com/45497981/235024615-94565eaf-f412-4384-a3f5-d8cde7458f6d.png)
Vencord Desktop is currently in beta. Bug reports, feature requests & contributions are highly appreciated!!
## Installing

View File

@@ -1,6 +1,6 @@
{
"name": "VencordDesktop",
"version": "0.1.7",
"version": "0.2.0",
"private": true,
"description": "",
"keywords": [],
@@ -23,10 +23,12 @@
"watch": "pnpm build --watch"
},
"devDependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@types/node": "^18.15.11",
"@types/react": "^18.0.33",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"@vencord/types": "^0.1.2",
"dotenv": "^16.0.3",
"electron": "^23.2.0",
"electron-builder": "^23.6.0",
@@ -83,6 +85,16 @@
"nsis": {
"include": "build/installer.nsh",
"oneClick": false
},
"win": {
"target": [
"nsis",
"portable"
]
},
"publish": {
"provider": "github",
"releaseType": "release"
}
}
}

56
pnpm-lock.yaml generated
View File

@@ -1,6 +1,9 @@
lockfileVersion: '6.0'
devDependencies:
'@fal-works/esbuild-plugin-global-externals':
specifier: ^2.1.2
version: 2.1.2
'@types/node':
specifier: ^18.15.11
version: 18.15.11
@@ -13,6 +16,9 @@ devDependencies:
'@typescript-eslint/parser':
specifier: ^5.57.1
version: 5.57.1(eslint@8.38.0)(typescript@5.0.2)
'@vencord/types':
specifier: ^0.1.2
version: 0.1.2
dotenv:
specifier: ^16.0.3
version: 16.0.3
@@ -367,6 +373,10 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/@fal-works/esbuild-plugin-global-externals@2.1.2:
resolution: {integrity: sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==}
dev: true
/@humanwhocodes/config-array@0.11.8:
resolution: {integrity: sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==}
engines: {node: '>=10.10.0'}
@@ -492,6 +502,10 @@ packages:
'@types/node': 18.15.11
dev: true
/@types/lodash@4.14.194:
resolution: {integrity: sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==}
dev: true
/@types/minimatch@5.1.2:
resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==}
dev: true
@@ -522,6 +536,19 @@ packages:
resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==}
dev: true
/@types/react-dom@18.0.11:
resolution: {integrity: sha512-O38bPbI2CWtgw/OoQoY+BRelw7uysmXbWvw3nLWO21H1HSh+GOlqPuXshJfjmpNlKiiSDG9cc1JZAaMmVdcTlw==}
dependencies:
'@types/react': 18.0.33
dev: true
/@types/react@17.0.2:
resolution: {integrity: sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA==}
dependencies:
'@types/prop-types': 15.7.5
csstype: 3.1.2
dev: true
/@types/react@18.0.33:
resolution: {integrity: sha512-sHxzVxeanvQyQ1lr8NSHaj0kDzcNiGpILEVt69g9S31/7PfMvNCKLKcsHw4lYKjs3cGNJjXSP4mYzX43QlnjNA==}
dependencies:
@@ -698,6 +725,18 @@ packages:
eslint-visitor-keys: 3.4.0
dev: true
/@vencord/types@0.1.2:
resolution: {integrity: sha512-C/dqZHn3aod/4izZT9sgZEef4478M7QNKTY8Gx2yB1CRYawJcs6hupXT/1SMmepKqrULbltL04Cnh5ieBm3Ucw==}
dependencies:
'@types/lodash': 4.14.194
'@types/node': 18.15.11
'@types/react': 18.0.33
'@types/react-dom': 18.0.11
discord-types: 1.3.26
standalone-electron-types: 1.0.0
type-fest: 3.8.0
dev: true
/acorn-jsx@5.3.2(acorn@8.8.2):
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
peerDependencies:
@@ -1342,6 +1381,13 @@ packages:
path-type: 4.0.0
dev: true
/discord-types@1.3.26:
resolution: {integrity: sha512-ToG51AOCH+JTQf7b+8vuYQe5Iqwz7nZ7StpECAZ/VZcI1ZhQk13pvt9KkRTfRv1xNvwJ2qib4e3+RifQlo8VPQ==}
dependencies:
'@types/react': 17.0.2
moment: 2.29.4
dev: true
/dmg-builder@23.6.0:
resolution: {integrity: sha512-jFZvY1JohyHarIAlTbfQOk+HnceGjjAdFjVn3n8xlDWKsYNqbO4muca6qXEZTfGXeQMG7TYim6CeS5XKSfSsGA==}
dependencies:
@@ -2875,6 +2921,10 @@ packages:
hasBin: true
dev: true
/moment@2.29.4:
resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==}
dev: true
/ms@2.0.0:
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
dev: true
@@ -3390,6 +3440,12 @@ packages:
dev: true
optional: true
/standalone-electron-types@1.0.0:
resolution: {integrity: sha512-0HOi/tlTz3mjWhsAz4uRbpQcHMZ+ifj1JzWW9nugykOHClBBG77ps8QinrzX1eow4Iw2pnC+RFaSYRgufF4BOg==}
dependencies:
'@types/node': 18.15.11
dev: true
/stat-mode@1.0.0:
resolution: {integrity: sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg==}
engines: {node: '>= 6'}

View File

@@ -6,6 +6,8 @@
import { BuildContext, BuildOptions, context } from "esbuild";
import vencordDep from "./vencordDep.mjs";
const isDev = process.argv.includes("--dev");
const CommonOpts: BuildOptions = {
@@ -35,17 +37,20 @@ await Promise.all([
createContext({
...NodeCommonOpts,
entryPoints: ["src/main/index.ts"],
outfile: "dist/js/main.js"
outfile: "dist/js/main.js",
footer: { js: "//# sourceURL=VCDMain" }
}),
createContext({
...NodeCommonOpts,
entryPoints: ["src/preload/index.ts"],
outfile: "dist/js/preload.js"
outfile: "dist/js/preload.js",
footer: { js: "//# sourceURL=VCDPreload" }
}),
createContext({
...NodeCommonOpts,
entryPoints: ["src/updater/preload.ts"],
outfile: "dist/js/updaterPreload.js"
outfile: "dist/js/updaterPreload.js",
footer: { js: "//# sourceURL=VCDUpdaterPreload" }
}),
createContext({
...CommonOpts,
@@ -57,7 +62,10 @@ await Promise.all([
jsxFactory: "VencordCreateElement",
jsxFragment: "VencordFragment",
// Work around https://github.com/evanw/esbuild/issues/2460
tsconfig: "./scripts/build/tsconfig.esbuild.json"
tsconfig: "./scripts/build/tsconfig.esbuild.json",
external: ["@vencord/types/*"],
plugins: [vencordDep],
footer: { js: "//# sourceURL=VCDRenderer" }
})
]);

View File

@@ -0,0 +1,38 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import { globalExternalsWithRegExp } from "@fal-works/esbuild-plugin-global-externals";
const names = {
webpack: "Vencord.Webpack",
"webpack/common": "Vencord.Webpack.Common",
utils: "Vencord.Util",
api: "Vencord.Api",
"api/settings": "Vencord",
components: "Vencord.Components"
};
export default globalExternalsWithRegExp({
getModuleInfo(modulePath) {
const path = modulePath.replace("@vencord/types/", "");
let varName = names[path];
if (!varName) {
const altMapping = names[path.split("/")[0]];
if (!altMapping) throw new Error("Unknown module path: " + modulePath);
varName =
altMapping +
"." +
// @ts-ignore
path.split("/")[1].replaceAll("/", ".");
}
return {
varName,
type: "cjs"
};
},
modulePathFilter: /^@vencord\/types.+$/
});

View File

@@ -1,20 +0,0 @@
#!/bin/sh
set -e
VERSION=$(git describe --tags --abbrev=0 | tr -d 'v')
SHASUM=$(sha256sum "dist/VencordDesktop-$VERSION.tar.gz" | awk '{ print $1 }')
git clone ssh://aur@aur.archlinux.org/vencord-desktop-bin.git aurpkg
cd aurpkg
sed -i "s/^pkgver=.*$/pkgver=$VERSION/" PKGBUILD
sed -i "s/^sha256sums=('.*'/sha256sums=('$SHASUM'/" PKGBUILD
makepkg --printsrcinfo > .SRCINFO
git commit -a -m "Bump version to $VERSION"
git push
cd ..
rm -rf aurpkg

View File

@@ -1,13 +0,0 @@
#!/bin/sh
set -e
for i in \
"makepkg_6.0.2-3_amd64.deb" \
"libalpm13_13.0.2-3_amd64.deb" \
"pacman-package-manager_6.0.2-3_amd64.deb"; do
wget -O/tmp/$i https://fr.archive.ubuntu.com/ubuntu/pool/universe/p/pacman-package-manager/$i
dpkg -i /tmp/$i || true
done
apt-get -f install -oDpkg::Use-Pty=0 -qq

2
src/globals.d.ts vendored
View File

@@ -7,8 +7,6 @@
declare global {
export var VencordDesktopNative: typeof import("preload/VencordDesktopNative").VencordDesktopNative;
export var VencordDesktop: typeof import("renderer/index");
// TODO
export var Vencord: any;
export var vcdLS: typeof localStorage;
export var IS_DEV: boolean;

View File

@@ -4,7 +4,8 @@
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import { BrowserWindow } from "electron";
import { app, BrowserWindow } from "electron";
import { readFileSync } from "fs";
import { join } from "path";
import { ICON_PATH, STATIC_DIR } from "shared/paths";
@@ -19,7 +20,9 @@ export function createAboutWindow() {
makeLinksOpenExternally(about);
about.loadFile(join(STATIC_DIR, "about.html"));
const html = readFileSync(join(STATIC_DIR, "about.html"), "utf-8").replaceAll("%VERSION%", app.getVersion());
about.loadURL("data:text/html;charset=utf-8," + html);
return about;
}

View File

@@ -17,6 +17,7 @@ import { createMainWindow } from "./mainWindow";
import { Settings } from "./settings";
import { createSplashWindow } from "./splash";
import { ensureVencordFiles } from "./utils/vencordLoader";
if (IS_DEV) {
require("source-map-support").install();
}
@@ -28,12 +29,24 @@ const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDeskto
let mainWin: BrowserWindow | null = null;
if (!app.requestSingleInstanceLock()) {
console.log("Vencord Desktop is already running. Quitting...");
app.quit();
} else {
app.on("second-instance", () => {
if (mainWin) {
function init() {
// <-- BEGIN COPY PASTED FROM DISCORD -->
// work around chrome 66 disabling autoplay by default
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
// WinRetrieveSuggestionsOnlyOnDemand: Work around electron 13 bug w/ async spellchecking on Windows.
// HardwareMediaKeyHandling,MediaSessionService: Prevent Discord from registering as a media service.
app.commandLine.appendSwitch(
"disable-features",
"WinRetrieveSuggestionsOnlyOnDemand,HardwareMediaKeyHandling,MediaSessionService"
);
// <-- END COPY PASTED FROM DISCORD -->
app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => {
if (data.IS_DEV) app.quit();
else if (mainWin) {
if (mainWin.isMinimized()) mainWin.restore();
if (!mainWin.isVisible()) mainWin.show();
mainWin.focus();
@@ -53,6 +66,18 @@ if (!app.requestSingleInstanceLock()) {
});
}
if (!app.requestSingleInstanceLock({ IS_DEV })) {
if (IS_DEV) {
console.log("Vencord Desktop is already running. Quitting previous instance...");
init();
} else {
console.log("Vencord Desktop is already running. Quitting...");
app.quit();
}
} else {
init();
}
async function createWindows() {
const splash = createSplashWindow();

View File

@@ -88,7 +88,6 @@ function initMenuBar(win: BrowserWindow) {
submenu: [
{
label: "About Vencord Desktop",
role: "about",
click: createAboutWindow
},
{
@@ -125,25 +124,20 @@ function initMenuBar(win: BrowserWindow) {
click() {
app.quit();
}
},
// See https://github.com/electron/electron/issues/14742 and https://github.com/electron/electron/issues/5256
{
label: "Zoom in (hidden, hack for Qwertz and others)",
accelerator: "CmdOrCtrl+=",
role: "zoomIn",
visible: false
}
]
},
{ role: "fileMenu" },
{ role: "editMenu" },
{ role: "viewMenu" },
{ role: "windowMenu" },
{
label: "Zoom",
submenu: [
// See https://github.com/electron/electron/issues/14742 and https://github.com/electron/electron/issues/5256
{
label: "Zoom in",
accelerator: "CmdOrCtrl+=",
role: "zoomIn"
}
],
visible: false
}
{ role: "windowMenu" }
]);
Menu.setApplicationMenu(menu);
@@ -232,6 +226,7 @@ export function createMainWindow() {
},
icon: ICON_PATH,
frame: VencordSettings.store.frameless !== true,
...(Settings.store.staticTitle ? { title: "Vencord" } : {}),
...(VencordSettings.store.macosTranslucency
? {
vibrancy: "sidebar",
@@ -250,12 +245,18 @@ export function createMainWindow() {
return false;
});
if (Settings.store.staticTitle) win.on("page-title-updated", e => e.preventDefault());
initWindowBoundsListeners(win);
if (Settings.store.tray ?? true) initTray(win);
initMenuBar(win);
makeLinksOpenExternally(win);
initSettingsListeners(win);
win.webContents.setUserAgent(
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
);
const subdomain =
Settings.store.discordBranch === "canary" || Settings.store.discordBranch === "ptb"
? `${Settings.store.discordBranch}.`

View File

@@ -6,20 +6,12 @@
import "./settings.css";
import { Margins } from "@vencord/types/utils";
import { Button, Forms, Select, Switch, Text } from "@vencord/types/webpack/common";
import { useSettings } from "renderer/settings";
import { Common, Util } from "../vencord";
const { Margins } = Util;
export default function SettingsUi() {
const Settings = useSettings();
const {
Forms: { FormSection, FormText, FormDivider, FormSwitch, FormTitle },
Text,
Select,
Button
} = Common;
const switches: [keyof typeof Settings, string, string, boolean?, (() => boolean)?][] = [
["tray", "Tray Icon", "Add a tray icon for Vencord Desktop", true],
@@ -39,16 +31,17 @@ export default function SettingsUi() {
"openLinksWithElectron",
"Open Links in app (experimental)",
"Opens links in a new Vencord Desktop window instead of your web browser"
]
],
["staticTitle", "Static Title", 'Makes the window title "Vencord" instead of changing to the current page']
];
return (
<FormSection>
<Forms.FormSection>
<Text variant="heading-lg/semibold" style={{ color: "var(--header-primary)" }} tag="h2">
Vencord Desktop Settings
</Text>
<FormTitle className={Margins.top16}>Discord Branch</FormTitle>
<Forms.FormTitle className={Margins.top16}>Discord Branch</Forms.FormTitle>
<Select
placeholder="Stable"
options={[
@@ -62,22 +55,22 @@ export default function SettingsUi() {
serialize={s => s}
/>
<FormDivider className={Margins.top16 + " " + Margins.bottom16} />
<Forms.FormDivider className={Margins.top16 + " " + Margins.bottom16} />
{switches.map(([key, text, note, def, predicate]) => (
<FormSwitch
value={(Settings[key] ?? def ?? false) && (!predicate || predicate())}
<Switch
value={(Settings[key as any] ?? def ?? false) && predicate?.() !== false}
disabled={predicate && !predicate()}
onChange={v => (Settings[key] = v)}
onChange={v => (Settings[key as any] = v)}
note={note}
key={key}
>
{text}
</FormSwitch>
</Switch>
))}
<FormTitle>Vencord Location</FormTitle>
<FormText>
<Forms.FormTitle>Vencord Location</Forms.FormTitle>
<Forms.FormText>
Vencord files are loaded from{" "}
{Settings.vencordDir ? (
<a
@@ -92,7 +85,7 @@ export default function SettingsUi() {
) : (
"the default location"
)}
</FormText>
</Forms.FormText>
<div className="vcd-location-btns">
<Button
size={Button.Sizes.SMALL}
@@ -117,6 +110,6 @@ export default function SettingsUi() {
Reset
</Button>
</div>
</FormSection>
</Forms.FormSection>
);
}

View File

@@ -6,6 +6,8 @@
import "./hideGarbage.css";
import { waitFor } from "@vencord/types/webpack";
import { isFirstRun, localStorage } from "./utils";
// Make clicking Notifications focus the window
@@ -25,7 +27,7 @@ if (isFirstRun) {
// Hide "Download Discord Desktop now!!!!" banner
localStorage.setItem("hideNag", "true");
Vencord.Webpack.waitFor("setDesktopType", m => {
waitFor("setDesktopType", m => {
m.setDesktopType("all");
});
}

View File

@@ -4,17 +4,16 @@
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import { useEffect, useReducer } from "@vencord/types/webpack/common";
import { SettingsStore } from "shared/utils/SettingsStore";
import { Common } from "./vencord";
export const Settings = new SettingsStore(VencordDesktopNative.settings.get());
Settings.addGlobalChangeListener((o, p) => VencordDesktopNative.settings.set(o, p));
export function useSettings() {
const [, update] = Common.React.useReducer(x => x + 1, 0);
const [, update] = useReducer(x => x + 1, 0);
Common.React.useEffect(() => {
useEffect(() => {
Settings.addGlobalChangeListener(update);
return () => Settings.removeGlobalChangeListener(update);

View File

@@ -1,13 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
// FIXME: this is terrible
const { Webpack, Plugins, Util } = Vencord;
const { Common } = Webpack;
const { plugins } = Plugins;
export { Common, Plugins, plugins, Util, Webpack };

View File

@@ -17,4 +17,5 @@ export interface Settings {
tray?: boolean;
minimizeToTray?: boolean;
skippedUpdate?: string;
staticTitle?: boolean;
}

View File

@@ -13,7 +13,7 @@
</head>
<body>
<h1>About Vencord Desktop</h1>
<h1>Vencord Desktop %VERSION%</h1>
<p>
Vencord Desktop is a free/libre cross platform desktop app aiming to give you a snappier Discord experience with
Vencord pre-installed

View File

@@ -10,7 +10,12 @@
"target": "ESNEXT",
"jsx": "preserve",
"baseUrl": "./src/"
// we have duplicate electron types but it's w/e
"skipLibCheck": true,
"baseUrl": "./src/",
"typeRoots": ["./node_modules/@types", "./node_modules/@vencord"]
},
"include": ["src/**/*"]
}