-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
116 lines (105 loc) · 4.25 KB
/
index.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
<!DOCTYPE html>
<!--
website creation: luphoria -- https://luphoria.com
initial report: anonymous TitaniumNetwork (https://titaniumnetwork.org) user
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>goospeed</title>
</head>
<body>
<h1>goospeed interface</h1>
<i>This tool should not be used for illegal activity.</i>
<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>
<script src="https://cdn.ably.com/lib/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>