trying a fix

This commit is contained in:
sanjayk03-dev
2024-03-29 02:57:49 +05:30
parent 1904919c80
commit 074533b17b

View File

@@ -1,8 +1,15 @@
"use strict"; "use strict";
const entityMap = { const entityMap = {
"&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "&": "&amp;",
"/": "&#x2F;", "`": "&#x60;", "=": "&#x3D;" }; "<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
"/": "&#x2F;",
"`": "&#x60;",
"=": "&#x3D;",
};
function escapeHTML(s) { function escapeHTML(s) {
return s.replace(/[&<>"'`=\\/]/g, function (c) { return s.replace(/[&<>"'`=\\/]/g, function (c) {
@@ -17,7 +24,7 @@ module.exports = {
return { return {
empty: true, empty: true,
file: "", file: "",
line: -1 line: -1,
}; };
}, },
@@ -33,7 +40,7 @@ module.exports = {
}, },
"gcode-line": function (line) { "gcode-line": function (line) {
this.update_line(line); this.update_line(line);
} },
}, },
ready: function () { ready: function () {
@@ -42,7 +49,7 @@ module.exports = {
scrollElem: this.$el.querySelector(".clusterize-scroll"), scrollElem: this.$el.querySelector(".clusterize-scroll"),
contentElem: this.$el.querySelector(".clusterize-content"), contentElem: this.$el.querySelector(".clusterize-content"),
no_data_text: "GCode view...", no_data_text: "GCode view...",
callbacks: { clusterChanged: this.highlight } callbacks: { clusterChanged: this.highlight },
}); });
}, },
@@ -65,6 +72,9 @@ module.exports = {
} }
const response = await fetch(`/api/file/${file}`, { cache: "no-cache" }); const response = await fetch(`/api/file/${file}`, { cache: "no-cache" });
if (response.status == 400) {
return;
}
const text = await response.text(); const text = await response.text();
if (text.length > 20e6) { if (text.length > 20e6) {
@@ -147,6 +157,6 @@ module.exports = {
scroll.scrollTop = target * lineHeight; scroll.scrollTop = target * lineHeight;
Vue.nextTick(this.highlight); Vue.nextTick(this.highlight);
} },
} },
}; };