Settings: fix display of excluded browser-only plugins
This commit is contained in:
parent
0f54286da2
commit
2771a9888a
4 changed files with 18 additions and 5 deletions
|
|
@ -23,6 +23,7 @@ import { normalize as posixNormalize, sep as posixSep } from "path/posix";
|
||||||
import { BigIntLiteral, createSourceFile, Identifier, isArrayLiteralExpression, isCallExpression, isExportAssignment, isIdentifier, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSatisfiesExpression, isStringLiteral, isVariableStatement, NamedDeclaration, NodeArray, ObjectLiteralExpression, ScriptTarget, StringLiteral, SyntaxKind } from "typescript";
|
import { BigIntLiteral, createSourceFile, Identifier, isArrayLiteralExpression, isCallExpression, isExportAssignment, isIdentifier, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSatisfiesExpression, isStringLiteral, isVariableStatement, NamedDeclaration, NodeArray, ObjectLiteralExpression, ScriptTarget, StringLiteral, SyntaxKind } from "typescript";
|
||||||
|
|
||||||
import { getPluginTarget } from "./utils.mjs";
|
import { getPluginTarget } from "./utils.mjs";
|
||||||
|
import { PluginTarget, PluginTargets } from "@utils/pluginTargets";
|
||||||
|
|
||||||
interface Dev {
|
interface Dev {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
@ -40,7 +41,7 @@ interface PluginData {
|
||||||
hasCommands: boolean;
|
hasCommands: boolean;
|
||||||
required: boolean;
|
required: boolean;
|
||||||
enabledByDefault: boolean;
|
enabledByDefault: boolean;
|
||||||
target: "discordDesktop" | "vesktop" | "desktop" | "web" | "browser" | "dev";
|
target?: PluginTarget;
|
||||||
filePath: string;
|
filePath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,7 +167,7 @@ async function parseFile(fileName: string) {
|
||||||
|
|
||||||
const target = getPluginTarget(fileName);
|
const target = getPluginTarget(fileName);
|
||||||
if (target) {
|
if (target) {
|
||||||
if (!["web", "browser", "discordDesktop", "vesktop", "desktop", "dev"].includes(target)) throw fail(`invalid target ${target}`);
|
if (!PluginTargets.includes(target as PluginTarget)) throw fail(`invalid target ${target}`);
|
||||||
data.target = target as any;
|
data.target = target as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import { isTruthy } from "@utils/guards";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
|
import { PluginTarget } from "@utils/pluginTargets";
|
||||||
import { useAwaiter, useCleanupEffect } from "@utils/react";
|
import { useAwaiter, useCleanupEffect } from "@utils/react";
|
||||||
import { PluginTag, PluginTags } from "@utils/types";
|
import { PluginTag, PluginTags } from "@utils/types";
|
||||||
import { Button, ConfirmModal, lodash, openModal, Parser, React, SearchableSelect, Select, TextInput, Tooltip, useMemo, useRef, useState } from "@webpack/common";
|
import { Button, ConfirmModal, lodash, openModal, Parser, React, SearchableSelect, Select, TextInput, Tooltip, useMemo, useRef, useState } from "@webpack/common";
|
||||||
|
|
@ -88,12 +89,13 @@ function ExcludedPluginsList({ search }: { search: string; }) {
|
||||||
.filter(([name]) => name.toLowerCase().includes(search))
|
.filter(([name]) => name.toLowerCase().includes(search))
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const ExcludedReasons: Record<"web" | "discordDesktop" | "vesktop" | "desktop" | "dev", string> = {
|
const ExcludedReasons: Record<PluginTarget, string> = {
|
||||||
desktop: "Discord Desktop app or Vesktop",
|
desktop: "Discord Desktop app or Vesktop",
|
||||||
discordDesktop: "Discord Desktop app",
|
discordDesktop: "Discord Desktop app",
|
||||||
vesktop: "Vesktop app",
|
vesktop: "Vesktop app",
|
||||||
web: "Vesktop app and the Web version of Discord",
|
web: "Vesktop app and the Web version of Discord",
|
||||||
dev: "Developer version of Vencord"
|
dev: "Developer version of Vencord",
|
||||||
|
browser: "Web Browser version of Vencord"
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
4
src/modules.d.ts
vendored
4
src/modules.d.ts
vendored
|
|
@ -17,13 +17,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare module "~plugins" {
|
declare module "~plugins" {
|
||||||
|
import { PluginTarget } from "@utils/pluginTargets";
|
||||||
const plugins: Record<string, import("./utils/types").Plugin>;
|
const plugins: Record<string, import("./utils/types").Plugin>;
|
||||||
|
|
||||||
export default plugins;
|
export default plugins;
|
||||||
export const PluginMeta: Record<string, {
|
export const PluginMeta: Record<string, {
|
||||||
folderName: string;
|
folderName: string;
|
||||||
userPlugin: boolean;
|
userPlugin: boolean;
|
||||||
}>;
|
}>;
|
||||||
export const ExcludedPlugins: Record<string, "web" | "discordDesktop" | "vesktop" | "desktop" | "dev">;
|
export const ExcludedPlugins: Record<string, PluginTarget>;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "~git-hash" {
|
declare module "~git-hash" {
|
||||||
|
|
|
||||||
8
src/utils/pluginTargets.ts
Normal file
8
src/utils/pluginTargets.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2026 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const PluginTargets = ["web", "browser", "discordDesktop", "vesktop", "desktop", "dev"] as const;
|
||||||
|
export type PluginTarget = typeof PluginTargets[number];
|
||||||
Loading…
Add table
Reference in a new issue