This repository has been archived by the owner on Aug 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
/
index.html
170 lines (154 loc) · 6.15 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="robots" content="noindex">
<title>noVNC</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css">
<!-- easy-novnc (https://github.com/pgaskin/easy-novnc) -->
<style>
body {
background: #f4f4f4;
}
* {
box-sizing: border-box;
}
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.connect {
display: block;
flex: 0 0 auto;
margin: 24px auto;
width: 100%;
max-width: 400px;
overflow-y: auto;
max-height: 90vh;
background: #fff;
border: 1px solid #d3d3d3;
border-radius: 5px;
padding: 24px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.1);
}
@media only screen and (max-width: 520px) {
.connect {
flex: 1;
margin: 0;
height: 100%;
min-height: 100%;
max-height: 100%;
width: 100%;
min-width: 100%;
max-width: 100%;
border: none;
}
}
</style>
</head>
<body>
<div class="wrapper">
<div class="connect">
<h3 class="ui dividing header">noVNC</h3>
<form action="/vnc.html" method="GET" class="ui form">
{{if .arbitraryHosts}}
{{if .arbitraryPorts}}
<div class="two fields">
<div class="field">
<label for="host">Host</label>
<input type="text" id="host" placeholder="{{.host}}" autocomplete="off">
</div>
<div class="field">
<label for="port">Port</label>
<input type="number" id="port" min="1" max="65535" placeholder="{{.port}}" autocomplete="off">
</div>
</div>
{{else}}
<div class="field">
<label for="host">Host</label>
<input type="text" id="host" placeholder="{{.host}}">
</div>
{{end}}
{{end}}
{{if not .noURLPassword}}
<div class="field">
<label for="password">Password</label>
<input type="password" name="password" id="password" placeholder="Password" autofocus>
</div>
{{end}}
<input type="hidden" name="path" id="path" value="vnc">
<input type="hidden" name="autoconnect" id="autoconnect" value="true">
{{range $key, $value := .params}}
<input type="hidden" name="{{$key}}" id="{{$key}}" value="{{$value}}">
{{end}}
<input class="ui button" type="submit" value="Connect">
{{if not .basicUI}}
<h3 class="ui dividing header">Connection Options</h3>
<div class="two fields">
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" name="reconnect" id="reconnect" value="true" checked>
<label for="reconnect">Reconnect automatically</label>
</div>
</div>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" name="show_dot" id="show_dot" value="true" checked>
<label for="show_dot">Show dot when no cursor</label>
</div>
</div>
</div>
<div class="two fields">
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" name="bell" id="bell" value="true">
<label for="bell">Enable bell</label>
</div>
</div>
<div class="inline field">
<div class="ui checkbox">
<input type="checkbox" name="view_only" id="view_only" value="true" {{if .defaultViewOnly}}checked{{end}}>
<label for="view_only">View only</label>
</div>
</div>
</div>
{{else}}
<input type="hidden" name="reconnect" id="reconnect" value="true">
<input type="hidden" name="show_dot" id="show_dot" value="true">
<input type="hidden" name="bell" id="bell" value="false">
<input type="hidden" name="view_only" id="view_only" value="{{if .defaultViewOnly}}true{{else}}false{{end}}">
{{end}}
</form>
</div>
</div>
<script>
var path = document.getElementById("path");
var host = document.getElementById("host");
var port = document.getElementById("port");
function updatePath() {
var addr = "vnc";
if (host && host.value.trim() != "") {
addr = addr + "/" + encodeURIComponent(host.value.trim());
if (port && port.value.toString().trim() != "") {
addr = addr + "/" + port.value.toString().trim();
}
}
path.value = addr;
}
if (host) {
host.addEventListener("input", updatePath);
host.addEventListener("keyup", updatePath);
host.addEventListener("blur", updatePath);
}
if (port) {
port.addEventListener("input", updatePath);
port.addEventListener("keyup", updatePath);
port.addEventListener("blur", updatePath);
}
</script>
</body>
</html>