feat: add resref auto-lookup index for NWScript editor

This commit is contained in:
plenarius
2026-04-20 19:11:10 -04:00
parent 02ca134743
commit 1b8293627d
2 changed files with 68 additions and 0 deletions
+14
View File
@@ -5,6 +5,7 @@ import {
writeFile,
deleteFile,
} from "../services/editor.service.js";
import { lookupResref, getResrefCount } from "../nwscript/resref-index.js";
const router = Router();
@@ -48,4 +49,17 @@ router.delete("/file/:repo/*path", async (req, res) => {
}
});
router.get("/resref/:resref", (req, res) => {
const entry = lookupResref(req.params.resref);
if (entry) {
res.json(entry);
} else {
res.status(404).json({ error: "resref not found" });
}
});
router.get("/resref-count", (_req, res) => {
res.json({ count: getResrefCount() });
});
export default router;