Vesktop Stuff

This commit is contained in:
thororen 2024-07-16 00:15:41 -04:00
parent 3b980f2736
commit 16b33ba8fa
12 changed files with 40 additions and 24 deletions

View file

@ -113,7 +113,8 @@ await Promise.all([
define: {
...defines,
IS_DISCORD_DESKTOP: true,
IS_VESKTOP: false
IS_VESKTOP: false,
IS_EQUIBOP: false
},
plugins: [
...nodeCommonOpts.plugins,
@ -136,7 +137,8 @@ await Promise.all([
define: {
...defines,
IS_DISCORD_DESKTOP: true,
IS_VESKTOP: false
IS_VESKTOP: false,
IS_EQUIBOP: false
}
}),
esbuild.build({
@ -148,7 +150,8 @@ await Promise.all([
define: {
...defines,
IS_DISCORD_DESKTOP: true,
IS_VESKTOP: false
IS_VESKTOP: false,
IS_EQUIBOP: false
}
}),
@ -162,7 +165,8 @@ await Promise.all([
define: {
...defines,
IS_DISCORD_DESKTOP: false,
IS_VESKTOP: true
IS_VESKTOP: true,
IS_EQUIBOP: true
},
plugins: [
...nodeCommonOpts.plugins,
@ -185,7 +189,8 @@ await Promise.all([
define: {
...defines,
IS_DISCORD_DESKTOP: false,
IS_VESKTOP: true
IS_VESKTOP: true,
IS_EQUIBOP: true
}
}),
esbuild.build({
@ -197,7 +202,8 @@ await Promise.all([
define: {
...defines,
IS_DISCORD_DESKTOP: false,
IS_VESKTOP: true
IS_VESKTOP: true,
IS_EQUIBOP: true
}
}),
]).catch(err => {

View file

@ -47,6 +47,7 @@ const commonOptions = {
IS_REPORTER,
IS_DISCORD_DESKTOP: false,
IS_VESKTOP: false,
IS_EQUIBOP: false,
IS_UPDATER_DISABLED: true,
VERSION: JSON.stringify(VERSION),
BUILD_TIMESTAMP

View file

@ -98,7 +98,7 @@ export const makeAllPackagesExternalPlugin = {
};
/**
* @type {(kind: "web" | "discordDesktop" | "vencordDesktop") => import("esbuild").Plugin}
* @type {(kind: "web" | "discordDesktop" | "vencordDesktop" | "equicordDesktop") => import("esbuild").Plugin}
*/
export const globPlugins = kind => ({
name: "glob-plugins",
@ -137,7 +137,8 @@ export const globPlugins = kind => ({
(target === "web" && kind === "discordDesktop") ||
(target === "desktop" && kind === "web") ||
(target === "discordDesktop" && kind !== "discordDesktop") ||
(target === "vencordDesktop" && kind !== "vencordDesktop");
(target === "vencordDesktop" && kind !== "vencordDesktop") ||
(target === "equicordDesktop" && kind !== "equicordDesktop");
if (excluded) {
const name = await resolvePluginName(fullDir, file);

View file

@ -39,7 +39,7 @@ interface PluginData {
hasCommands: boolean;
required: boolean;
enabledByDefault: boolean;
target: "discordDesktop" | "vencordDesktop" | "desktop" | "web" | "dev";
target: "discordDesktop" | "vencordDesktop" | "equicordDesktop" | "desktop" | "web" | "dev";
filePath: string;
}
@ -195,7 +195,7 @@ async function parseFile(fileName: string) {
const target = getPluginTarget(fileName);
if (target) {
if (!["web", "discordDesktop", "vencordDesktop", "desktop", "dev"].includes(target)) throw fail(`invalid target ${target}`);
if (!["web", "discordDesktop", "vencordDesktop", "equicordDesktop", "desktop", "dev"].includes(target)) throw fail(`invalid target ${target}`);
data.target = target as any;
}

View file

@ -176,10 +176,11 @@ function ExcludedPluginsList({ search }: { search: string; }) {
const matchingExcludedPlugins = Object.entries(ExcludedPlugins)
.filter(([name]) => name.toLowerCase().includes(search));
const ExcludedReasons: Record<"web" | "discordDesktop" | "vencordDesktop" | "desktop" | "dev", string> = {
const ExcludedReasons: Record<"web" | "discordDesktop" | "vencordDesktop" | "equicordDesktop" | "desktop" | "dev", string> = {
desktop: "Discord Desktop app or Vesktop",
discordDesktop: "Discord Desktop app",
vencordDesktop: "Vesktop app",
equicordDesktop: "Equibop app",
web: "Vesktop app and the Web version of Discord",
dev: "Developer version of Equicord"
};

1
src/globals.d.ts vendored
View file

@ -40,6 +40,7 @@ declare global {
export var IS_REPORTER: boolean;
export var IS_DISCORD_DESKTOP: boolean;
export var IS_VESKTOP: boolean;
export var IS_EQUIBOP: boolean;
export var VERSION: string;
export var BUILD_TIMESTAMP: number;

View file

@ -24,8 +24,15 @@ export const DATA_DIR = process.env.EQUICORD_USER_DATA_DIR ?? (
? join(process.env.DISCORD_USER_DATA_DIR, "..", "EquicordData")
: join(app.getPath("userData"), "..", "Equicord")
);
export const SETTINGS_DIR = join(DATA_DIR, "settings");
export const THEMES_DIR = join(DATA_DIR, "themes");
export const DATA_DIR2 = process.env.VENCORD_USER_DATA_DIR ?? (
process.env.DISCORD_USER_DATA_DIR
? join(process.env.DISCORD_USER_DATA_DIR, "..", "VencordData")
: join(app.getPath("userData"), "..", "Vencord")
);
export const SETTINGS_DIR = IS_VESKTOP ? join(DATA_DIR2, "settings") : join(DATA_DIR, "settings");
export const THEMES_DIR = IS_VESKTOP ? join(DATA_DIR2, "themes") : join(DATA_DIR, "themes");
export const QUICKCSS_PATH = join(SETTINGS_DIR, "quickCss.css");
export const SETTINGS_FILE = join(SETTINGS_DIR, "settings.json");
export const NATIVE_SETTINGS_FILE = join(SETTINGS_DIR, "native-settings.json");

2
src/modules.d.ts vendored
View file

@ -26,7 +26,7 @@ declare module "~plugins" {
folderName: string;
userPlugin: boolean;
}>;
export const ExcludedPlugins: Record<string, "web" | "discordDesktop" | "vencordDesktop" | "desktop" | "dev">;
export const ExcludedPlugins: Record<string, "web" | "discordDesktop" | "vencordDesktop" | "equicordDesktop" | "desktop" | "dev">;
}
declare module "~pluginNatives" {

View file

@ -73,7 +73,7 @@ export default definePlugin({
description: "Re-adds context menus missing in the web version of Discord: Links & Images (Copy/Open Link/Image), Text Area (Copy, Cut, Paste, SpellCheck)",
authors: [Devs.Ven],
enabledByDefault: true,
required: IS_VESKTOP,
required: IS_VESKTOP || IS_EQUIBOP,
settings,
@ -223,11 +223,10 @@ export default definePlugin({
// Automod add filter words
{
find: '("interactionUsernameProfile',
replacement:
{
match: /\i\.isPlatformEmbedded(?=.{0,50}\.tagName)/,
replace: "true"
},
replacement: {
match: /\i\.isPlatformEmbedded(?=.{0,50}\.tagName)/,
replace: "true"
},
}
],
@ -251,7 +250,7 @@ export default definePlugin({
});
}
if (IS_VESKTOP && VesktopNative.clipboard) {
if (IS_VESKTOP && VesktopNative.clipboard || IS_EQUIBOP && VesktopNative.clipboard) {
VesktopNative.clipboard.copyImage(await imageData.arrayBuffer(), url);
return;
} else {

View file

@ -28,7 +28,7 @@ contextBridge.exposeInMainWorld("VencordNative", VencordNative);
// Discord
if (location.protocol !== "data:") {
// #region cssInsert
const rendererCss = join(__dirname, IS_VESKTOP ? "vencordDesktopRenderer.css" : "renderer.css");
const rendererCss = join(__dirname, IS_VESKTOP ? "vencordDesktopRenderer.css" : "renderer.css" || IS_EQUIBOP ? "vencordDesktopRenderer.css" : "renderer.css");
const style = document.createElement("style");
style.id = "vencord-css-core";

View file

@ -49,7 +49,7 @@ export async function exportSettings({ minify }: { minify?: boolean; } = {}) {
}
export async function downloadSettingsBackup() {
const filename = `vencord-settings-backup-${moment().format("YYYY-MM-DD")}.json`;
const filename = `equicord-settings-backup-${moment().format("YYYY-MM-DD")}.json`;
const backup = await exportSettings();
const data = new TextEncoder().encode(backup);

View file

@ -56,7 +56,7 @@ const preprocessors: { [preprocessor: string]: (text: string, vars: Record<strin
export async function compileUsercss(fileName: string) {
const themeData = await VencordNative.themes.getThemeData(fileName);
if (!themeData) return null;
// UserCSS preprocessor order look like this: