Skip to content

Commit 359b8c3

Browse files
Bug fix
1 parent 3032eaa commit 359b8c3

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

client/pages/remoteControl/script.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,7 @@ window.addEventListener("message", ({ data: { roomId, password } = {} }) => {
6060
socket.emit("keyTap", key);
6161
});
6262

63-
if (![
64-
...[
65-
[
66-
os.hostname(),
67-
JSON.parse(localStorage.getItem("loginDetails"))[0],
68-
JSON.parse(localStorage.getItem("loginDetails"))[1]
69-
]
70-
],
71-
...JSON.parse(localStorage.getItem("history")) || []
72-
].find((device) => JSON.stringify(device) === JSON.stringify([
63+
if (!(JSON.parse(localStorage.getItem("history")) || []).find((device) => JSON.stringify(device) === JSON.stringify([
7364
deviceName,
7465
roomId,
7566
password

client/pages/scripts/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ document.styleSheets[1].media.appendMedium("(prefers-color-scheme: " + (((JSON.p
114114
JSON.parse(localStorage.getItem("loginDetails"))[1]
115115
]
116116
],
117-
...JSON.parse(localStorage.getItem("history")) || []
117+
...(JSON.parse(localStorage.getItem("history")) || []).filter(([_, deviceId]) => deviceId !== JSON.parse(localStorage.getItem("loginDetails"))[0])
118118
].forEach(([deviceName, deviceId, devicePassword]) => {
119119
let scriptContainerExecuteSelectDeviceOption = document.createElement("option");
120120
scriptContainerExecuteSelectDeviceOption.value = JSON.stringify([
@@ -293,7 +293,7 @@ document.getElementById("createScriptButton").addEventListener("click", () => {
293293
JSON.parse(localStorage.getItem("loginDetails"))[1]
294294
]
295295
],
296-
...JSON.parse(localStorage.getItem("history")) || []
296+
...(JSON.parse(localStorage.getItem("history")) || []).filter((_, deviceId) => deviceId !== JSON.parse(localStorage.getItem("loginDetails"))[0])
297297
].forEach(([deviceName, deviceId, devicePassword]) => {
298298
let scriptContainerExecuteSelectDeviceOption = document.createElement("option");
299299
scriptContainerExecuteSelectDeviceOption.value = JSON.stringify([

0 commit comments

Comments
 (0)