发布 0.2.1 并完善工具边界与安全性
This commit is contained in:
@@ -5,6 +5,9 @@ import { fileURLToPath } from 'node:url'
|
||||
|
||||
const serverDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const projectRoot = path.resolve(serverDir, '..')
|
||||
const legacyToolIdAliases = new Map([
|
||||
['ascii-hex', 'utf8-hex'],
|
||||
])
|
||||
|
||||
async function readJson(filePath) {
|
||||
return JSON.parse(await readFile(filePath, 'utf8'))
|
||||
@@ -30,7 +33,9 @@ export function normalizeNavigation(input, catalog, defaults) {
|
||||
if (!candidate || !categoryIds.has(candidate.id) || seenCategories.has(candidate.id)) continue
|
||||
seenCategories.add(candidate.id)
|
||||
const tools = []
|
||||
for (const toolId of Array.isArray(candidate.tools) ? candidate.tools : []) {
|
||||
for (const savedToolId of Array.isArray(candidate.tools) ? candidate.tools : []) {
|
||||
const migratedToolId = legacyToolIdAliases.get(savedToolId)
|
||||
const toolId = migratedToolId && toolById.has(migratedToolId) ? migratedToolId : savedToolId
|
||||
if (!toolById.has(toolId) || seenTools.has(toolId)) continue
|
||||
seenTools.add(toolId)
|
||||
tools.push(toolId)
|
||||
|
||||
Reference in New Issue
Block a user