Summary Files Commits Branches @commit @diff @stats
path: root / Year 3 / Internet of things / goam / webserver / index.html
blob: 3216af2f20865035e03b45fc8124920ab87d34a3 (plain) (blame)
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
<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<link rel="shortcut icon" href="/favicon.ico" />
		<title>GoAm</title>
<style>
* {
	box-sizing: border-box;
}
body {
	font-family: sans-serif;
	background-color: lightgray;
}
h1 {
	border-bottom: 2px solid gray;
}
h1:first-child {
	margin-top: 0;
}
article {
	max-width: calc(640px + 2em);
	margin: 0 auto;
	padding: 1em;
	background-color: black;
	color: white;
}
img {
	max-width: calc(100vw - 16px - 2em);
}
.button, form > * {
	border: 0.25em solid gray;
	padding: 0.25em;
	background-color: lightgray;
	color: black;
}
label {
	display: block;
	border: none;
	font-size: 0.9em;
	margin-bottom: 0.5em;
}
.button:active, input[type="submit"]:active {
	transform: scale(0.90);
}
.button:hover, input[type="submit"]:hover {
	cursor: pointer;
}
a.button {
	display: block;
	text-decoration: none;
	text-align: center;
}
.full-width {
	width: 100%;
}
iframe {
	display: none;
}
.timelapse-form {
	display: inline;
}
</style>
	</head>
	<body>
		<article>
			<h1>Latest image</h1>
			<img src="/spiffs/capture.jpeg"/>
			<a class="button full-width" href="/spiffs/capture.jpeg" download="capture.jpeg">Click to Download</a>

			<br>

			<form action="/config" target="dummyframe" method="POST">
				<input name="remote_photo" type="hidden" value="">
				<input class="full-width" type="submit" value="Take remote photo">
			</form>

			<iframe id="dummyframe" name="dummyframe" hidden></iframe>

			<h1>Static network</h1>
			<p>Upon boot up, the device first tries to connect to the (static) network with stored name/password. If that fails, then it tries connecting to an open network. If that fails too, after 2 seconds connection logic is restarted.</p>
			<form action="/config" target="dummyframe" method="POST">
				<input id="network-ssid" name="ssid" type="text" placeholder="Name (SSID)">
				<input id="network-pass" name="pass" type="text" placeholder="Password">
				<input type="submit" value="Save">
			</form>

			<h1>Timelapse</h1>
			<form action="/config" target="dummyframe" method="POST">
				<input name="timelapse_period" type="number" placeholder="Timelapse period" min="10">
				<input type="submit" value="Save">
			</form>

			<br>

			<form class="timelapse-form" action="/config" target="dummyframe" method="POST">
				<input name="timelapse_change" type="hidden" value="1">
				<input type="submit" value="Start timelapse">
			</form>

			<form class="timelapse-form" action="/config" target="dummyframe" method="POST">
				<input name="timelapse_change" type="hidden" value="0">
				<input type="submit" value="Stop timelapse">
			</form>

			<h1>General</h1>
			<p><i>Beware, these values may not represent what the device is doing! To be certain, always check the display!</i></p>
			<form action="/config" target="dummyframe" method="POST">
				<label for="imagesave">Where to store/send images</label>
				<select name="imagesave">
					<option value="0">Only save to camera</option>
					<option value="&#x01;">Only send to <code>/camera</code> listeners</option>
					<option value="&#x02;" selected>Save and send</option>
				</select>
				<input type="submit" value="Apply">
			</form>
			<br>
			<form action="/config" target="dummyframe" method="POST">
				<label for="resolution">Camera resolution (in pixels)</label>
				<select name="resolution">
					<option value="0" selected>640x480</option>
					<option value="&#x11;">320x240</option>
					<option value="&#x22;">160x120</option>
				</select>
				<input type="submit" value="Apply">
			</form>
			<br>
			<form action="/config" target="dummyframe" method="POST">
				<label for="invertion">Display mode</label>
				<select name="invertion">
					<option value="&#xA6;" selected>Normal</option>
					<option value="&#xA7;">Inverted</option>
				</select>
				<input type="submit" value="Apply">
			</form>
		</article>
		<script>
			const dummyframe     = document.getElementById("dummyframe");
			const network_ssid   = document.getElementById("network-ssid");
			const network_pass   = document.getElementById("network-pass");
			// Thanks https://stackoverflow.com/a/12483061/12036073
			dummyframe.addEventListener("load", function () {
				network_ssid.value = network_pass.value = '';
			});
		</script>
	</body>
</html>