Skip to content

Text to vertical video in 100+ styles: AI codes each scene (HTML/SVG/WebGL), renders a 9:16 MP4 with music and English/Vietnamese voice. MCP, CLI and REST for AI agents.

Lint chế độ khoá: RESTRICTED_PATTERNS dùng \b thật (trước là ký tự backspace nên không bao giờ khớp)

Lumtek355da7331bab
diff --git a/engine/lib.mjs b/engine/lib.mjs
index f0db85f..a1e7b10 100644
--- a/engine/lib.mjs
+++ b/engine/lib.mjs
@@ -63,21 +63,21 @@ export function syncLib(sceneDir) {
// L4: cảnh của mẫu chạy khoá thêm các lỗi này (lớp phụ; lớp chính là CSP + Chromium không mạng, engine/sandbox.mjs).
const RESTRICTED_PATTERNS = [
- [/WebSocket/, 'WebSocket'], [/EventSource/, 'EventSource'], [/sendBeacon/, 'navigator.sendBeacon'],
- [/XMLHttpRequest/, 'XMLHttpRequest'], [/RTCPeerConnection/, 'RTCPeerConnection'],
- [/location\s*(?:\.\s*href\s*)?=(?!=)|location\s*\.\s*(?:assign|replace)\s*\(/, 'đổi location'],
- [/window\s*\.\s*open\s*\(|open\s*\(\s*["'`]/, 'window.open'],
- [/<iframe/i, '<iframe'], [/<object/i, '<object'], [/<embed/i, '<embed'], [/<form/i, '<form'],
- [/file:/i, 'file:'], [/importScripts/, 'importScripts'], [/eval\s*\(/, 'eval('], [/new\s+Function/, 'new Function'],
- [/atob\s*\(/, 'atob('], [/import\s*\(/, 'import() động'], [/new\s+(?:Shared)?Worker/, 'Worker'],
- [/<meta[^>]+http-equiv\s*=\s*["']?refresh/i, '<meta refresh'], [/<base/i, '<base'],
- [/iframe|frames\s*\[|(?:window|self|top|parent|globalThis)\s*\[\s*\d/i, 'iframe / frames[…]'], [/String\s*\.\s*fromCharCode/, 'String.fromCharCode'],
- [/(?:top|parent|opener)\s*\.\s*location/, 'top/parent.location'],
+ [/\bWebSocket\b/, 'WebSocket'], [/\bEventSource\b/, 'EventSource'], [/\bsendBeacon\b/, 'navigator.sendBeacon'],
+ [/\bXMLHttpRequest\b/, 'XMLHttpRequest'], [/\bRTCPeerConnection\b/, 'RTCPeerConnection'],
+ [/\blocation\s*(?:\.\s*href\s*)?=(?!=)|\blocation\s*\.\s*(?:assign|replace)\s*\(/, 'đổi location'],
+ [/\bwindow\s*\.\s*open\s*\(|\bopen\s*\(\s*["'`]/, 'window.open'],
+ [/<iframe\b/i, '<iframe'], [/<object\b/i, '<object'], [/<embed\b/i, '<embed'], [/<form\b/i, '<form'],
+ [/\bfile:/i, 'file:'], [/\bimportScripts\b/, 'importScripts'], [/\beval\s*\(/, 'eval('], [/\bnew\s+Function\b/, 'new Function'],
+ [/\batob\s*\(/, 'atob('], [/\bimport\s*\(/, 'import() động'], [/\bnew\s+(?:Shared)?Worker\b/, 'Worker'],
+ [/<meta[^>]+http-equiv\s*=\s*["']?refresh/i, '<meta refresh'], [/<base\b/i, '<base'],
+ [/\biframe\b|\bframes\s*\[|\b(?:window|self|top|parent|globalThis)\s*\[\s*\d/i, 'iframe / frames[…]'], [/\bString\s*\.\s*fromCharCode\b/, 'String.fromCharCode'],
+ [/\b(?:top|parent|opener)\s*\.\s*location\b/, 'top/parent.location'],
];
/** fetch( với đối số không phải chuỗi './lib/…' → lỗi (cảnh khoá chỉ được đọc tài nguyên engine). */
function badFetches(html) {
const out = [];
- for (const m of html.matchAll(/fetch\s*\(\s*([^)]{0,80})/g)) {
+ for (const m of html.matchAll(/\bfetch\s*\(\s*([^)]{0,80})/g)) {
if (!/^["'`]\.\/lib\/[\w./-]+["'`]/.test(m[1].trim())) out.push(m[0].slice(0, 60));
}
return out;