logging
This commit is contained in:
parent
bc7fb72800
commit
e3fb938117
1 changed files with 12 additions and 2 deletions
|
@ -35,6 +35,8 @@ if (!window.TE_ACTIVE) {
|
||||||
const windowLocation = window.location.href;
|
const windowLocation = window.location.href;
|
||||||
window.multiprobe_debug = false;
|
window.multiprobe_debug = false;
|
||||||
|
|
||||||
|
console.log("[MP] MultiProbe init");
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -61,6 +63,7 @@ window.multiprobe_debug = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
let cursorImageI = window.getComputedStyle(document.body).cursor;
|
let cursorImageI = window.getComputedStyle(document.body).cursor;
|
||||||
|
console.log("[MP] Injecting custom styles...");
|
||||||
const styles = document.createElement("style");
|
const styles = document.createElement("style");
|
||||||
styles.innerHTML = `
|
styles.innerHTML = `
|
||||||
html {
|
html {
|
||||||
|
@ -288,15 +291,18 @@ kbd {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
let needsToUpdate = false;
|
let needsToUpdate = false;
|
||||||
|
console.log("[MP] Checking for new versions...");
|
||||||
const versionFetchAddress = windowLocation.replace("127.0.0.1", "localhost").includes("//localhost:") ? "http://localhost:38194/api/version" : "https://multiprobe.eusv.net/api/version";
|
const versionFetchAddress = windowLocation.replace("127.0.0.1", "localhost").includes("//localhost:") ? "http://localhost:38194/api/version" : "https://multiprobe.eusv.net/api/version";
|
||||||
fetch(versionFetchAddress, { method: "post" }).then(response => {
|
fetch(versionFetchAddress, { method: "post" }).then(response => {
|
||||||
console.log("hi");
|
|
||||||
response.text().then(versionNumberRaw => {
|
response.text().then(versionNumberRaw => {
|
||||||
const versionNumber = parseInt(versionNumberRaw);
|
const versionNumber = parseInt(versionNumberRaw);
|
||||||
if (versionNumber > USERSCRIPT_VERSION) {
|
if (versionNumber > USERSCRIPT_VERSION) {
|
||||||
// We're out of date >:(
|
// We're out of date >:(
|
||||||
needsToUpdate = true;
|
needsToUpdate = true;
|
||||||
createUpdateDialog(`${versionNumberRaw.slice(0, versionNumberRaw.length - 1)}.${versionNumberRaw.slice(-1)}`);
|
createUpdateDialog(`${versionNumberRaw.slice(0, versionNumberRaw.length - 1)}.${versionNumberRaw.slice(-1)}`);
|
||||||
|
console.log("[MP] We're out of date :(");
|
||||||
|
} else {
|
||||||
|
console.log("[MP] We're up to date!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -439,7 +445,6 @@ kbd {
|
||||||
groupPopper.click();
|
groupPopper.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(e.key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onkeydown = (e) => {
|
window.onkeydown = (e) => {
|
||||||
|
@ -491,9 +496,11 @@ kbd {
|
||||||
function doConnect(apiKey) {
|
function doConnect(apiKey) {
|
||||||
const Buffer = getBufferClass();
|
const Buffer = getBufferClass();
|
||||||
|
|
||||||
|
console.log("[MP] Connecting to realtime server...");
|
||||||
ws = new WebSocket(windowLocation.includes("//localhost:") ? "ws://localhost:38195" : "wss://ws.eusv.net/t00mp");
|
ws = new WebSocket(windowLocation.includes("//localhost:") ? "ws://localhost:38195" : "wss://ws.eusv.net/t00mp");
|
||||||
let keepAliveInterval;
|
let keepAliveInterval;
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
|
console.log("[MP] Connected! Authenticating...");
|
||||||
otherCursors.innerHTML = "";
|
otherCursors.innerHTML = "";
|
||||||
selfCursor = new RemoteClient(localStorage["t00mp_username"]);
|
selfCursor = new RemoteClient(localStorage["t00mp_username"]);
|
||||||
selfCursor.probeImage.style.visibility = "hidden";
|
selfCursor.probeImage.style.visibility = "hidden";
|
||||||
|
@ -534,6 +541,7 @@ kbd {
|
||||||
if (!needsToUpdate) {
|
if (!needsToUpdate) {
|
||||||
createFirstTimeDialog();
|
createFirstTimeDialog();
|
||||||
}
|
}
|
||||||
|
console.log("[MP] Authenticated!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MessageType.ClientJoined:
|
case MessageType.ClientJoined:
|
||||||
|
@ -865,4 +873,6 @@ kbd {
|
||||||
if (localStorage["mpapikey"] && localStorage["mpapikey"] !== "" && localStorage["mpconnectonload"] === "true") {
|
if (localStorage["mpapikey"] && localStorage["mpapikey"] !== "" && localStorage["mpconnectonload"] === "true") {
|
||||||
doConnect(localStorage["mpapikey"]);
|
doConnect(localStorage["mpapikey"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("[MP] Init complete.");
|
||||||
})();
|
})();
|
Loading…
Reference in a new issue