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('')}
+ + + +
+ + + +` +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,