Implement plugin tags

This commit is contained in:
V 2023-05-12 03:41:00 +02:00
parent 3c7496ac6d
commit ade31f993b
No known key found for this signature in database
GPG Key ID: A1DC0CFB5615D905
7 changed files with 25 additions and 4 deletions

@ -26,5 +26,8 @@ jobs:
- name: Lint & Test if desktop version compiles - name: Lint & Test if desktop version compiles
run: pnpm test run: pnpm test
- name: Lint & Test if web version compiles - name: Test if web version compiles
run: pnpm testWeb run: pnpm buildWeb
- name: Test if plugin structure is valid
run: pnpm generatePluginJson

@ -29,6 +29,7 @@ interface Dev {
interface PluginData { interface PluginData {
name: string; name: string;
description: string; description: string;
tags: string[];
authors: Dev[]; authors: Dev[];
dependencies: string[]; dependencies: string[];
hasPatches: boolean; hasPatches: boolean;
@ -106,6 +107,7 @@ async function parseFile(fileName: string) {
hasCommands: false, hasCommands: false,
enabledByDefault: false, enabledByDefault: false,
required: false, required: false,
tags: [] as string[]
} as PluginData; } as PluginData;
for (const prop of pluginObj.properties) { for (const prop of pluginObj.properties) {
@ -131,6 +133,13 @@ async function parseFile(fileName: string) {
return devs[getName(e)!]; return devs[getName(e)!];
}); });
break; break;
case "tags":
if (!isArrayLiteralExpression(value)) throw fail("tags is not an array literal");
data.tags = value.elements.map(e => {
if (!isStringLiteral(e)) throw fail("tags array contains non-string literals");
return e.text;
});
break;
case "dependencies": case "dependencies":
if (!isArrayLiteralExpression(value)) throw fail("dependencies is not an array literal"); if (!isArrayLiteralExpression(value)) throw fail("dependencies is not an array literal");
const { elements } = value; const { elements } = value;

@ -228,9 +228,12 @@ export default function PluginSettings() {
if (enabled && searchValue.status === SearchStatus.DISABLED) return false; if (enabled && searchValue.status === SearchStatus.DISABLED) return false;
if (!enabled && searchValue.status === SearchStatus.ENABLED) return false; if (!enabled && searchValue.status === SearchStatus.ENABLED) return false;
if (!searchValue.value.length) return true; if (!searchValue.value.length) return true;
const v = searchValue.value.toLowerCase();
return ( return (
plugin.name.toLowerCase().includes(searchValue.value.toLowerCase()) || plugin.name.toLowerCase().includes(v) ||
plugin.description.toLowerCase().includes(searchValue.value.toLowerCase()) plugin.description.toLowerCase().includes(v) ||
plugin.tags?.some(t => t.toLowerCase().includes(v))
); );
}; };

@ -130,6 +130,8 @@ export default definePlugin({
name: "ImageZoom", name: "ImageZoom",
description: "Lets you zoom in to images and gifs. Use scroll wheel to zoom in and shift + scroll wheel to increase lens radius / size", description: "Lets you zoom in to images and gifs. Use scroll wheel to zoom in and shift + scroll wheel to increase lens radius / size",
authors: [Devs.Aria], authors: [Devs.Aria],
tags: ["ImageUtilities"],
patches: [ patches: [
{ {
find: '"renderLinkComponent","maxWidth"', find: '"renderLinkComponent","maxWidth"',

@ -76,6 +76,8 @@ export default definePlugin({
name: "ReverseImageSearch", name: "ReverseImageSearch",
description: "Adds ImageSearch to image context menus", description: "Adds ImageSearch to image context menus",
authors: [Devs.Ven, Devs.Nuckyz], authors: [Devs.Ven, Devs.Nuckyz],
tags: ["ImageUtilities"],
patches: [ patches: [
{ {
find: ".Messages.MESSAGE_ACTIONS_MENU_LABEL", find: ".Messages.MESSAGE_ACTIONS_MENU_LABEL",

@ -116,6 +116,7 @@ export default definePlugin({
name: "ValidUser", name: "ValidUser",
description: "Fix mentions for unknown users showing up as '<@343383572805058560>' (hover over a mention to fix it)", description: "Fix mentions for unknown users showing up as '<@343383572805058560>' (hover over a mention to fix it)",
authors: [Devs.Ven], authors: [Devs.Ven],
tags: ["MentionCacheFix"],
patches: [{ patches: [{
find: 'className:"mention"', find: 'className:"mention"',

@ -145,6 +145,7 @@ export default definePlugin({
name: "ViewIcons", name: "ViewIcons",
authors: [Devs.Ven, Devs.TheKodeToad, Devs.Nuckyz], authors: [Devs.Ven, Devs.TheKodeToad, Devs.Nuckyz],
description: "Makes avatars and banners in user profiles clickable, and adds View Icon/Banner entries in the user and server context menu", description: "Makes avatars and banners in user profiles clickable, and adds View Icon/Banner entries in the user and server context menu",
tags: ["ImageUtilities"],
settings, settings,