vibora 8.4.2 → 8.5.0
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/bin/vibora.js +1 -1
- package/dist/assets/{index-C8U3p5I5.js → index-dkrerV7J.js} +83 -83
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/server/index.js +60 -7
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/png" href="/logo.png" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vibora - Harness Attention. Ship.</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-dkrerV7J.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-CfTPmrF1.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -44880,10 +44880,17 @@ class BufferManager {
|
|
|
44880
44880
|
chunks = [];
|
|
44881
44881
|
totalBytes = 0;
|
|
44882
44882
|
terminalId = null;
|
|
44883
|
+
mouseMode = {
|
|
44884
|
+
x10: false,
|
|
44885
|
+
buttonEvent: false,
|
|
44886
|
+
anyEvent: false,
|
|
44887
|
+
sgr: false
|
|
44888
|
+
};
|
|
44883
44889
|
setTerminalId(id) {
|
|
44884
44890
|
this.terminalId = id;
|
|
44885
44891
|
}
|
|
44886
44892
|
append(data) {
|
|
44893
|
+
this.trackMouseModes(data);
|
|
44887
44894
|
this.chunks.push({ data, timestamp: Date.now() });
|
|
44888
44895
|
this.totalBytes += data.length;
|
|
44889
44896
|
while (this.totalBytes > MAX_BUFFER_BYTES && this.chunks.length > 1) {
|
|
@@ -44891,17 +44898,51 @@ class BufferManager {
|
|
|
44891
44898
|
this.totalBytes -= removed.data.length;
|
|
44892
44899
|
}
|
|
44893
44900
|
}
|
|
44894
|
-
|
|
44901
|
+
trackMouseModes(data) {
|
|
44902
|
+
const ESC = "\x1B";
|
|
44903
|
+
if (new RegExp(`${ESC}\\[\\?1000h`).test(data))
|
|
44904
|
+
this.mouseMode.x10 = true;
|
|
44905
|
+
if (new RegExp(`${ESC}\\[\\?1000l`).test(data))
|
|
44906
|
+
this.mouseMode.x10 = false;
|
|
44907
|
+
if (new RegExp(`${ESC}\\[\\?1002h`).test(data))
|
|
44908
|
+
this.mouseMode.buttonEvent = true;
|
|
44909
|
+
if (new RegExp(`${ESC}\\[\\?1002l`).test(data))
|
|
44910
|
+
this.mouseMode.buttonEvent = false;
|
|
44911
|
+
if (new RegExp(`${ESC}\\[\\?1003h`).test(data))
|
|
44912
|
+
this.mouseMode.anyEvent = true;
|
|
44913
|
+
if (new RegExp(`${ESC}\\[\\?1003l`).test(data))
|
|
44914
|
+
this.mouseMode.anyEvent = false;
|
|
44915
|
+
if (new RegExp(`${ESC}\\[\\?1006h`).test(data))
|
|
44916
|
+
this.mouseMode.sgr = true;
|
|
44917
|
+
if (new RegExp(`${ESC}\\[\\?1006l`).test(data))
|
|
44918
|
+
this.mouseMode.sgr = false;
|
|
44919
|
+
}
|
|
44920
|
+
getMouseModeSequences() {
|
|
44895
44921
|
const ESC = "\x1B";
|
|
44896
|
-
|
|
44922
|
+
let sequences = "";
|
|
44923
|
+
if (this.mouseMode.x10)
|
|
44924
|
+
sequences += `${ESC}[?1000h`;
|
|
44925
|
+
if (this.mouseMode.buttonEvent)
|
|
44926
|
+
sequences += `${ESC}[?1002h`;
|
|
44927
|
+
if (this.mouseMode.anyEvent)
|
|
44928
|
+
sequences += `${ESC}[?1003h`;
|
|
44929
|
+
if (this.mouseMode.sgr)
|
|
44930
|
+
sequences += `${ESC}[?1006h`;
|
|
44931
|
+
return sequences;
|
|
44932
|
+
}
|
|
44933
|
+
filterProblematicSequences(data) {
|
|
44934
|
+
const ESC = "\x1B";
|
|
44935
|
+
return data.replace(new RegExp(`${ESC}\\[\\?1049[hl]`, "g"), "").replace(new RegExp(`${ESC}\\[\\?47[hl]`, "g"), "").replace(new RegExp(`${ESC}\\[\\?1047[hl]`, "g"), "").replace(/\d+;\d+\$y/g, "").replace(new RegExp(`${ESC}\\[\\d+;\\d+R`, "g"), "").replace(new RegExp(`${ESC}\\[[\\?>\\d;]*c`, "g"), "").replace(/(?<![a-zA-Z])R+(?![a-zA-Z])/g, "");
|
|
44897
44936
|
}
|
|
44898
44937
|
getContents() {
|
|
44899
44938
|
const raw2 = this.chunks.map((c) => c.data).join("");
|
|
44900
|
-
|
|
44939
|
+
const filtered = this.filterProblematicSequences(raw2);
|
|
44940
|
+
return this.getMouseModeSequences() + filtered;
|
|
44901
44941
|
}
|
|
44902
44942
|
clear() {
|
|
44903
44943
|
this.chunks = [];
|
|
44904
44944
|
this.totalBytes = 0;
|
|
44945
|
+
this.mouseMode = { x10: false, buttonEvent: false, anyEvent: false, sgr: false };
|
|
44905
44946
|
}
|
|
44906
44947
|
getLineCount() {
|
|
44907
44948
|
const content = this.getContents();
|
|
@@ -44913,10 +44954,12 @@ class BufferManager {
|
|
|
44913
44954
|
return;
|
|
44914
44955
|
const filePath = path4.join(getBuffersDir(), `${this.terminalId}.buf`);
|
|
44915
44956
|
try {
|
|
44916
|
-
const
|
|
44957
|
+
const raw2 = this.chunks.map((c) => c.data).join("");
|
|
44958
|
+
const content = this.filterProblematicSequences(raw2);
|
|
44917
44959
|
const fileData = {
|
|
44918
|
-
version:
|
|
44919
|
-
content: Buffer.from(content).toString("base64")
|
|
44960
|
+
version: 3,
|
|
44961
|
+
content: Buffer.from(content).toString("base64"),
|
|
44962
|
+
mouseMode: { ...this.mouseMode }
|
|
44920
44963
|
};
|
|
44921
44964
|
writeFileSync2(filePath, JSON.stringify(fileData), "utf-8");
|
|
44922
44965
|
} catch (err) {
|
|
@@ -44933,7 +44976,17 @@ class BufferManager {
|
|
|
44933
44976
|
let content;
|
|
44934
44977
|
try {
|
|
44935
44978
|
const parsed = JSON.parse(raw2);
|
|
44936
|
-
if (parsed.version ===
|
|
44979
|
+
if (parsed.version === 3 && typeof parsed.content === "string") {
|
|
44980
|
+
content = Buffer.from(parsed.content, "base64").toString();
|
|
44981
|
+
if (parsed.mouseMode) {
|
|
44982
|
+
this.mouseMode = {
|
|
44983
|
+
x10: !!parsed.mouseMode.x10,
|
|
44984
|
+
buttonEvent: !!parsed.mouseMode.buttonEvent,
|
|
44985
|
+
anyEvent: !!parsed.mouseMode.anyEvent,
|
|
44986
|
+
sgr: !!parsed.mouseMode.sgr
|
|
44987
|
+
};
|
|
44988
|
+
}
|
|
44989
|
+
} else if (parsed.version === 2 && typeof parsed.content === "string") {
|
|
44937
44990
|
content = Buffer.from(parsed.content, "base64").toString();
|
|
44938
44991
|
} else {
|
|
44939
44992
|
content = raw2;
|