forked from Informatic/webos-ssap-web
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
200 lines (178 loc) · 7.44 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!--
Copyright 2022-2023 throwaway96 (https://github.com/throwaway96)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<!-- Copyright 2021 Piotr Dobrowolski <informatic at hackerspace dot pl> -->
<html>
<head>
<style>
#log {
overflow: auto;
height: 50px;
}
.capture {
height: 80vh;
display: inline-block;
width: calc(80vh * 16 / 9);
position: relative;
border: 1px dashed black;
margin-bottom: 5pt;
}
.capture img {
height: 100%;
}
.capture .back,
.capture .front {
position: absolute;
top: 0;
left: 0;
max-height: 100%;
}
#remote {
display: inline-block;
vertical-align: top;
margin-left: 0.5em;
}
.front {
z-index: 99999;
}
table#keypad {
display: inline-table;
border: 1px solid black;
text-align: center;
vertical-align: top;
}
button.keypad {
font-family: 'Helvetica Neue', sans-serif;
font-weight: bold;
font-stretch: narrower;
}
div#request {
display: inline-block;
border: 1px solid black;
padding: 2pt;
}
div#request > p {
font-weight: bold;
}
</style>
</head>
<body>
<div class="topbar">
<input type="text" id="ip" placeholder="127.0.0.1" value="" />
<label for="ssl">SSL:</label><input type="checkbox" id="ssl" title="SSL" />
<button id="connect">connect</button><button id="disconnect" disabled>disconnect</button>
<label for="pause_preview">pause preview:</label><input type="checkbox" id="pause_preview" title="pause preview" />
</div>
<pre id="log" class="logbar"></pre>
<div class="capture"></div><div id="remote"></div><br>
<table id="keypad">
<tr>
<td></td>
<td><button class="keypad" data-key="UP">▲</button></td>
<td></td>
</tr>
<tr>
<td><button class="keypad" data-key="LEFT">◀</button></td>
<td><button class="keypad" data-key="ENTER">OK</button></td>
<td><button class="keypad" data-key="RIGHT">▶</button></td>
</tr>
<tr>
<td><button class="keypad" data-key="BACK">BACK</button></td>
<td><button class="keypad" data-key="DOWN">▼</button></td>
<td><button class="keypad" data-key="EXIT">EXIT</button></td>
</tr>
<tr>
<td><button class="keypad" data-key="HOME">HOME</button></td>
<td><button class="keypad" data-key="MENU">MENU</button></td>
<td><button class="keypad" data-key="MYAPPS">APPS</button></td>
</tr>
<tr>
<td><button class="keypad" data-key="IN_START">IN START</button></td>
<td><button class="keypad" data-key="EZ_ADJUST">ADJ</button></td>
<td></td>
</tr>
<tr>
<td><button class="keypad" data-key="VOLUMEUP">VOL+</button></td>
<td><button class="keypad" data-key="MUTE">MUTE</button></td>
<td><button class="keypad" data-key="CHANNELUP">CH+</button></td>
</tr>
<tr>
<td><button class="keypad" data-key="VOLUMEDOWN">VOL-</button></td>
<td><button class="keypad" disabled>IN STOP</button></td><!-- "IN_STOP" -->
<td><button class="keypad" data-key="CHANNELDOWN">CH-</button></td>
</tr>
</table>
<div id="request">
<div id="custom_request">
<p>request</p>
<select id="reqs">
<option value="launch_instart_factorywin"
data-endpoint="ssap://com.webos.applicationManager/launch"
data-payload="{"id":"com.webos.app.factorywin","params":{"id":"executeFactory","irKey":"inStart"}}">
open inStart (webOS 3.0+)</option>
<option value="launch_ezadjust_factorywin"
data-endpoint="ssap://com.webos.applicationManager/launch"
data-payload="{"id":"com.webos.app.factorywin","params":{"id":"executeFactory","irKey":"ezAdjust"}}">
open ezAdjust (webOS 3.0+)</option>
<option value="launch_instart_livetv"
data-endpoint="ssap://com.webos.applicationManager/launch"
data-payload="{"id":"com.webos.app.livetv","params":{"id":"executeFactory","irKey":"inStart"}}">
open inStart (webOS 1.x/2.x)</option>
<option value="launch_ezadjust_livetv"
data-endpoint="ssap://com.webos.applicationManager/launch"
data-payload="{"id":"com.webos.app.livetv","params":{"id":"executeFactory","irKey":"ezAdjust"}}">
open ezAdjust (webOS 1.x/2.x)</option>
<option value="launch_softwareupdate_expert"
data-endpoint="ssap://com.webos.applicationManager/launch"
data-payload="{"id":"com.webos.app.softwareupdate","params":{"mode":"expert","flagUpdate":true}}">
launch softwareupdate (expert mode)</option>
<option value="get_version_info"
data-endpoint="ssap://com.webos.service.update/getCurrentSWInformation"
data-payload="{}">
get version info</option>
<option value="private_reboot"
data-private
data-endpoint="luna://com.webos.service.sleep/shutdown/machineReboot"
data-payload="{"reason":"remoteKey"}">
reboot via createAlert</option>
<option value="custom">custom</option>
</select><br>
<label for="req_private">private bus via <tt>/createAlert</tt>:</label><input type="checkbox" id="req_private" disabled><br>
<label for="req_uri">URI:</label> <input type="text" id="req_uri" size="100" placeholder="luna://..." disabled><br>
<label for="req_payload">payload:</label><br>
<textarea id="req_payload" rows="5" cols="100" placeholder="{}" disabled>{}</textarea><br>
<button id="req_send" disabled>send</button><br>
<p>response</p>
<label for="resp_status">status:</label> <input type="text" id="resp_status" size="50" readonly><br>
<label for="resp_payload">payload:</label><br>
<textarea id="resp_payload" rows="5" cols="100" readonly></textarea>
</div>
<script>
window.onerror = function (err) {
alert('error: ' + JSON.stringify(err) + '\n' + err.fileName + ' ' + err.lineNumber);
};
function onScriptLoadError(scriptName) {
console.error(`Error loading script ${scriptName}`);
alert(
`Failed to load script: ${scriptName}\n\n` +
'Make sure it is present in the same directory as this HTML file.\n' +
'Do not try to run this from an archive without extracting it.'
);
}
</script>
<script src="wsproxy.js" onerror="onScriptLoadError('wsproxy.js')"></script>
<script src="client.js" onerror="onScriptLoadError('client.js')"></script>
<script src="remote.js" onerror="onScriptLoadError('remote.js')"></script>
<script src="demo.js" onerror="onScriptLoadError('demo.js')"></script>
</body>
</html>