Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finally added the submenu for changing the splash animation #589

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,010 changes: 8,010 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/build/build.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { BuildContext, BuildOptions, context } from "esbuild";
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/injectReact.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

export const VencordFragment = /* #__PURE__*/ Symbol.for("react.fragment");
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/sandboxFix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

// Based on https://github.com/gergof/electron-builder-sandbox-fix/blob/master/lib/index.js
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/vencordDep.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { globalExternalsWithRegExp } from "@fal-works/esbuild-plugin-global-externals";
Expand Down
2 changes: 1 addition & 1 deletion scripts/header.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/
2 changes: 1 addition & 1 deletion scripts/start.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import "./utils/dotenv";
Expand Down
2 changes: 1 addition & 1 deletion scripts/startWatch.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import "./start";
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/dotenv.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { config } from "dotenv";
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/spawn.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { spawn as spaaawn, SpawnOptions } from "child_process";
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/updateMeta.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { promises as fs } from "node:fs";
Expand Down
2 changes: 1 addition & 1 deletion src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

declare global {
Expand Down
2 changes: 1 addition & 1 deletion src/main/about.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { BrowserWindow } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/appBadge.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { app, NativeImage, nativeImage } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/arrpc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import Server from "arrpc";
Expand Down
2 changes: 1 addition & 1 deletion src/main/autoStart.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { app } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { app } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/firstLaunch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { app } from "electron";
Expand Down
10 changes: 7 additions & 3 deletions src/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import "./ipc";

import { app, BrowserWindow, nativeTheme } from "electron";
import { app, BrowserWindow, nativeTheme, net, protocol } from "electron";
import { checkUpdates } from "updater/main";

import { DATA_DIR } from "./constants";
Expand All @@ -25,7 +25,7 @@ if (IS_DEV) {
process.env.VENCORD_USER_DATA_DIR = DATA_DIR;

function init() {
const { disableSmoothScroll, hardwareAcceleration } = Settings.store;
const { disableSmoothScroll, hardwareAcceleration, splashAnimationPath } = Settings.store;

const enabledFeatures = app.commandLine.getSwitchValue("enable-features").split(",");
const disabledFeatures = app.commandLine.getSwitchValue("disable-features").split(",");
Expand Down Expand Up @@ -74,6 +74,10 @@ function init() {

registerScreenShareHandler();
registerMediaPermissionsHandler();
//register file handler so we can load the custom splash animation from the user's filesystem
protocol.handle("splash-animation", () => {
return net.fetch("file:///"+splashAnimationPath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use fs.readSync instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it doesn't make sense to have a "network request" to grab a local file when you can just read it directly

});

bootstrap();

Expand Down
13 changes: 12 additions & 1 deletion src/main/ipc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

if (process.platform === "linux") import("./venmic");
Expand Down Expand Up @@ -121,6 +121,17 @@ handle(IpcEvents.SELECT_VENCORD_DIR, async () => {
return dir;
});

handle(IpcEvents.SELECT_IMAGE_PATH, async () => {
const res = await dialog.showOpenDialog(mainWin!, {
properties: ["openFile"],
filters: [
{name: "Images", extensions: ["apng", "avif", "gif", "jpeg", "png", "svg", "webp"]}
]
});
if (!res.filePaths.length) return "cancelled";
return res.filePaths[0];
});

handle(IpcEvents.SET_BADGE_COUNT, (_, count: number) => setBadgeCount(count));

handle(IpcEvents.CLIPBOARD_COPY_IMAGE, async (_, buf: ArrayBuffer, src: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/mainWindow.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import {
Expand Down
2 changes: 1 addition & 1 deletion src/main/mediaPermissions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { session, systemPreferences } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/screenShare.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { desktopCapturer, session, Streams } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/settings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
Expand Down
20 changes: 16 additions & 4 deletions src/main/splash.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { BrowserWindow } from "electron";
import { BrowserWindow, webContents } from "electron";
import { join } from "path";
import { SplashProps } from "shared/browserWinProperties";
import { ICON_PATH, VIEW_DIR } from "shared/paths";

import { Settings } from "./settings";

export function createSplashWindow(startMinimized = false) {
const { splashBackground, splashColor, splashTheming, splashAnimationPath } = Settings.store;

const splash = new BrowserWindow({
...SplashProps,
icon: ICON_PATH,
Expand All @@ -20,8 +22,6 @@ export function createSplashWindow(startMinimized = false) {

splash.loadFile(join(VIEW_DIR, "splash.html"));

const { splashBackground, splashColor, splashTheming } = Settings.store;

if (splashTheming) {
if (splashColor) {
const semiTransparentSplashColor = splashColor.replace("rgb(", "rgba(").replace(")", ", 0.2)");
Expand All @@ -35,5 +35,17 @@ export function createSplashWindow(startMinimized = false) {
}
}

if (splashAnimationPath) {
splash.webContents.executeJavaScript(`
document.getElementById("animation").src = "splash-animation://img";
`);
}
else {
splash.webContents.insertCSS(`img {image-rendering: pixelated}`)
splash.webContents.executeJavaScript(`
document.getElementById("animation").src = "../shiggy.gif";
`);
}

return splash;
}
2 changes: 1 addition & 1 deletion src/main/utils/http.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { createWriteStream } from "fs";
Expand Down
2 changes: 1 addition & 1 deletion src/main/utils/ipcWrappers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { ipcMain, IpcMainEvent, IpcMainInvokeEvent, WebFrameMain } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/utils/makeLinksOpenExternally.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { BrowserWindow, shell } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/utils/popout.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { BrowserWindow, BrowserWindowConstructorOptions } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/utils/steamOS.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { BrowserWindow, dialog } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/main/utils/vencordLoader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { existsSync, mkdirSync } from "fs";
Expand Down
2 changes: 1 addition & 1 deletion src/main/venmic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import type { PatchBay as PatchBayType } from "@vencord/venmic";
Expand Down
5 changes: 3 additions & 2 deletions src/preload/VesktopNative.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { ipcRenderer } from "electron";
Expand Down Expand Up @@ -33,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)
selectVencordDir: () => invoke<LiteralUnion<"cancelled" | "invalid", string>>(IpcEvents.SELECT_VENCORD_DIR),
selectImagePath: () => invoke<LiteralUnion<"cancelled", string>>(IpcEvents.SELECT_IMAGE_PATH)
},
settings: {
get: () => sendSync<Settings>(IpcEvents.GET_SETTINGS),
Expand Down
2 changes: 1 addition & 1 deletion src/preload/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { contextBridge, ipcRenderer, webFrame } from "electron";
Expand Down
2 changes: 1 addition & 1 deletion src/preload/typedIpc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* 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
* Copyright (c) 2024 Vendicated and Vencord contributors
*/

import { ipcRenderer } from "electron";
Expand Down
Loading