From e2253e56c251bbd183d571beea389fe116d5e1cc Mon Sep 17 00:00:00 2001 From: qiqi Date: Tue, 17 Nov 2026 15:55:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(market):=20=E6=8F=92=E4=BB=B6=E5=B8=82?= =?UTF-8?q?=E5=9C=BA=E5=B1=95=E7=A4=BA=E9=A1=B5=EF=BC=88=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E5=A2=99=20+=20=E6=90=9C=E7=B4=A2=20+=20=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=AD=9B=E9=80=89=EF=BC=89=EF=BC=8Cmeta=20=E8=A1=A5=20icon/col?= =?UTF-8?q?or/tags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/meta.json | 56 ++++++++++++++--- scripts/gen-market-page.js | 122 +++++++++++++++++++++++++++++++++++++ scripts/gen-market.js | 2 +- 3 files changed, 172 insertions(+), 8 deletions(-) create mode 100644 scripts/gen-market-page.js diff --git a/plugins/meta.json b/plugins/meta.json index 5d1be13..2ed72db 100644 --- a/plugins/meta.json +++ b/plugins/meta.json @@ -2,36 +2,78 @@ "batch-export": { "name": "批量出图", "desc": "资源中心勾选节点,串行批量生成并打包 ZIP 下载", - "author": "official" + "author": "official", + "icon": "🗂️", + "color": "#e8f0fe", + "tags": [ + "出图", + "批处理" + ] }, "blank-canvas": { "name": "空白画布", "desc": "新建空白画布节点,用于分区分组", - "author": "official" + "author": "official", + "icon": "⬜", + "color": "#eef2f6", + "tags": [ + "画布", + "效率" + ] }, "image-annotate": { "name": "标注 / 修图", "desc": "在画布内标注、涂抹、局部重绘", - "author": "official" + "author": "official", + "icon": "🖌️", + "color": "#fdeaea", + "tags": [ + "修图", + "标注" + ] }, "image-vectorize": { "name": "位图转矢量", "desc": "把位图转成 SVG 矢量路径", - "author": "official" + "author": "official", + "icon": "✒️", + "color": "#eaf3ea", + "tags": [ + "转换", + "矢量" + ] }, "style-source": { "name": "风格库", "desc": "风格提示词库与一键套用", - "author": "official" + "author": "official", + "icon": "🎨", + "color": "#fdf0e6", + "tags": [ + "提示词", + "风格" + ] }, "white-bg-800": { "name": "白底图", "desc": "批量生成电商白底图(800px)", - "author": "official" + "author": "official", + "icon": "🧾", + "color": "#eef7fb", + "tags": [ + "电商", + "出图" + ] }, "xianyi-cutout": { "name": "鲜艺抠图", "desc": "接入鲜艺抠图模型的一键去背景", - "author": "official" + "author": "official", + "icon": "✂️", + "color": "#f3eafd", + "tags": [ + "抠图", + "去背景" + ] } } diff --git a/scripts/gen-market-page.js b/scripts/gen-market-page.js new file mode 100644 index 0000000..71c1f58 --- /dev/null +++ b/scripts/gen-market-page.js @@ -0,0 +1,122 @@ +#!/usr/bin/env node +'use strict' +// 生成插件市场展示页:market/index.json → market.html(纯静态,无后端) +// 设计目标:与下载页同一套视觉;卡片墙 + 搜索 + 标签筛选;「安装」只在应用内做,这里只展示。 +const fs = require('fs') +const path = require('path') +const root = path.resolve(__dirname, '..') +const index = JSON.parse(fs.readFileSync(path.join(root, 'market', 'index.json'), 'utf8')) +const list = Array.isArray(index.plugins) ? index.plugins : [] + +const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])) +const tags = [] +for (const p of list) for (const t of (p.tags || [])) if (tags.indexOf(t) < 0) tags.push(t) + +const kb = (n) => n >= 1024 * 1024 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB' + +const card = (p) => ` +
+
+ ${esc(p.icon || '◻')} +
+

${esc(p.name)}

+
${esc(p.author === 'official' ? '官方' : p.author)} · v${esc(p.version)} · ${kb(p.size || 0)}
+
+
+

${esc(p.desc)}

+
${(p.tags || []).map((t) => `${esc(t)}`).join('')}
+
` + +const html = ` + + + + +插件市场 · Image Workbench + + + +
+
+

插件市场

+

Image Workbench 插件 · 共 ${list.length} 个 · 在应用内「设置 → 插件」安装

+
+ +
+ +
+ + ${tags.map((t) => ``).join('')} +
+
+ +
${list.map(card).join('')}
+ + +
+ 安装方式:应用内 设置 → 插件 → 可安装(市场) 点「安装」,重启后生效。
+ 插件目录:~/Documents/ImageWorkbench/plugins/(Windows:%USERPROFILE%\\Documents\\ImageWorkbench\\plugins\\) +
+
+ + + +` +fs.writeFileSync(path.join(root, 'market', 'index.html'), html) +console.log('market/index.html 已生成(' + list.length + ' 个插件 / ' + tags.length + ' 个标签)') diff --git a/scripts/gen-market.js b/scripts/gen-market.js index c5e33f9..bb183e2 100644 --- a/scripts/gen-market.js +++ b/scripts/gen-market.js @@ -19,7 +19,7 @@ for (const e of man) { fs.writeFileSync(path.join(out, 'plugins', e.file), buf) const m = meta[e.id] || {} plugins.push({ - id: e.id, name: m.name || e.id, desc: m.desc || '', author: m.author || 'official', + id: e.id, name: m.name || e.id, desc: m.desc || '', author: m.author || 'official', icon: m.icon || '', color: m.color || '', tags: Array.isArray(m.tags) ? m.tags : [], version: e.version, apiVersion: 1, file: 'plugins/' + e.file, size: buf.length,