feat(site): 新首页 + 下载页 + 插件页(统一导航/页脚,参考 open-design 风格)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m42s
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m42s
This commit is contained in:
1 parent
2ad699b64d
commit
99480bf9c5
10 files changed
+803
-90
No files matched your search
+54
-12
@@ -7,7 +7,7 @@ const path = require('path')
|
||||
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const inFile = process.argv[2] || path.join(root, 'site', 'releases.json')
|
||||
const outFile = process.argv[3] || path.join(root, 'site', 'index.html')
|
||||
const outFile = process.argv[3] || path.join(root, 'site', 'download', 'index.html')
|
||||
const data = JSON.parse(fs.readFileSync(inFile, 'utf8'))
|
||||
|
||||
const PLATFORMS = [
|
||||
@@ -55,12 +55,11 @@ const html = `<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>${esc(data.app)} · 下载</title>
|
||||
<link rel="stylesheet" href="/assets/style.css">
|
||||
<style>
|
||||
:root{--bg:#fafaf9;--fg:#1c1917;--muted:#78716c;--line:#e7e5e4;--card:#fff;--brand:#1c1917}
|
||||
@media (prefers-color-scheme:dark){:root{--bg:#17161a;--fg:#f5f5f4;--muted:#a8a29e;--line:#2f2d33;--card:#1f1e23;--brand:#f5f5f4}}
|
||||
*{box-sizing:border-box}
|
||||
body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.65 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif}
|
||||
.wrap{max-width:760px;margin:0 auto;padding:56px 22px 72px}
|
||||
.dlwrap{max-width:760px;margin:0 auto;padding:48px 0 64px}
|
||||
h1{font-size:27px;margin:0 0 6px;letter-spacing:-.01em}
|
||||
.sub{color:var(--muted);margin:0 0 34px}
|
||||
h2{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600;margin:38px 0 2px}
|
||||
@@ -76,10 +75,30 @@ const html = `<!doctype html>
|
||||
.foot{margin-top:46px;color:var(--muted);font-size:12.5px;line-height:1.8}
|
||||
.foot a{color:inherit}
|
||||
code{font-size:12.5px}
|
||||
.steps{margin:6px 0 0;padding-left:22px;color:var(--fg2);font-size:13.5px;line-height:1.9}
|
||||
.steps li{margin:2px 0}
|
||||
.steps b{color:var(--fg);font-weight:600}
|
||||
pre.cmd{margin:10px 0 0;padding:10px 12px;background:var(--bg2);border:1px solid var(--line);border-radius:8px;overflow-x:auto}
|
||||
pre.cmd code{font-size:12px;color:var(--fg)}
|
||||
.note{margin:10px 0 0;color:var(--muted);font-size:12.5px;line-height:1.8}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
|
||||
<div class="links">
|
||||
<a href="/">首页</a>
|
||||
<a href="/download/" class="on">下载</a>
|
||||
<a href="/plugins/">插件</a>
|
||||
<a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
|
||||
<div class="wrap"><div class="dlwrap">
|
||||
<h1>${esc(data.app)}</h1>
|
||||
<p class="sub">${esc(data.subtitle || '')}</p>
|
||||
|
||||
@@ -93,12 +112,23 @@ ${PLATFORMS.map((p) => platformRow(latest, p)).join('\n')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>首次打开(macOS)</h2>
|
||||
<div class="row">
|
||||
<div class="name">安装包未做 Apple 公证:首次打开会被 Gatekeeper 拦一次
|
||||
<div class="hint">拖进「应用程序」后,<b>右键 → 打开</b> → 再点「打开」即可;或执行 <code>xattr -dr com.apple.quarantine /Applications/image-workbench.app</code>。之后与新版本(含应用内自动更新)都不再提示。</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>安装步骤(macOS)</h2>
|
||||
<ol class="steps">
|
||||
<li>下载上面的 <b>.dmg</b>(Apple 芯片选 Apple Silicon;老 Intel 机器选 Intel)。</li>
|
||||
<li>双击打开 dmg,把 <b>Image Workbench</b> 图标拖进「应用程序」文件夹。</li>
|
||||
<li>第一次启动:打开「应用程序」,<b>右键点图标 → 打开</b>,弹窗里再点一次「打开」。</li>
|
||||
<li>如果提示「已损坏」或「无法验证开发者」:打开「终端」,粘贴执行下面这条命令,然后重新打开应用。</li>
|
||||
</ol>
|
||||
<pre class="cmd"><code>xattr -dr com.apple.quarantine "/Applications/image-workbench.app"</code></pre>
|
||||
<p class="note">说明:安装包未做 Apple 公证($99/年开发者账号),所以第一次需要手动放行;这一步只做一次。<br>
|
||||
之后有新版本时,应用内 <b>设置 → 通用 → 版本与更新 → 检查更新</b> 就能一键升级,不用再下载安装包。</p>
|
||||
|
||||
<h2>安装步骤(Windows)</h2>
|
||||
<ol class="steps">
|
||||
<li>下载 <b>.exe</b>(NSIS 安装包,按当前用户安装,不需要管理员权限)。</li>
|
||||
<li>双击运行;若出现「Windows 已保护你的电脑」,点「更多信息 → 仍要运行」。</li>
|
||||
<li>安装完成后从开始菜单启动;数据在 <code>%USERPROFILE%\Documents\ImageWorkbench</code>。</li>
|
||||
</ol>
|
||||
|
||||
<h2>历史版本</h2>
|
||||
${history}
|
||||
@@ -106,9 +136,21 @@ ${history}
|
||||
<div class="foot">
|
||||
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 ${esc((data.updatedAt || '').slice(0, 10))}
|
||||
</div>
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
<footer><div class="wrap">
|
||||
<div class="cols">
|
||||
<div><div style="color:#fff;font-weight:640;margin-bottom:8px">Image Workbench</div>
|
||||
<div style="font-size:13px;line-height:1.8">本地优先的 AI 生图无限画布。图片、提示词与模型配置全部留在你自己的电脑里。</div></div>
|
||||
<div><h4>产品</h4><a href="/">首页</a><a href="/download/">下载</a><a href="/plugins/">插件市场</a></div>
|
||||
<div><h4>资源</h4><a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码仓库</a><a href="https://git.maqiart.eu.org/malongan/iwb-plugins-desktop" target="_blank" rel="noopener">插件仓库</a><a href="/updates/latest.json" target="_blank" rel="noopener">更新源</a></div>
|
||||
<div><h4>说明</h4><a href="/download/">安装步骤</a><a href="/plugins/">插件安装</a></div>
|
||||
</div>
|
||||
<div class="copy"><span>© Image Workbench</span><span>数据保存在本地 · 不上传任何图片</span></div>
|
||||
</div></footer>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
fs.mkdirSync(path.dirname(outFile), { recursive: true })
|
||||
fs.writeFileSync(outFile, html)
|
||||
console.log('已生成 ' + path.relative(root, outFile) + '(' + data.releases.length + ' 个版本 / ' + Object.keys((latest && latest.platforms) || {}).length + ' 个平台)')
|
||||
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'
|
||||
// 站点生成器:用 site/_home.tpl.html 与 site/_plugins.tpl.html 渲染首页 / 插件页,
|
||||
// 数据来自 site/releases.json(版本)与 market/index.json(插件)。
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const site = path.join(root, 'site')
|
||||
|
||||
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]))
|
||||
const mb = (n) => (Number(n) / 1048576).toFixed(1) + ' MB'
|
||||
|
||||
const data = JSON.parse(fs.readFileSync(path.join(site, 'releases.json'), 'utf8'))
|
||||
const rel = Array.isArray(data.releases) ? data.releases.slice() : (Array.isArray(data) ? data.slice() : [])
|
||||
rel.sort((a, b) => String(b.version).localeCompare(String(a.version), undefined, { numeric: true }))
|
||||
const latest = rel[0] || { version: '', platforms: {} }
|
||||
const V = esc(latest.version)
|
||||
|
||||
const marketFile = path.join(root, 'market', 'index.json')
|
||||
const market = fs.existsSync(marketFile) ? JSON.parse(fs.readFileSync(marketFile, 'utf8')) : { plugins: [] }
|
||||
const plugins = Array.isArray(market.plugins) ? market.plugins : []
|
||||
|
||||
const nav = (active) => [
|
||||
'<nav><div class="wrap inner">',
|
||||
' <a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>',
|
||||
' <div class="links">',
|
||||
' <a href="/"' + (active === 'home' ? ' class="on"' : '') + '>首页</a>',
|
||||
' <a href="/download/"' + (active === 'download' ? ' class="on"' : '') + '>下载</a>',
|
||||
' <a href="/plugins/"' + (active === 'plugins' ? ' class="on"' : '') + '>插件</a>',
|
||||
' <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码</a>',
|
||||
' </div>',
|
||||
' <div class="right">',
|
||||
' <a class="btn" href="/plugins/">插件市场</a>',
|
||||
' <a class="btn primary" href="/download/">下载 v' + V + '</a>',
|
||||
' </div>',
|
||||
'</div></nav>',
|
||||
].join('\n')
|
||||
|
||||
const footer = [
|
||||
'<footer><div class="wrap">',
|
||||
' <div class="cols">',
|
||||
' <div><div style="color:#fff;font-weight:640;margin-bottom:8px">Image Workbench</div>',
|
||||
' <div style="font-size:13px;line-height:1.8">本地优先的 AI 生图无限画布。图片、提示词与模型配置全部留在你自己的电脑里。</div></div>',
|
||||
' <div><h4>产品</h4><a href="/">首页</a><a href="/download/">下载</a><a href="/plugins/">插件市场</a></div>',
|
||||
' <div><h4>资源</h4><a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop" target="_blank" rel="noopener">源码仓库</a><a href="https://git.maqiart.eu.org/malongan/iwb-plugins-desktop" target="_blank" rel="noopener">插件仓库</a><a href="/updates/latest.json" target="_blank" rel="noopener">更新源</a></div>',
|
||||
' <div><h4>说明</h4><a href="/download/">安装步骤</a><a href="/plugins/">插件安装</a></div>',
|
||||
' </div>',
|
||||
' <div class="copy"><span>© ' + new Date().getFullYear() + ' Image Workbench</span><span>数据保存在本地 · 不上传任何图片</span></div>',
|
||||
'</div></footer>',
|
||||
].join('\n')
|
||||
|
||||
const card = (p) => [
|
||||
' <div class="pcard" data-name="' + esc((p.name + ' ' + p.id + ' ' + (p.desc || '') + ' ' + (p.tags || []).join(' ')).toLowerCase()) + '" data-tags="' + esc((p.tags || []).join(',')) + '">',
|
||||
' <div class="head"><span class="av" style="background:' + esc(p.color || '#eef2f6') + '">' + esc(p.icon || '◻') + '</span>',
|
||||
' <div><div class="nm">' + esc(p.name || p.id) + '</div><div class="ver">v' + esc(p.version || '') + ' · ' + esc(p.author === 'official' ? '官方' : (p.author || '')) + '</div></div></div>',
|
||||
' <div class="desc">' + esc(p.desc || '') + '</div>',
|
||||
' <div class="tags">' + (p.tags || []).map((t) => '<span class="tag">' + esc(t) + '</span>').join('') + '</div>',
|
||||
' </div>',
|
||||
].join('\n')
|
||||
|
||||
const feats = [
|
||||
['💻', '#eef2ff', '本地优先', '图片与数据保存在 ~/Documents/ImageWorkbench,不经服务器中转;可整目录备份、迁移到新电脑。'],
|
||||
['🕸️', '#fff7ed', '节点式无限画布', '参考图 → 提示词 → 生成 → 图库,用连线把工作流串起来;一张画布容纳整条生产线。'],
|
||||
['🧩', '#ecfdf5', '插件按需安装', '应用本体不含插件,需要什么装什么;可随时启停,关闭后入口自动隐藏。'],
|
||||
]
|
||||
const featCards = feats.map((f) => [
|
||||
' <div class="card"><div class="ico" style="background:' + f[1] + '">' + f[0] + '</div>',
|
||||
' <h3>' + f[2] + '</h3><p>' + f[3] + '</p></div>',
|
||||
].join('\n')).join('\n')
|
||||
|
||||
const dlCards = [
|
||||
['darwin-aarch64', 'macOS · Apple Silicon', 'M1 / M2 / M3 / M4'],
|
||||
['darwin-x86_64', 'macOS · Intel', 'x86_64'],
|
||||
['windows-x86_64', 'Windows · x64', '需要 WebView2'],
|
||||
].map(([key, label, hint]) => {
|
||||
const p = (latest.platforms || {})[key]
|
||||
if (!p) return '<div class="none"><div class="n">' + label + '</div><div class="s">暂未提供</div></div>'
|
||||
return '<a href="/' + esc(p.file) + '"><div class="n">' + label + '</div><div class="s">' + hint + ' · ' + mb(p.size) + ' · .' + esc(String(p.file).split('.').pop()) + '</div></a>'
|
||||
}).join('\n ')
|
||||
|
||||
const tags = []
|
||||
for (const p of plugins) for (const t of (p.tags || [])) if (tags.indexOf(t) < 0) tags.push(t)
|
||||
const tagChips = tags.map((t) => '<button class="tag" data-tag="' + esc(t) + '" style="cursor:pointer;padding:5px 12px">' + esc(t) + '</button>').join('\n ')
|
||||
|
||||
function render(tpl, map) {
|
||||
let out = fs.readFileSync(path.join(site, tpl), 'utf8')
|
||||
for (const k of Object.keys(map)) out = out.split('<!--' + k + '-->').join(map[k])
|
||||
return out
|
||||
}
|
||||
|
||||
const home = render('_home.tpl.html', {
|
||||
NAV: nav('home'),
|
||||
FOOTER: footer,
|
||||
VERSION: V,
|
||||
PLUGIN_COUNT: String(plugins.length),
|
||||
FEAT_CARDS: featCards,
|
||||
PLUGIN_CARDS: plugins.slice(0, 6).map((p) => card(p).replace(/^\s+/, ' ')).join('\n'),
|
||||
DL_CARDS: dlCards,
|
||||
})
|
||||
fs.writeFileSync(path.join(site, 'index.html'), home)
|
||||
|
||||
const pluginsPage = render('_plugins.tpl.html', {
|
||||
NAV: nav('plugins'),
|
||||
FOOTER: footer,
|
||||
PLUGIN_COUNT: String(plugins.length),
|
||||
TAG_CHIPS: tagChips,
|
||||
PLUGIN_CARDS: plugins.map(card).join('\n'),
|
||||
})
|
||||
fs.mkdirSync(path.join(site, 'plugins'), { recursive: true })
|
||||
fs.writeFileSync(path.join(site, 'plugins', 'index.html'), pluginsPage)
|
||||
fs.writeFileSync(path.join(site, 'plugins-index.json'), JSON.stringify(market, null, 2) + '\n')
|
||||
|
||||
console.log('站点已生成:首页 / 插件页(' + plugins.length + ' 个插件,' + tags.length + ' 个标签,版本 v' + V + ')')
|
||||
Reference in new issue
Block a user