mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-09 19:27:58 +02:00
chore: integrate current main into hardening
This commit is contained in:
@@ -18,6 +18,7 @@ const {
|
||||
isAllowedHostHeader,
|
||||
isAllowedOrigin,
|
||||
} = require('./lib/loopback-guard');
|
||||
const { normalizeAgentTools } = require('./lib/agent-tools');
|
||||
|
||||
const DEFAULT_HOST = '127.0.0.1';
|
||||
|
||||
@@ -52,7 +53,11 @@ function readFrontmatter(p) {
|
||||
const s = l.indexOf(':'); if (s <= 0) continue;
|
||||
let k = l.slice(0, s).trim(), v = l.slice(s + 1).trim();
|
||||
if ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))) v = v.slice(1, -1);
|
||||
if (v.startsWith('[') && v.endsWith(']')) { try { v = JSON.parse(v); } catch { v = v.slice(1, -1).split(',').map(x => x.trim().replace(/["']/g, '')); } }
|
||||
if (k === 'tools') {
|
||||
v = normalizeAgentTools(v);
|
||||
} else if (v.startsWith('[') && v.endsWith(']')) {
|
||||
try { v = JSON.parse(v); } catch { v = v.slice(1, -1).split(',').map(x => x.trim().replace(/["']/g, '')); }
|
||||
}
|
||||
fm[k] = v;
|
||||
}
|
||||
fm._body = c.replace(/^---[\s\S]*?---\n*/, '').trim();
|
||||
|
||||
Reference in New Issue
Block a user