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

enhancement: Add filter for userplugins under plugins if running from source build #2854

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all 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
9 changes: 6 additions & 3 deletions src/components/PluginSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { Plugin } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { Alerts, Button, Card, Forms, lodash, Parser, React, Select, Text, TextInput, Toasts, Tooltip, useMemo } from "@webpack/common";

import Plugins, { ExcludedPlugins } from "~plugins";
import Plugins, { ExcludedPlugins, PluginMeta } from "~plugins";

// Avoid circular dependency
const { startDependenciesRecursive, startPlugin, stopPlugin } = proxyLazy(() => require("../../plugins"));
Expand Down Expand Up @@ -169,7 +169,8 @@ const enum SearchStatus {
ALL,
ENABLED,
DISABLED,
NEW
NEW,
USERPLUGINS
}

function ExcludedPluginsList({ search }: { search: string; }) {
Expand Down Expand Up @@ -256,6 +257,7 @@ export default function PluginSettings() {
if (enabled && status === SearchStatus.DISABLED) return false;
if (!enabled && status === SearchStatus.ENABLED) return false;
if (status === SearchStatus.NEW && !newPlugins?.includes(plugin.name)) return false;
if (status === SearchStatus.USERPLUGINS && !PluginMeta[plugin.name].userPlugin) return false;
if (!search.length) return true;

return (
Expand Down Expand Up @@ -342,7 +344,8 @@ export default function PluginSettings() {
{ label: "Show All", value: SearchStatus.ALL, default: true },
{ label: "Show Enabled", value: SearchStatus.ENABLED },
{ label: "Show Disabled", value: SearchStatus.DISABLED },
{ label: "Show New", value: SearchStatus.NEW }
{ label: "Show New", value: SearchStatus.NEW },
...(IS_STANDALONE ? [] : [{ label: "Show UserPlugins", value: SearchStatus.USERPLUGINS }])
]}
serialize={String}
select={onStatusChange}
Expand Down