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

View file

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

View file

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

View file

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

View file

@ -130,6 +130,8 @@ export default definePlugin({
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",
authors: [Devs.Aria],
tags: ["ImageUtilities"],
patches: [
{
find: '"renderLinkComponent","maxWidth"',

View file

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

View file

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

View file

@ -145,6 +145,7 @@ export default definePlugin({
name: "ViewIcons",
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",
tags: ["ImageUtilities"],
settings,