站点结构完善:首页信息层级重排 + 补齐分类图标与主题变量 + 修静态资源 404
- 首页:hero(标题/副文案/两个行动按钮)→ 搜索框前置 → 最近使用 → 按类别浏览(14 类磁贴)→ 完整工具目录
- 补齐 27 个缺失的 SVG symbol(i-edit/i-monitor/i-book/i-file/i-grid/i-abc/i-users/i-star/i-music/i-info/i-table/i-keyboard/i-mouse/i-type/i-diff/i-print/i-id/i-phone/i-mail/i-archive/i-cookie/i-braces/i-database/i-link/i-minimize/i-filter/i-lock)
- 修 icon('i-lock') 双前缀导致图标失效(app.js / admin.js)
- 补 --muted/--text/--brand/--panel-2 四个未定义 CSS 变量别名,跟随主题切换
- 修 server.mjs 在 Windows 下 path.normalize 返回反斜杠导致 /js/*.js、/css/*.css 全 404
- 收藏按钮不再重建工具页(避免重复扣积分)
This commit is contained in:
1 parent
bc4e0e005e
commit
6c84cd2283
5 files changed
+103
-31
No files matched your search
+48
-19
@@ -33,6 +33,11 @@
|
||||
--accent-line: rgba(91, 140, 255, .45);
|
||||
--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
|
||||
--sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
/* 别名:老工具脚本沿用的变量名,统一映射到主题变量,换主题时一起跟随 */
|
||||
--muted: var(--dim);
|
||||
--text: var(--txt);
|
||||
--brand: var(--accent);
|
||||
--panel-2: var(--panel-solid);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
@@ -169,10 +174,15 @@ kbd {
|
||||
.wrap { max-width: 1060px; margin: 0 auto; }
|
||||
|
||||
/* ============ 首页 ============ */
|
||||
.hero { padding: 22px 0 6px; }
|
||||
.hero h1 { font-size: clamp(26px, 4.2vw, 38px); line-height: 1.22; margin: 0 0 12px; letter-spacing: -.02em; }
|
||||
.hero { padding: 20px 0 6px; max-width: 760px; }
|
||||
.hero-kicker { display: flex; align-items: center; gap: 8px; color: var(--accent-2); font: 600 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 18px; }
|
||||
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 5px rgba(56,211,159,.12); }
|
||||
.hero h1 { font-size: clamp(28px, 4.2vw, 46px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -.035em; }
|
||||
.hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, var(--accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
||||
.hero p { color: var(--dim); max-width: 620px; margin: 0 0 18px; font-size: 14.5px; }
|
||||
.hero p { color: var(--dim); max-width: 650px; margin: 0 0 20px; font-size: 15px; }
|
||||
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 20px; }
|
||||
.hero-cta span { opacity: .72; font: 11px var(--mono); margin-left: 8px; }
|
||||
.hero-secondary { background: var(--soft); }
|
||||
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; }
|
||||
.chip {
|
||||
display: inline-flex; align-items: center; gap: 7px;
|
||||
@@ -737,10 +747,11 @@ html, body { overflow-x: hidden; }
|
||||
/* ---------- 首页:找工具(搜索 + 分类小按钮) ---------- */
|
||||
.findbar { position: sticky; top: 0; z-index: 20; padding: 12px 0 10px; margin-bottom: 6px;
|
||||
background: linear-gradient(var(--bg) 72%, transparent); backdrop-filter: blur(8px); }
|
||||
.find-search { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px;
|
||||
border: 1px solid var(--line); background: var(--panel); }
|
||||
.find-search { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 17px; border-radius: 12px;
|
||||
border: 1px solid var(--accent-line); background: var(--panel-solid); box-shadow: 0 14px 30px -24px rgba(91,140,255,.9); }
|
||||
.find-search::after { content: "⌘K"; flex: none; font: 11px var(--mono); color: var(--dim-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; }
|
||||
.find-search svg { width: 17px; height: 17px; color: var(--dim-2); flex: none; }
|
||||
.find-search input { flex: 1; border: none; background: none; color: var(--txt); font-size: 14.5px; outline: none; }
|
||||
.find-search input { flex: 1; border: none; background: none; color: var(--txt); font-size: 15px; outline: none; }
|
||||
.find-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: none; }
|
||||
.find-chips::-webkit-scrollbar { display: none; }
|
||||
.find-chip { flex: none; font-size: 12.5px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
|
||||
@@ -775,9 +786,13 @@ html, body { overflow-x: hidden; }
|
||||
.nav-count{flex:none;font-size:11px;padding:1px 6px;border-radius:999px;background:var(--soft);color:var(--muted)}
|
||||
.nav-group.closed .nav-item{display:none}
|
||||
|
||||
/* 最近使用 / 收藏 */
|
||||
.recent-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:10px 0 4px}
|
||||
.recent-cap{font-size:12px;color:var(--muted);margin-right:2px}
|
||||
/* 最近使用 / 首页结构 */
|
||||
.section-label { display:flex; align-items:baseline; gap:10px; margin:26px 0 10px; padding-bottom:8px; border-bottom:1px solid var(--line); }
|
||||
.section-label span { color:var(--txt); font-size:14px; font-weight:650; }
|
||||
.section-label small { color:var(--dim-2); font-size:11.5px; }
|
||||
.tool-directory-label { margin-top:30px; }
|
||||
.recent-row { display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin:18px 0 4px; min-height:32px; }
|
||||
.recent-cap { font-size:12px; color:var(--dim-2); margin-right:3px; }
|
||||
.find-chip.ghost{background:var(--soft);color:var(--muted)}
|
||||
.find-chip.ghost:hover{color:var(--text)}
|
||||
.card-star{position:absolute;top:10px;right:12px;font-size:14px;color:var(--muted);opacity:.45}
|
||||
@@ -803,16 +818,30 @@ html, body { overflow-x: hidden; }
|
||||
.clock-saver div{font-size:44px;font-weight:600}
|
||||
.clock-saver .sm{font-size:14px;opacity:.6;margin-top:6px}
|
||||
|
||||
/* 分类磁贴 */
|
||||
.cat-tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px;margin:14px 0 18px}
|
||||
.cat-tile{display:flex;align-items:center;gap:10px;text-align:left;padding:12px 14px;border:1px solid var(--line);
|
||||
border-radius:12px;background:var(--panel);cursor:pointer;transition:.16s}
|
||||
.cat-tile:hover{border-color:var(--brand);transform:translateY(-1px)}
|
||||
.cat-tile-ico{width:34px;height:34px;flex:none;border-radius:10px;background:var(--soft);display:grid;place-items:center;color:var(--brand)}
|
||||
.cat-tile-ico svg{width:18px;height:18px}
|
||||
.cat-tile-txt{display:flex;flex-direction:column;min-width:0}
|
||||
.cat-tile-txt b{font-size:14px}
|
||||
.cat-tile-txt span{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
/* 分类入口 */
|
||||
.cat-tiles { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:9px; margin:10px 0 20px; }
|
||||
.cat-tile { display:flex; align-items:center; gap:11px; min-height:68px; text-align:left; padding:11px 13px; border:1px solid var(--line);
|
||||
border-radius:10px; background:var(--panel); color:var(--txt); cursor:pointer; transition:border-color .16s,background .16s,transform .16s; }
|
||||
.cat-tile:hover { border-color:var(--accent-line); background:var(--accent-soft); transform:translateY(-1px); }
|
||||
.cat-tile-ico { width:36px; height:36px; flex:none; border-radius:9px; background:var(--soft-2); border:1px solid var(--line); display:grid; place-items:center; color:var(--accent); }
|
||||
.cat-tile-ico svg { width:18px; height:18px; }
|
||||
.cat-tile-txt { display:flex; flex-direction:column; min-width:0; gap:2px; }
|
||||
.cat-tile-txt b { font-size:13.5px; }
|
||||
.cat-tile-txt span { font-size:11px; color:var(--dim-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
@media (max-width:640px) {
|
||||
.hero { padding-top:8px; }
|
||||
.hero-kicker { margin-bottom:13px; }
|
||||
.hero-actions .btn { flex:1 1 140px; }
|
||||
.hero-stats { gap:6px; }
|
||||
.hero-stats .chip { padding:5px 8px; font-size:11px; }
|
||||
.findbar { margin-top:14px; }
|
||||
.find-search { min-height:54px; }
|
||||
.cat-tiles { grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
|
||||
.cat-tile { min-height:64px; padding:9px; gap:8px; }
|
||||
.cat-tile-ico { width:31px; height:31px; }
|
||||
.cat-tile-txt b { font-size:12.5px; }
|
||||
.cat-tile-txt span { font-size:10px; }
|
||||
}
|
||||
.swatch{width:38px;height:38px;border-radius:8px;border:1px solid var(--line);cursor:pointer}
|
||||
.swatch.big{width:64px;height:64px}
|
||||
.swatch.on{outline:2px solid var(--brand);outline-offset:2px}
|
||||
|
||||
+28
@@ -49,6 +49,34 @@
|
||||
<symbol id="i-moon" viewBox="0 0 24 24"><path d="M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5Z"/></symbol>
|
||||
<symbol id="i-sun" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M19.1 4.9l-1.4 1.4M6.3 17.7l-1.4 1.4"/></symbol>
|
||||
<symbol id="i-mono" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 3v18" /><path d="M12 3a9 9 0 0 1 0 18" fill="currentColor" stroke="none"/></symbol>
|
||||
<!-- 工具分类用到的图标 -->
|
||||
<symbol id="i-edit" viewBox="0 0 24 24"><path d="M4 20h4l10-10-4-4L4 16z"/><path d="m14 6 4 4"/></symbol>
|
||||
<symbol id="i-monitor" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M9 20h6M12 16v4"/></symbol>
|
||||
<symbol id="i-book" viewBox="0 0 24 24"><path d="M5 4h9a3 3 0 0 1 3 3v13H8a3 3 0 0 1-3-3z"/><path d="M17 7h2v13H8"/></symbol>
|
||||
<symbol id="i-file" viewBox="0 0 24 24"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/></symbol>
|
||||
<symbol id="i-grid" viewBox="0 0 24 24"><rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/></symbol>
|
||||
<symbol id="i-abc" viewBox="0 0 24 24"><path d="M3 17 6.5 7 10 17M4.4 14h4.2"/><path d="M13 17V7h3a3 3 0 0 1 0 6h-3"/><path d="M20 11h-2a2 2 0 0 0 0 4h2"/></symbol>
|
||||
<symbol id="i-users" viewBox="0 0 24 24"><circle cx="9" cy="8" r="3.2"/><path d="M3.5 19a5.5 5.5 0 0 1 11 0"/><path d="M16 6.2a3 3 0 0 1 0 5.6M17.5 19a5 5 0 0 0-2.2-4.1"/></symbol>
|
||||
<symbol id="i-star" viewBox="0 0 24 24"><path d="m12 3.5 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17.6l-5.4 2.8 1-6.1L3.2 10l6.1-.9z"/></symbol>
|
||||
<symbol id="i-music" viewBox="0 0 24 24"><circle cx="7" cy="18" r="2.6"/><circle cx="18" cy="16" r="2.6"/><path d="M9.6 18V7l10.6-2v11"/></symbol>
|
||||
<symbol id="i-info" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 11v6M12 7.6v.2"/></symbol>
|
||||
<symbol id="i-table" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 10h18M9 10v10M15 10v10"/></symbol>
|
||||
<symbol id="i-keyboard" viewBox="0 0 24 24"><rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 10h.2M10 10h.2M14 10h.2M18 10h.2M7 14h10"/></symbol>
|
||||
<symbol id="i-mouse" viewBox="0 0 24 24"><rect x="6" y="3" width="12" height="18" rx="6"/><path d="M12 7v3"/></symbol>
|
||||
<symbol id="i-type" viewBox="0 0 24 24"><path d="M4 6h16M9 6v13M15 6v13M12 19h6"/></symbol>
|
||||
<symbol id="i-diff" viewBox="0 0 24 24"><path d="M6 4v16M18 4v16M6 9h5M6 15h5M13 12h5"/></symbol>
|
||||
<symbol id="i-print" viewBox="0 0 24 24"><path d="M7 8V4h10v4"/><rect x="3" y="8" width="18" height="8" rx="2"/><path d="M7 16h10v4H7z"/></symbol>
|
||||
<symbol id="i-id" viewBox="0 0 24 24"><rect x="2" y="5" width="20" height="14" rx="2"/><circle cx="8" cy="12" r="2.2"/><path d="M13 10h6M13 14h4M5 16a3 3 0 0 1 6 0"/></symbol>
|
||||
<symbol id="i-phone" viewBox="0 0 24 24"><rect x="7" y="2" width="10" height="20" rx="2.5"/><path d="M11 18.5h2"/></symbol>
|
||||
<symbol id="i-mail" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3.5 7 8.5 6 8.5-6"/></symbol>
|
||||
<symbol id="i-archive" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="5" rx="1.5"/><path d="M5 9v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9"/><path d="M10 13h4"/></symbol>
|
||||
<symbol id="i-cookie" viewBox="0 0 24 24"><path d="M21 12.5A9 9 0 1 1 11.5 3a3.5 3.5 0 0 0 4.5 4.5 3.5 3.5 0 0 0 5 5Z"/><path d="M8.5 9.5h.2M9 15h.2M14 13.5h.2"/></symbol>
|
||||
<symbol id="i-braces" viewBox="0 0 24 24"><path d="M8 3.5c-2 0-2.5 1.2-2.5 3v2c0 1.5-.6 2.5-2 2.5 1.4 0 2 1 2 2.5v2c0 1.8.5 3 2.5 3"/><path d="M16 3.5c2 0 2.5 1.2 2.5 3v2c0 1.5.6 2.5 2 2.5-1.4 0-2 1-2 2.5v2c0 1.8-.5 3-2.5 3"/></symbol>
|
||||
<symbol id="i-database" viewBox="0 0 24 24"><ellipse cx="12" cy="6" rx="8" ry="3"/><path d="M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6"/><path d="M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"/></symbol>
|
||||
<symbol id="i-link" viewBox="0 0 24 24"><path d="M10 13.5a4 4 0 0 0 5.7 0l2.8-2.8a4 4 0 0 0-5.7-5.7L11.5 6.3"/><path d="M14 10.5a4 4 0 0 0-5.7 0L5.5 13.3a4 4 0 0 0 5.7 5.7l1.3-1.3"/></symbol>
|
||||
<symbol id="i-minimize" viewBox="0 0 24 24"><path d="M5 12h14"/></symbol>
|
||||
<symbol id="i-filter" viewBox="0 0 24 24"><path d="M3 5h18l-7 8v6l-4-2v-4z"/></symbol>
|
||||
<symbol id="i-lock" viewBox="0 0 24 24"><rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></symbol>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
async function render(view) {
|
||||
view.textContent = ''
|
||||
const wrap = el('div', { class: 'wrap admin' })
|
||||
wrap.append(el('header', { class: 'tool-head' }, el('div', { class: 'card-ico', html: DB.icon('i-lock') }),
|
||||
wrap.append(el('header', { class: 'tool-head' }, el('div', { class: 'card-ico', html: DB.icon('lock') }),
|
||||
el('div', {}, el('h1', { text: '管理后台' }), el('p', { text: '看用户、调积分、生成 CDK。每次用工具扣 1 积分。' }))))
|
||||
view.append(wrap)
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@
|
||||
writeList(FAV, list)
|
||||
DB.toast(i >= 0 ? '已取消收藏' : '已收藏')
|
||||
renderNav(navSearch.value)
|
||||
if (currentId === id) route()
|
||||
document.querySelectorAll('.fav-btn').forEach((button) => {
|
||||
button.classList.toggle('on', isFav(currentId))
|
||||
button.textContent = isFav(currentId) ? '★ 已收藏' : '☆ 收藏'
|
||||
button.setAttribute('aria-pressed', String(isFav(currentId)))
|
||||
})
|
||||
}
|
||||
const pushRecent = (id) => {
|
||||
if (!id || ['admin', 'about'].includes(id)) return
|
||||
@@ -102,7 +106,7 @@
|
||||
box.append(el('button', {
|
||||
class: 'nav-item' + (currentId === 'admin' ? ' active' : ''),
|
||||
onclick: () => go('admin'),
|
||||
html: icon('i-lock') + '<span></span>'
|
||||
html: icon('lock') + '<span></span>'
|
||||
}))
|
||||
box.lastChild.querySelector('span').textContent = '管理后台'
|
||||
nav.append(box)
|
||||
@@ -123,9 +127,14 @@
|
||||
view.textContent = ''
|
||||
const wrap = el('div', { class: 'wrap' })
|
||||
wrap.append(el('header', { class: 'hero', html: `
|
||||
<h1>一个人人可用的 <em>开发者工具箱</em></h1>
|
||||
<p>图片转换、哈希与加密、JWT、时间戳、JSON、正则、Diff、颜色、CIDR⋯⋯
|
||||
全部在浏览器本地算完,不上传任何数据,断网也能用。</p>` }))
|
||||
<div class="hero-kicker"><span class="pulse-dot"></span> DevBox · 本地优先的开发工具箱</div>
|
||||
<h1>把重复的开发工作,<em>交给工具</em></h1>
|
||||
<p>JSON、哈希、图片、时间、网络与文本工具集中在一个工作台。打开即用,处理结果默认留在浏览器里。</p>
|
||||
<div class="hero-actions">
|
||||
<button class="btn primary hero-cta" data-focus-search>开始找工具 <span>⌘K</span></button>
|
||||
<button class="btn hero-secondary" data-open-recent>继续上次工作</button>
|
||||
</div>
|
||||
` }))
|
||||
wrap.append(el('div', { class: 'hero-stats' }, ...[
|
||||
[tools.length + ' 个工具', '个'],
|
||||
[groups.length + ' 类', '类'],
|
||||
@@ -133,7 +142,7 @@
|
||||
['100% 本地', '本'],
|
||||
].map(([a, b]) => el('span', { class: 'chip', html: `<b>${a.split(' ')[0]}</b>${a.slice(a.indexOf(' ') + 1)}` }))))
|
||||
|
||||
// 分类磁贴(参考 deertools 的分类入口)
|
||||
// 找工具搜索置于首屏,分类与完整列表按优先级后置
|
||||
const tiles = el('div', { class: 'cat-tiles' })
|
||||
const tileIcons = { image: 'image', encode: 'copy', crypto: 'lock', text: 'text', time: 'clock', web: 'globe', format: 'box', creator: 'bolt', random: 'swap', device: 'monitor', study: 'book', office: 'file', life: 'sun', fun: 'grid' }
|
||||
for (const g of groups) {
|
||||
@@ -143,16 +152,22 @@
|
||||
tile.addEventListener('click', () => { homeFilter.group = g.id; homeFilter.kw = ''; input.value = ''; paintChips(); paintList(); listWrap.scrollIntoView({ behavior: 'smooth', block: 'start' }) })
|
||||
tiles.append(tile)
|
||||
}
|
||||
wrap.append(tiles)
|
||||
|
||||
// 找工具:搜索框 + 分类小按钮
|
||||
const input = el('input', { type: 'search', placeholder: '搜工具:图片 / 哈希 / 随机 / 时间戳 / 二维码…', autocomplete: 'off' })
|
||||
// 找工具:首屏优先搜索,其次最近使用、分类入口、完整目录
|
||||
const input = el('input', { type: 'search', placeholder: '搜索 500+ 个工具:JSON、哈希、图片、时间戳…', autocomplete: 'off' })
|
||||
const chipRow = el('div', { class: 'find-chips' })
|
||||
wrap.querySelector('[data-focus-search]')?.addEventListener('click', () => { input.focus(); input.scrollIntoView({ behavior: 'smooth', block: 'center' }) })
|
||||
wrap.querySelector('[data-open-recent]')?.addEventListener('click', () => {
|
||||
const recent = readList(REC).map((id) => byId(id)).filter(Boolean)
|
||||
if (recent[0]) go(recent[0].id); else { input.focus(); input.scrollIntoView({ behavior: 'smooth', block: 'center' }) }
|
||||
})
|
||||
const listWrap = el('div', { class: 'find-list' })
|
||||
const searchBox = el('div', { class: 'find-search' }, el('svg', { html: '<use href="#i-search"/>' }), input)
|
||||
wrap.append(el('div', { class: 'findbar' }, searchBox, chipRow))
|
||||
const recentRow = el('div', { class: 'recent-row' })
|
||||
wrap.append(recentRow)
|
||||
wrap.append(el('div', { class: 'section-label', html: '<span>按类别浏览</span><small>先选方向,再从工具列表继续</small>' }))
|
||||
wrap.append(tiles)
|
||||
wrap.append(el('div', { class: 'section-label tool-directory-label', html: '<span>完整工具目录</span><small>搜索或按类别筛选</small>' }))
|
||||
wrap.append(listWrap)
|
||||
const paintRecent = () => {
|
||||
recentRow.textContent = ''
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ async function serveStatic(req, res, pathname) {
|
||||
let rel = decodeURIComponent(pathname).replace(/^\/+/, '')
|
||||
if (!rel) rel = 'index.html'
|
||||
if (rel.endsWith('/')) rel += 'index.html'
|
||||
rel = normalize(rel).replace(/^\.\.(\/|\\|$)/, '')
|
||||
rel = normalize(rel).replace(/^\.\.(\/|\\|$)/, '').replace(/\\/g, '/')
|
||||
if (!STATIC_ALLOW.some((re) => re.test(rel))) {
|
||||
res.writeHead(404, { 'content-type': 'text/plain; charset=utf-8' })
|
||||
return res.end('404')
|
||||
|
||||
Reference in new issue
Block a user