agentgui 1.0.431 → 1.0.432
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/server.js +7 -4
- package/static/index.html +11 -8
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -899,21 +899,24 @@ function acceptsEncoding(req, encoding) {
|
|
|
899
899
|
|
|
900
900
|
function compressAndSend(req, res, statusCode, contentType, body) {
|
|
901
901
|
const raw = typeof body === 'string' ? Buffer.from(body) : body;
|
|
902
|
+
const isHtml = contentType && contentType.includes('text/html');
|
|
903
|
+
const baseHeaders = { 'Content-Type': contentType };
|
|
904
|
+
if (isHtml) baseHeaders['Cache-Control'] = 'no-store';
|
|
902
905
|
if (raw.length < 860) {
|
|
903
|
-
res.writeHead(statusCode, {
|
|
906
|
+
res.writeHead(statusCode, { ...baseHeaders, 'Content-Length': raw.length });
|
|
904
907
|
res.end(raw);
|
|
905
908
|
return;
|
|
906
909
|
}
|
|
907
910
|
if (acceptsEncoding(req, 'br')) {
|
|
908
911
|
const compressed = zlib.brotliCompressSync(raw, { params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 4 } });
|
|
909
|
-
res.writeHead(statusCode, {
|
|
912
|
+
res.writeHead(statusCode, { ...baseHeaders, 'Content-Encoding': 'br', 'Content-Length': compressed.length });
|
|
910
913
|
res.end(compressed);
|
|
911
914
|
} else if (acceptsEncoding(req, 'gzip')) {
|
|
912
915
|
const compressed = zlib.gzipSync(raw, { level: 6 });
|
|
913
|
-
res.writeHead(statusCode, {
|
|
916
|
+
res.writeHead(statusCode, { ...baseHeaders, 'Content-Encoding': 'gzip', 'Content-Length': compressed.length });
|
|
914
917
|
res.end(compressed);
|
|
915
918
|
} else {
|
|
916
|
-
res.writeHead(statusCode, {
|
|
919
|
+
res.writeHead(statusCode, { ...baseHeaders, 'Content-Length': raw.length });
|
|
917
920
|
res.end(raw);
|
|
918
921
|
}
|
|
919
922
|
}
|
package/static/index.html
CHANGED
|
@@ -9,14 +9,17 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
<script>
|
|
13
|
+
(function(){
|
|
14
|
+
var b=(window.__BASE_URL||'');
|
|
15
|
+
['vendor/rippleui.css','vendor/prism-dark.css','vendor/highlight-js.css','vendor/xterm.css'].forEach(function(h){
|
|
16
|
+
var l=document.createElement('link');l.rel='stylesheet';l.href=b+'/'+h;document.head.appendChild(l);
|
|
17
|
+
});
|
|
18
|
+
['vendor/highlight.min.js','vendor/xterm.min.js','vendor/xterm-addon-fit.min.js'].forEach(function(s){
|
|
19
|
+
var e=document.createElement('script');e.defer=true;e.src=b+'/'+s;document.head.appendChild(e);
|
|
20
|
+
});
|
|
21
|
+
})();
|
|
22
|
+
</script>
|
|
20
23
|
|
|
21
24
|
<style>
|
|
22
25
|
*, *::before, *::after { box-sizing: border-box; }
|