diff --git a/zefie_wtvp_minisrv/app.js b/zefie_wtvp_minisrv/app.js
index 8b209adb..fd281eb5 100644
--- a/zefie_wtvp_minisrv/app.js
+++ b/zefie_wtvp_minisrv/app.js
@@ -1229,8 +1229,9 @@ function handleProxy(socket, request_type, request_headers, res, data) {
removeImages: minisrv_config.services[request_type]?.remove_images || false,
maxImageWidth: minisrv_config.services[request_type]?.max_image_width || 400,
simplifyTables: minisrv_config.services[request_type]?.simplify_tables !== false,
- addWTVControls: minisrv_config.services[request_type]?.add_wtv_controls !== false,
- maxWidth: minisrv_config.services[request_type]?.max_width || 544
+ maxWidth: minisrv_config.services[request_type]?.max_width || 544,
+ preserveJellyScript: minisrv_config.services[request_type]?.preserve_jellyscript !== false,
+ jellyScriptMaxSize: minisrv_config.services[request_type]?.jellyscript_max_size || 8192
};
htmlContent = proxy.transformHtml(htmlContent, originalUrl, transformOptions);
diff --git a/zefie_wtvp_minisrv/includes/classes/WTVMinifyingProxy.js b/zefie_wtvp_minisrv/includes/classes/WTVMinifyingProxy.js
index 593a4f87..4b5ea0a8 100644
--- a/zefie_wtvp_minisrv/includes/classes/WTVMinifyingProxy.js
+++ b/zefie_wtvp_minisrv/includes/classes/WTVMinifyingProxy.js
@@ -18,7 +18,10 @@ class WTVMinifyingProxy {
this.allowedAttributes = [
'href', 'src', 'alt', 'title', 'width', 'height', 'border', 'align', 'valign',
'bgcolor', 'color', 'size', 'face', 'target', 'name', 'value', 'type', 'action',
- 'method', 'cols', 'rows', 'cellpadding', 'cellspacing', 'nowrap'
+ 'method', 'cols', 'rows', 'cellpadding', 'cellspacing', 'nowrap',
+ // JellyScript event handlers
+ 'onclick', 'onload', 'onunload', 'onsubmit', 'onreset', 'onfocus', 'onblur',
+ 'onchange', 'onmouseover', 'onmouseout', 'onmousedown', 'onmouseup'
];
// CSS properties to convert to HTML attributes
@@ -30,6 +33,31 @@ class WTVMinifyingProxy {
'font-size': 'size',
'font-family': 'face'
};
+
+ // JellyScript (WebTV JavaScript) supported features
+ this.jellyScriptSupported = {
+ // Core JavaScript objects and methods
+ objects: ['window', 'document', 'history', 'location', 'navigator'],
+ domMethods: ['getElementById', 'getElementsByTagName', 'getElementsByName'],
+ windowMethods: ['alert', 'confirm', 'prompt', 'open', 'close', 'focus', 'blur'],
+ historyMethods: ['back', 'forward', 'go'],
+ documentMethods: ['write', 'writeln', 'open', 'close'],
+ events: ['onclick', 'onload', 'onunload', 'onsubmit', 'onreset', 'onfocus', 'onblur', 'onchange'],
+ // Basic JavaScript features
+ features: ['var', 'function', 'if', 'else', 'for', 'while', 'switch', 'case', 'break', 'continue', 'return']
+ };
+
+ // Modern JavaScript features not supported by JellyScript
+ this.unsupportedJSFeatures = [
+ // Modern ES6+ features
+ 'const', 'let', 'arrow functions', '=>', 'class', 'extends', 'import', 'export',
+ // Modern APIs
+ 'fetch', 'Promise', 'async', 'await', 'XMLHttpRequest', 'addEventListener',
+ // jQuery and libraries
+ '\\$\\(', 'jQuery', 'angular', 'react', 'vue', 'prototype\\.js',
+ // Modern DOM methods
+ 'querySelector', 'querySelectorAll', 'classList', 'dataset'
+ ];
}
/**
@@ -216,13 +244,21 @@ class WTVMinifyingProxy {
}
/**
- * Remove unsupported content and scripts
+ * Remove unsupported content but preserve JellyScript-compatible JavaScript
*/
removeUnsupportedContent(html) {
+ // Process script tags to filter for JellyScript compatibility
+ html = html.replace(/`;
+ }
+ return ''; // Remove empty or incompatible scripts
+ });
+
+ // Remove other unsupported content
return html
- // Remove scripts
- .replace(/