Skip to content

Commit 9cbb0d9

Browse files
Safari and FIrefox and now compatible!
1 parent 3b420a2 commit 9cbb0d9

File tree

5 files changed

+51
-37
lines changed

5 files changed

+51
-37
lines changed

data/css/app.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ body{
2929
-webkit-user-select: none; /* Safari */
3030
-ms-user-select: none; /* IE 10 and IE 11 */
3131
user-select: none; /* Standard syntax */
32+
height: 100%;
3233
}
3334

3435
.horizontal_separator{
@@ -53,6 +54,7 @@ body{
5354
transition: opacity 0.15s ease-in-out;
5455
background-color: rgba(var(--background), 0.75);
5556
backdrop-filter: blur(12px);
57+
-webkit-backdrop-filter: blur(12px);
5658
z-index: 999 !important;
5759
}
5860

@@ -70,6 +72,7 @@ body{
7072
transition: opacity 0.15s ease-in-out;
7173
background-color: rgba(var(--background), 0.0);
7274
backdrop-filter: blur(12px);
75+
-webkit-backdrop-filter: blur(12px);
7376
z-index: 50 !important;
7477
}
7578

@@ -88,6 +91,7 @@ body{
8891
left: 0%;
8992
background-color: rgba(var(--background), 0.45);
9093
backdrop-filter: blur(12px);
94+
-webkit-backdrop-filter: blur(12px);
9195
}
9296

9397
#page_menu{
@@ -103,6 +107,7 @@ body{
103107
left: 0%;
104108
background-color: rgba(var(--background), 0.45);
105109
backdrop-filter: blur(12px);
110+
-webkit-backdrop-filter: blur(12px);
106111
z-index: 15;
107112
}
108113

@@ -175,6 +180,7 @@ body{
175180
left: 0%;
176181
background-color: rgba(var(--background), 0.45);
177182
backdrop-filter: blur(12px);
183+
-webkit-backdrop-filter: blur(12px);
178184
}
179185

180186
#page_wifi_config{
@@ -189,6 +195,7 @@ body{
189195
left: 0%;
190196
background-color: rgba(var(--background), 0.45);
191197
backdrop-filter: blur(12px);
198+
-webkit-backdrop-filter: blur(12px);
192199
}
193200

194201
#page_presets{
@@ -206,6 +213,7 @@ body{
206213
left: 0%;
207214
background-color: rgba(var(--background), 0.45);
208215
backdrop-filter: blur(12px);
216+
-webkit-backdrop-filter: blur(12px);
209217
}
210218

211219
#page_modes{
@@ -223,6 +231,7 @@ body{
223231
left: 0%;
224232
background-color: rgba(var(--background), 0.45);
225233
backdrop-filter: blur(12px);
234+
-webkit-backdrop-filter: blur(12px);
226235
z-index: 99;
227236
}
228237

@@ -384,6 +393,7 @@ button{
384393
border:2px solid var(--accent);
385394
z-index:50;
386395
backdrop-filter: blur(10px);
396+
-webkit-backdrop-filter: blur(12px);
387397
text-align: center;
388398
pointer-events: none;
389399
opacity:0.0;
@@ -414,6 +424,7 @@ button{
414424
border:2px solid var(--accent);
415425
z-index:50;
416426
backdrop-filter: blur(10px);
427+
-webkit-backdrop-filter: blur(12px);
417428
text-align: center;
418429
pointer-events: none;
419430
opacity:0.0;

data/index.html

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
<html>
1+
<!DOCTYPE html>
2+
<html lang="en">
23
<head>
4+
<meta charset="UTF-8" />
5+
36
<title>Emotiscope Setup</title>
7+
48
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
59
<link rel="stylesheet" href="css/app.css">
610
<script src="js/fetch_mac.js"></script>
@@ -32,15 +36,29 @@
3236
function update_wifi_credentials(){
3337
let ssid = document.getElementById("ssid").value;
3438
let pass = document.getElementById("pass").value;
35-
36-
// URL encode the ssid and pass
37-
ssid = encodeURIComponent(ssid);
38-
pass = encodeURIComponent(pass);
39-
40-
let wifi_endpoint = "/save-wifi?ssid="+ssid+"&pass="+pass;
41-
fetch(wifi_endpoint);
42-
43-
window.location.href = "https://app.emotiscope.rocks/";
39+
40+
let wifi_endpoint = "/save-wifi";
41+
let data = {
42+
ssid: ssid,
43+
pass: pass
44+
};
45+
46+
fetch(wifi_endpoint, {
47+
method: 'POST',
48+
headers: {
49+
'Content-Type': 'application/json; charset=UTF-8'
50+
},
51+
body: JSON.stringify(data)
52+
})
53+
.then(response => {
54+
if (!response.ok) {
55+
throw new Error('Network response was not ok');
56+
}
57+
window.location.href = "https://app.emotiscope.rocks/";
58+
})
59+
.catch(error => {
60+
console.error('There was been a problem with update_wifi_credentials:', error);
61+
});
4462
}
4563
</script>
4664
</body>

data/js/fetch_mac.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Get the base URL of the current page
2-
const base_url = window.location.origin;
3-
let mac_str = "";
2+
var base_url = window.location.origin;
3+
var mac_str = "";
44

55
function get_mac_string(){
66
// Fetch the text result from the /mac endpoint

data/remote.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html>
22
<head>
33
<title>Emotiscope by Lixie Labs</title>
4+
<meta charset="UTF-8">
45

56
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
67
<link rel="stylesheet" href="css/app.css">

src/wireless.h

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -233,43 +233,27 @@ void init_web_server() {
233233
return response.send();
234234
});
235235

236-
server.on("/save-wifi", HTTP_GET, [](PsychicRequest *request) {
237-
if(wifi_config_mode == true){
238-
esp_err_t result = ESP_OK;
239-
String ssid = "";
240-
String pass = "";
236+
server.on("/mac", HTTP_GET, [](PsychicRequest *request) {
237+
return request->reply(mac_str);
238+
});
241239

242-
if(request->hasParam("ssid") == true){
243-
ssid += request->getParam("ssid")->value();
244-
}
245-
else{
246-
printf("MISSING SSID PARAM!\n");
247-
return request->reply(400);
248-
}
249-
250-
if(request->hasParam("pass") == true){
251-
pass += request->getParam("pass")->value();
252-
}
253-
else{
254-
printf("MISSING PASS PARAM!\n");
255-
return request->reply(400);
256-
}
240+
server.on("/save-wifi", HTTP_POST, [](PsychicRequest *request) {
241+
if(wifi_config_mode == true){
242+
String ssid = request->getParam("ssid")->value();
243+
String pass = request->getParam("pass")->value();
257244

258245
printf("GOT NEW WIFI CONFIG: '%s|%s'\n", ssid.c_str(), pass.c_str());
246+
259247
update_network_credentials(ssid, pass);
260248

261-
return result;
249+
return request->reply(200);
262250
}
263251
else{
264252
printf("Can't access WIFI config endpoint outside of config AP mode for security reasons!\n");
265253
return request->reply(400);
266254
}
267255
});
268256

269-
server.on("/mac", HTTP_GET, [](PsychicRequest *request) {
270-
return request->reply(mac_str);
271-
});
272-
273257
server.on("/*", HTTP_GET, [](PsychicRequest *request) {
274258
esp_err_t result = ESP_OK;
275259
String path = "";

0 commit comments

Comments
 (0)