mirror of
https://github.com/Equicord/Equicord.git
synced 2025-03-03 16:02:39 -05:00
Vesktop Stuff
This commit is contained in:
parent
3b980f2736
commit
16b33ba8fa
12 changed files with 40 additions and 24 deletions
|
@ -113,7 +113,8 @@ await Promise.all([
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: true,
|
IS_DISCORD_DESKTOP: true,
|
||||||
IS_VESKTOP: false
|
IS_VESKTOP: false,
|
||||||
|
IS_EQUIBOP: false
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
...nodeCommonOpts.plugins,
|
...nodeCommonOpts.plugins,
|
||||||
|
@ -136,7 +137,8 @@ await Promise.all([
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: true,
|
IS_DISCORD_DESKTOP: true,
|
||||||
IS_VESKTOP: false
|
IS_VESKTOP: false,
|
||||||
|
IS_EQUIBOP: false
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
|
@ -148,7 +150,8 @@ await Promise.all([
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: true,
|
IS_DISCORD_DESKTOP: true,
|
||||||
IS_VESKTOP: false
|
IS_VESKTOP: false,
|
||||||
|
IS_EQUIBOP: false
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -162,7 +165,8 @@ await Promise.all([
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: false,
|
IS_DISCORD_DESKTOP: false,
|
||||||
IS_VESKTOP: true
|
IS_VESKTOP: true,
|
||||||
|
IS_EQUIBOP: true
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
...nodeCommonOpts.plugins,
|
...nodeCommonOpts.plugins,
|
||||||
|
@ -185,7 +189,8 @@ await Promise.all([
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: false,
|
IS_DISCORD_DESKTOP: false,
|
||||||
IS_VESKTOP: true
|
IS_VESKTOP: true,
|
||||||
|
IS_EQUIBOP: true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
|
@ -197,7 +202,8 @@ await Promise.all([
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
IS_DISCORD_DESKTOP: false,
|
IS_DISCORD_DESKTOP: false,
|
||||||
IS_VESKTOP: true
|
IS_VESKTOP: true,
|
||||||
|
IS_EQUIBOP: true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
]).catch(err => {
|
]).catch(err => {
|
||||||
|
|
|
@ -47,6 +47,7 @@ const commonOptions = {
|
||||||
IS_REPORTER,
|
IS_REPORTER,
|
||||||
IS_DISCORD_DESKTOP: false,
|
IS_DISCORD_DESKTOP: false,
|
||||||
IS_VESKTOP: false,
|
IS_VESKTOP: false,
|
||||||
|
IS_EQUIBOP: false,
|
||||||
IS_UPDATER_DISABLED: true,
|
IS_UPDATER_DISABLED: true,
|
||||||
VERSION: JSON.stringify(VERSION),
|
VERSION: JSON.stringify(VERSION),
|
||||||
BUILD_TIMESTAMP
|
BUILD_TIMESTAMP
|
||||||
|
|
|
@ -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 => ({
|
export const globPlugins = kind => ({
|
||||||
name: "glob-plugins",
|
name: "glob-plugins",
|
||||||
|
@ -137,7 +137,8 @@ export const globPlugins = kind => ({
|
||||||
(target === "web" && kind === "discordDesktop") ||
|
(target === "web" && kind === "discordDesktop") ||
|
||||||
(target === "desktop" && kind === "web") ||
|
(target === "desktop" && kind === "web") ||
|
||||||
(target === "discordDesktop" && kind !== "discordDesktop") ||
|
(target === "discordDesktop" && kind !== "discordDesktop") ||
|
||||||
(target === "vencordDesktop" && kind !== "vencordDesktop");
|
(target === "vencordDesktop" && kind !== "vencordDesktop") ||
|
||||||
|
(target === "equicordDesktop" && kind !== "equicordDesktop");
|
||||||
|
|
||||||
if (excluded) {
|
if (excluded) {
|
||||||
const name = await resolvePluginName(fullDir, file);
|
const name = await resolvePluginName(fullDir, file);
|
||||||
|
|
|
@ -39,7 +39,7 @@ interface PluginData {
|
||||||
hasCommands: boolean;
|
hasCommands: boolean;
|
||||||
required: boolean;
|
required: boolean;
|
||||||
enabledByDefault: boolean;
|
enabledByDefault: boolean;
|
||||||
target: "discordDesktop" | "vencordDesktop" | "desktop" | "web" | "dev";
|
target: "discordDesktop" | "vencordDesktop" | "equicordDesktop" | "desktop" | "web" | "dev";
|
||||||
filePath: string;
|
filePath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ async function parseFile(fileName: string) {
|
||||||
|
|
||||||
const target = getPluginTarget(fileName);
|
const target = getPluginTarget(fileName);
|
||||||
if (target) {
|
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;
|
data.target = target as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,10 +176,11 @@ function ExcludedPluginsList({ search }: { search: string; }) {
|
||||||
const matchingExcludedPlugins = Object.entries(ExcludedPlugins)
|
const matchingExcludedPlugins = Object.entries(ExcludedPlugins)
|
||||||
.filter(([name]) => name.toLowerCase().includes(search));
|
.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",
|
desktop: "Discord Desktop app or Vesktop",
|
||||||
discordDesktop: "Discord Desktop app",
|
discordDesktop: "Discord Desktop app",
|
||||||
vencordDesktop: "Vesktop app",
|
vencordDesktop: "Vesktop app",
|
||||||
|
equicordDesktop: "Equibop app",
|
||||||
web: "Vesktop app and the Web version of Discord",
|
web: "Vesktop app and the Web version of Discord",
|
||||||
dev: "Developer version of Equicord"
|
dev: "Developer version of Equicord"
|
||||||
};
|
};
|
||||||
|
|
1
src/globals.d.ts
vendored
1
src/globals.d.ts
vendored
|
@ -40,6 +40,7 @@ declare global {
|
||||||
export var IS_REPORTER: boolean;
|
export var IS_REPORTER: boolean;
|
||||||
export var IS_DISCORD_DESKTOP: boolean;
|
export var IS_DISCORD_DESKTOP: boolean;
|
||||||
export var IS_VESKTOP: boolean;
|
export var IS_VESKTOP: boolean;
|
||||||
|
export var IS_EQUIBOP: boolean;
|
||||||
export var VERSION: string;
|
export var VERSION: string;
|
||||||
export var BUILD_TIMESTAMP: number;
|
export var BUILD_TIMESTAMP: number;
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,15 @@ export const DATA_DIR = process.env.EQUICORD_USER_DATA_DIR ?? (
|
||||||
? join(process.env.DISCORD_USER_DATA_DIR, "..", "EquicordData")
|
? join(process.env.DISCORD_USER_DATA_DIR, "..", "EquicordData")
|
||||||
: join(app.getPath("userData"), "..", "Equicord")
|
: 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 QUICKCSS_PATH = join(SETTINGS_DIR, "quickCss.css");
|
||||||
export const SETTINGS_FILE = join(SETTINGS_DIR, "settings.json");
|
export const SETTINGS_FILE = join(SETTINGS_DIR, "settings.json");
|
||||||
export const NATIVE_SETTINGS_FILE = join(SETTINGS_DIR, "native-settings.json");
|
export const NATIVE_SETTINGS_FILE = join(SETTINGS_DIR, "native-settings.json");
|
||||||
|
|
2
src/modules.d.ts
vendored
2
src/modules.d.ts
vendored
|
@ -26,7 +26,7 @@ declare module "~plugins" {
|
||||||
folderName: string;
|
folderName: string;
|
||||||
userPlugin: boolean;
|
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" {
|
declare module "~pluginNatives" {
|
||||||
|
|
|
@ -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)",
|
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],
|
authors: [Devs.Ven],
|
||||||
enabledByDefault: true,
|
enabledByDefault: true,
|
||||||
required: IS_VESKTOP,
|
required: IS_VESKTOP || IS_EQUIBOP,
|
||||||
|
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
|
@ -223,11 +223,10 @@ export default definePlugin({
|
||||||
// Automod add filter words
|
// Automod add filter words
|
||||||
{
|
{
|
||||||
find: '("interactionUsernameProfile',
|
find: '("interactionUsernameProfile',
|
||||||
replacement:
|
replacement: {
|
||||||
{
|
match: /\i\.isPlatformEmbedded(?=.{0,50}\.tagName)/,
|
||||||
match: /\i\.isPlatformEmbedded(?=.{0,50}\.tagName)/,
|
replace: "true"
|
||||||
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);
|
VesktopNative.clipboard.copyImage(await imageData.arrayBuffer(), url);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -28,7 +28,7 @@ contextBridge.exposeInMainWorld("VencordNative", VencordNative);
|
||||||
// Discord
|
// Discord
|
||||||
if (location.protocol !== "data:") {
|
if (location.protocol !== "data:") {
|
||||||
// #region cssInsert
|
// #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");
|
const style = document.createElement("style");
|
||||||
style.id = "vencord-css-core";
|
style.id = "vencord-css-core";
|
||||||
|
|
|
@ -49,7 +49,7 @@ export async function exportSettings({ minify }: { minify?: boolean; } = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadSettingsBackup() {
|
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 backup = await exportSettings();
|
||||||
const data = new TextEncoder().encode(backup);
|
const data = new TextEncoder().encode(backup);
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ const preprocessors: { [preprocessor: string]: (text: string, vars: Record<strin
|
||||||
|
|
||||||
export async function compileUsercss(fileName: string) {
|
export async function compileUsercss(fileName: string) {
|
||||||
const themeData = await VencordNative.themes.getThemeData(fileName);
|
const themeData = await VencordNative.themes.getThemeData(fileName);
|
||||||
|
|
||||||
if (!themeData) return null;
|
if (!themeData) return null;
|
||||||
|
|
||||||
// UserCSS preprocessor order look like this:
|
// UserCSS preprocessor order look like this:
|
||||||
|
|
Loading…
Add table
Reference in a new issue