-
Notifications
You must be signed in to change notification settings - Fork 1
/
lsif.html
152 lines (136 loc) · 4.84 KB
/
lsif.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
<style>
* {
background-color: black;
color: rgb(196, 196, 196);
}
body {
background-color: black;
font-family: monospace;
font-size: 15px;
margin: 35px;
margin-top:5px;
}
a {
color: cyan
}
input,button {
background-color: #131313;
border:#0a0a0a ;
border-width: 3px;
border-radius: 3px;
border-style:solid;
margin: 1.4px;
cursor: pointer;
}
.list {
line-height: 2
}
.border {
border: 2px solid white;
padding: 10px
}
</style>
<link href="./prism.css" rel="stylesheet" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<h1>Lightspeed Interface</h1>
<i>This tool should not be used for illegal activity.</i>
<p>With this tool, you can interface with devices on a Lightspeed network, given you have the credentials.</p>
<p><b>To get credentials:</b> find the extension ID for your "Classroom" extension, and then visit the website <code>chrome-extension://<b>[YOUR CLASSROOM EXTENSION ID]</b>/index.js</code>. The webpage is just a bunch of code, but here's what you need to do:</p>
<p>- Find (Ctrl+F): <b><code>key:"</code></b>. Between the two double quotes (<code>"</code> and the next <code>"</code>), there is a string of random characters. It should start with <b><code>1k1Wbw.</code></b> or something similar. Copy this and paste it to the "Key" section of this tool.
<br/>- Find (Ctrl+F): <b><code>customerId:"</code></b>. You should find, between two double quotes, an ID formatted like this: <b><code>XX-XXXX-XXXX</code></b>. Copy this and paste it in the "Customer ID" input on this tool.</p>
<p>Then, click "Set" on this tool. From here, you're ready to go! Enter the email of the device you want to interact with, and simply use the tools here to open links, lock/unlock the device, or send messages to it.</p>
<br />
<input
id="authKey"
placeholder="1k1Wbw.xxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..."
value=""
/>
Key
<br />
<input id="customerId" placeholder="00-0000-0000" value="" /> Customer ID
<br />
<button onclick="start(document.getElementById('authKey').value, document.getElementById('customerId').value)">
Set
</button>
<div id="saved" style="color: green; display: none">Saved.</div>
<div id="error" style="color: red; display: none">Error.</div>
<br /><br />
<input id="studentId" placeholder="[email protected]" value="" /> Device email
<br /><br />
<input id="urlInput" placeholder="https://google.com" /><button
onclick="openUrl(document.getElementById('urlInput').value)"
>
Open
</button>
<br />
Device state
<button onclick="lock()">Lock</button
><button onclick="unlock()">Unlock</button>
<br />
<input id="msg" placeholder="message" /><button
onclick="sendMessage(document.getElementById('msg').value)"
>
Message
</button>
<br /><br /><br /><br /><br /><br />
<script src="./assets/ably.min-1.js"></script>
<!--TODO run locally-->
<script>
let client;
const start = (key, customerId) => {
let options = {
key: key,
timestamp: Date.now(),
echoMessages: false,
environment: "lightspeed",
fallbackHosts: [
"a-fallback-lightspeed.ably.io",
"b-fallback-lightspeed.ably.io",
"c-fallback-lightspeed.ably.io",
],
};
try {
client = new Ably.Realtime(options);
localStorage.lsKey = key;
localStorage.customerId = customerId;
document.getElementById("saved").style.display = "inline";
document.getElementById("error").style.display = "none";
} catch {
document.getElementById("saved").style.display = "none";
document.getElementById("error").style.display = "inline";
}
};
if (localStorage.lsKey && localStorage.customerId) { // Previously set values
document.getElementById("authKey").value = localStorage.lsKey;
document.getElementById("customerId").value = localStorage.customerId;
start(localStorage.lsKey, localStorage.customerId);
}
const publish = (type, content) => {
client.channels
.get(`${customerId.value}:${studentId.value}`)
.publish(type, content);
};
</script>
<script>
function openUrl(url) {
publish("url", url);
}
function lock() {
publish("lock", "");
}
function unlock() {
publish("unlock", "");
}
function sendMessage(msg) {
publish("tm", { m: msg });
}
</script>
</body>
</html>