@mingxy/cerebro 1.17.0 → 1.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/web-server.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mingxy/cerebro",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.2",
|
|
4
4
|
"description": "Cerebro persistent memory plugin for OpenCode — auto-recall, auto-capture, 9 memory tools with clustering, project-scoped memory isolation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/web-server.ts
CHANGED
|
@@ -44,7 +44,9 @@ function getMimeType(ext: string): string {
|
|
|
44
44
|
// ── Safe path resolver (prevent traversal) ───────────────────────────────
|
|
45
45
|
|
|
46
46
|
function resolveSafe(baseDir: string, pathname: string): string | null {
|
|
47
|
-
|
|
47
|
+
// Strip leading slash so path.resolve treats it as relative
|
|
48
|
+
const relative = pathname.startsWith("/") ? pathname.slice(1) : pathname;
|
|
49
|
+
const resolved = path.resolve(baseDir, relative || ".");
|
|
48
50
|
if (!resolved.startsWith(baseDir + path.sep) && resolved !== baseDir) {
|
|
49
51
|
return null;
|
|
50
52
|
}
|
|
@@ -154,7 +156,7 @@ function serveFile(
|
|
|
154
156
|
|
|
155
157
|
// Config injection: replace placeholder in index.html
|
|
156
158
|
if (ext === ".html" && data.includes("__OMEM_API_URL__")) {
|
|
157
|
-
body = data.toString("utf-8").replace(/__OMEM_API_URL__
|
|
159
|
+
body = data.toString("utf-8").replace(/window\.__OMEM_API_URL__\s*=\s*["']__OMEM_API_URL__["']/, `window.__OMEM_API_URL__ = "${apiUrl}"`);
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
res.writeHead(200, {
|