Browse Source

added paracity gallery with advanced captive portal stuff

master
dennisdebel 4 years ago
parent
commit
ca6d651bc7
  1. BIN
      works/Danja Vasiliev/otastaImg/data/.DS_Store
  2. 2
      works/Danja Vasiliev/otastaImg/data/index.html
  3. BIN
      works/Dennis de Bel & Anton Jehle/.DS_Store
  4. 1
      works/Dennis de Bel & Anton Jehle/esp-files/DNSServer.h
  5. BIN
      works/Dennis de Bel & Anton Jehle/esp-files/data/.DS_Store
  6. 24
      works/Dennis de Bel & Anton Jehle/esp-files/data/connect.html
  7. 40
      works/Dennis de Bel & Anton Jehle/esp-files/data/dl-android.html
  8. 49
      works/Dennis de Bel & Anton Jehle/esp-files/data/dl.html
  9. 51
      works/Dennis de Bel & Anton Jehle/esp-files/data/index.html
  10. 131
      works/Dennis de Bel & Anton Jehle/esp-files/data/index_download_applink.html
  11. 131
      works/Dennis de Bel & Anton Jehle/esp-files/data/index_download_old.html
  12. BIN
      works/Dennis de Bel & Anton Jehle/esp-files/data/paracity_gallery_v041.zip
  13. BIN
      works/Dennis de Bel & Anton Jehle/esp-files/data/pic.jpg
  14. 80
      works/Dennis de Bel & Anton Jehle/esp-files/esp-files.ino

BIN
works/Danja Vasiliev/otastaImg/data/.DS_Store

Binary file not shown.

2
works/Danja Vasiliev/otastaImg/data/index.html

@ -189,7 +189,7 @@
<div id='nosensors' class='message'>
<p>Your browser could not connect to phone's sensors.</p>
<p>Please use Android + Firefox browser!</p>
<p>Please use Android + Firefox browser! Or try rubbing with two fingers!</p>
<div><button id='nosensors' class='message'>OKAY</button></div>
</div>

BIN
works/Dennis de Bel & Anton Jehle/.DS_Store

Binary file not shown.

1
works/Dennis de Bel & Anton Jehle/esp-files/DNSServer.h

@ -69,4 +69,3 @@ class DNSServer
void replyWithCustomCode();
};
#endif

BIN
works/Dennis de Bel & Anton Jehle/esp-files/data/.DS_Store

Binary file not shown.

24
works/Dennis de Bel & Anton Jehle/esp-files/data/connect.html

@ -0,0 +1,24 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body onload="timerEnableEndpoint()">
<a href="/CONNECT">CONNECT (Close Captive Portal)</a> <!-- enable hotspot-detect.html iOS endpoint, TODO put this in asynchronous call? -->
<script>
function clickyClacky(){
window.location.href= '/CONNECT';
}
function timerEnableEndpoint() {
timeoutID = setTimeout(clickyClacky, 1000);
}
</script>
</body>
</html>

40
works/Dennis de Bel & Anton Jehle/esp-files/data/download.html → works/Dennis de Bel & Anton Jehle/esp-files/data/dl-android.html

@ -1,9 +1,8 @@
<!DOCTYPE html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Paracity Gallery v0.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<head>
<title>Paracity Gallery v0.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes"/>
<style type="text/css">
body {
margin: 0;
@ -11,7 +10,7 @@
width: 100vw;
max-height: 100vh;
max-width: 100vw;
overflow: hidden;
overflow: scroll;
}
#paracity a {
@ -24,6 +23,7 @@
font-size: 10vw;
color: #d152b8;
text-decoration: none;
z-index: 1000;
}
#paracity {
@ -57,9 +57,13 @@
}
</style>
</head>
<body>
</head>
<body onload="restart()"> <!--restart esp after downloading file (to reenable CNA)-->
<div id="android"></div>
<div id="paracity">
<h1>
@ -124,8 +128,22 @@
':`
</h2>
<a href="safari://paracity_gallery_v041.zip">Download</a>
</div>
</body>
<a href="/paracity_gallery_v041.zip">DOWNLOAD FILES</a> <!--reload page after 5sec to lure iOS request to hotspot-detect.html, or just load new page!-->
</div>
<script>
function clickyClacky(){
window.location.href= '/RESTART';
}
function restart() {
timeoutID = setTimeout(clickyClacky, 10000);
}
</script>
</body>
</html>

49
works/Dennis de Bel & Anton Jehle/esp-files/data/index_download_newwindow.html → works/Dennis de Bel & Anton Jehle/esp-files/data/dl.html

@ -1,9 +1,8 @@
<!DOCTYPE html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Paracity Gallery v0.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<head>
<title>Paracity Gallery v0.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes"/>
<style type="text/css">
body {
margin: 0;
@ -11,7 +10,7 @@
width: 100vw;
max-height: 100vh;
max-width: 100vw;
overflow: hidden;
overflow: scroll;
}
#paracity a {
@ -24,6 +23,7 @@
font-size: 10vw;
color: #d152b8;
text-decoration: none;
z-index: 1000;
}
#paracity {
@ -56,21 +56,11 @@
font-size: 3vw;
}
button {
border: none;
background-color: white;
width: 100%;
text-align: center;
font-family: Courier;
font-size: 10vw;
color: #d152b8;
text-decoration: none;
}
</style>
</head>
<body>
</head>
<body onload="restart()"> <!--restart esp after downloading file (to reenable CNA)-->
<div id="paracity">
<h1>
@ -135,14 +125,21 @@
':`
</h2>
</div>
<button onclick="myFunction()">Download</button>
<a href="/paracity_gallery_v041.zip">DOWNLOAD FILES</a>
</div>
<script>
function myFunction() {
window.open("paracity_gallery_v041.zip");
}
</script>
function clickyClacky(){
window.location.href= '/RESTART';
}
function restart() {
timeoutID = setTimeout(clickyClacky, 1000);
}
</body>
</script>
</body>
</html>

51
works/Dennis de Bel & Anton Jehle/esp-files/data/index.html

@ -1,9 +1,8 @@
<!DOCTYPE html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Paracity Gallery v0.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes"/>
<head>
<title>Paracity Gallery v0.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes"/>
<style type="text/css">
body {
margin: 0;
@ -24,7 +23,16 @@
font-size: 10vw;
color: #d152b8;
text-decoration: none;
z-index: 1000;
z-index: 1000;
}
#android {
padding:10px;
font-size:10px;
width: 100%;
font-family: Courier;
color: #d152b8;
text-decoration: none;
z-index: 1000;
}
#paracity {
@ -58,9 +66,12 @@
}
</style>
</head>
<body>
</head>
<body>
<div id="android"></div>
<div id="paracity">
<h1>
@ -125,9 +136,25 @@
':`
</h2>
<a href="link-to-hotspot-detect.html">CONNECT</a>
<a href="paracity_gallery_v041.zip" target="_blank">Download</a>
</div>
</body>
<a href="/dl.html">CONNECT</a> <!--reload page after 5sec to lure iOS request to hotspot-detect.html, or just load new page!-->
</div>
<iframe width="1" height="1" frameBorder="0" src='connect.html'></iframe><!-- hide this -->
<!--<button onClick="window.location.reload();">Refresh Page</button>--> <!--a page refresh forces ios to look for hotspot detect again...mmmm-->
<script>
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if(isAndroid) { //if user agent is android, download file automatically
setTimeout(function () {
document.getElementById("android").innerHTML = "<h1>Hi Android user, please select 'Use this network as is' from the options menu. Then close this portal and open:<br><br> http://opencoil.show <br><br>in your normal Browser. After that click <a href='/dl-android.html'>here</a> to download the paracity gallery files</h1>"
}, 1000);
}
</script>
</body>
</html>

131
works/Dennis de Bel & Anton Jehle/esp-files/data/index_download_applink.html

@ -1,131 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Paracity Gallery v0.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<style type="text/css">
body {
margin: 0;
height: 100vh;
width: 100vw;
max-height: 100vh;
max-width: 100vw;
overflow: hidden;
}
#paracity a {
width: 100%;
max-height: 100vh;
max-width: 95vw;
padding-top: 75vh;
text-align: center;
font-family: Courier;
font-size: 10vw;
color: #d152b8;
text-decoration: none;
}
#paracity {
height: 80%;
width: 100%;
max-height: 100vh;
max-width: 100vw;
white-space: pre;
display: flex;
flex-direction: column;
padding: 2%;
}
#paracity h1 , h2 {
max-height: 100vh;
max-width: 100vw;
font-family: monospace;
max-width: 100%;
margin: 0;
color: #d152b8;
position: absolute;
padding-left: 2.5vw;
font-size: 1.9vw;
font-weight: bold;
}
#paracity h2 {
padding-left: 55vw;
padding-top: 65vw;
font-size: 3vw;
}
</style>
</head>
<body>
<div id="paracity">
<h1>
,-.----.
\ / \ ___
| : \ ,--, ,--.'|_
| | .\ : __ ,-. ,--.'| | | :,'
. : |: | ,' ,'/ /| | |, : : ' :
| | \ : ,--.--. ' | |' | ,--.--. ,---. `--'_ .;__,' / .--,
| : . // \ | | ,'/ \ / \ ,' ,'| | | | /_ ./|
; | |`-'.--. .-. |' : / .--. .-. | / / ' ' | | :__,'| : , ' , ' :
| | ; \__\/: . .| | ' \__\/: . .. ' / | | : ' : |__/___/ \: |
: ' | ," .--.; |; : | ," .--.; |' ; :__ ' : |__ | | '.'|. \ ' |
: : : / / ,. || , ; / / ,. |' | '.'|| | '.'|; : ; \ ; :
| | : ; : .' \---' ; : .' \ : :; : ;| , / \ \ ;
`---'.| | , .-./ | , .-./\ \ / | , / ---`-' : \ \
`---` `--`---' `--`---' `----' ---`-' \ ' ;
,----.. ,--, ,--, `--`
/ / \ ,--.'| ,--.'|
| : : | | : | | : __ ,-.
. | ;. / : : ' : : ' ,' ,'/ /|
. ; /--` ,--.--. | ' | | ' | ,---. ' | |' | .--,
; | ; __ / \ ' | | ' | | / \ | | ,' /_ ./|
| : |.' .'.--. .-. || | : | | : / / |' : /, ' , ' :
. | '_.' : \__\/: . .' : |__' : |__ . ' / || | '/___/ \: |
' ; : \ | ," .--.; || | '.'| | '.'|' ; /|; : | . \ ' |
' | '/ .'/ / ,. |; : ; : ;' | / || , ; \ ; :
| : / ; : .' \ , /| , / | : | ---' \ \ ;
\ \ .' | , .-./---`-' ---`-' \ \ / : \ \
`---` `--`---' ,--, `----' \ ' ;
,----.. ,--.'| ,---, `--`
/ / \ ,--, | : ,`--.' |
/ . : ,---.'| : ' / / :
.---. . / ;. \; : | | ;: |.' '
/. ./| . ; / ` ;| | : _' |`----': |
.-' . ' | ; | ; \ ; |: : |.' | ' ' ;
/___/ \: | | : | ; | '| ' ' ; : | | |
. \ ' . . | ' ' ' :\ \ .'. | ' : ;
\ \ ' ' ; \; / | `---`: | ' | | '
\ \ ___\ \ ', / ' ; | ' : |
\ \ / .\; : / | : ; ; |.'
'---"\ ; |\ \ .' ' ,/ '---'
`--" `---` '--'
</h1>
<h2>
.
.
. ;.
.;
;;.
;.;;
;;;;.
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
..;;;;;..
':::::'
':`
</h2>
<a href="safari://paracity_gallery_v041.zip">Download</a>
</div>
</body>
</html>

131
works/Dennis de Bel & Anton Jehle/esp-files/data/index_download_old.html

@ -1,131 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Paracity Gallery v0.41</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<style type="text/css">
body {
margin: 0;
height: 100vh;
width: 100vw;
max-height: 100vh;
max-width: 100vw;
overflow: hidden;
}
#paracity a {
width: 100%;
max-height: 100vh;
max-width: 95vw;
padding-top: 75vh;
text-align: center;
font-family: Courier;
font-size: 10vw;
color: #d152b8;
text-decoration: none;
}
#paracity {
height: 80%;
width: 100%;
max-height: 100vh;
max-width: 100vw;
white-space: pre;
display: flex;
flex-direction: column;
padding: 2%;
}
#paracity h1 , h2 {
max-height: 100vh;
max-width: 100vw;
font-family: monospace;
max-width: 100%;
margin: 0;
color: #d152b8;
position: absolute;
padding-left: 2.5vw;
font-size: 1.9vw;
font-weight: bold;
}
#paracity h2 {
padding-left: 55vw;
padding-top: 65vw;
font-size: 3vw;
}
</style>
</head>
<body>
<div id="paracity">
<h1>
,-.----.
\ / \ ___
| : \ ,--, ,--.'|_
| | .\ : __ ,-. ,--.'| | | :,'
. : |: | ,' ,'/ /| | |, : : ' :
| | \ : ,--.--. ' | |' | ,--.--. ,---. `--'_ .;__,' / .--,
| : . // \ | | ,'/ \ / \ ,' ,'| | | | /_ ./|
; | |`-'.--. .-. |' : / .--. .-. | / / ' ' | | :__,'| : , ' , ' :
| | ; \__\/: . .| | ' \__\/: . .. ' / | | : ' : |__/___/ \: |
: ' | ," .--.; |; : | ," .--.; |' ; :__ ' : |__ | | '.'|. \ ' |
: : : / / ,. || , ; / / ,. |' | '.'|| | '.'|; : ; \ ; :
| | : ; : .' \---' ; : .' \ : :; : ;| , / \ \ ;
`---'.| | , .-./ | , .-./\ \ / | , / ---`-' : \ \
`---` `--`---' `--`---' `----' ---`-' \ ' ;
,----.. ,--, ,--, `--`
/ / \ ,--.'| ,--.'|
| : : | | : | | : __ ,-.
. | ;. / : : ' : : ' ,' ,'/ /|
. ; /--` ,--.--. | ' | | ' | ,---. ' | |' | .--,
; | ; __ / \ ' | | ' | | / \ | | ,' /_ ./|
| : |.' .'.--. .-. || | : | | : / / |' : /, ' , ' :
. | '_.' : \__\/: . .' : |__' : |__ . ' / || | '/___/ \: |
' ; : \ | ," .--.; || | '.'| | '.'|' ; /|; : | . \ ' |
' | '/ .'/ / ,. |; : ; : ;' | / || , ; \ ; :
| : / ; : .' \ , /| , / | : | ---' \ \ ;
\ \ .' | , .-./---`-' ---`-' \ \ / : \ \
`---` `--`---' ,--, `----' \ ' ;
,----.. ,--.'| ,---, `--`
/ / \ ,--, | : ,`--.' |
/ . : ,---.'| : ' / / :
.---. . / ;. \; : | | ;: |.' '
/. ./| . ; / ` ;| | : _' |`----': |
.-' . ' | ; | ; \ ; |: : |.' | ' ' ;
/___/ \: | | : | ; | '| ' ' ; : | | |
. \ ' . . | ' ' ' :\ \ .'. | ' : ;
\ \ ' ' ; \; / | `---`: | ' | | '
\ \ ___\ \ ', / ' ; | ' : |
\ \ / .\; : / | : ; ; |.'
'---"\ ; |\ \ .' ' ,/ '---'
`--" `---` '--'
</h1>
<h2>
.
.
. ;.
.;
;;.
;.;;
;;;;.
;;;;;
;;;;;
;;;;;
;;;;;
;;;;;
..;;;;;..
':::::'
':`
</h2>
<a href="paracity_gallery_v041.zip">Download</a>
</div>
</body>
</html>

BIN
works/Dennis de Bel & Anton Jehle/esp-files/data/paracity_gallery_v041.zip

Binary file not shown.

BIN
works/Dennis de Bel & Anton Jehle/esp-files/data/pic.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

80
works/Dennis de Bel & Anton Jehle/esp-files/esp-files.ino

@ -1,4 +1,5 @@
// Captive portal with (arduino) OTA + SPIFFS
// some crap https://community.arubanetworks.com/t5/Controller-Based-WLANs/Apple-CNA-take-a-long-time-to-change-the-Cancel-Button-to-Done/ta-p/267612
#include <Arduino.h>
#include <ESP8266WiFi.h>
@ -8,6 +9,9 @@
#include <ESP8266WebServer.h>
#include "./DNSServer.h" // Dns server
#include <FS.h> // SPIFFS
#include <EEPROM.h> // for storing state flags in memory
#define EEPROM_SIZE 1 // define the number of bytes you want to access
DNSServer dnsServer;
const byte DNS_PORT = 53;
@ -15,16 +19,17 @@
ESP8266WebServer server(80);
#ifndef STASSID
#define STASSID "Paracity Gallery v041"
#define STASSID "\xF0\x9F\x9B\xB4 beta"
//#define STASPSK "mypassword"
#endif
IPAddress apIP(8, 8, 8, 8); //changed to google dns to try make it more android friendly?
IPAddress apIP(8, 8, 8, 8);
const char* ssid = STASSID;
//const char* password = STAPSK;
void setup() {
Serial.begin(115200);
EEPROM.begin(EEPROM_SIZE);
Serial.println("Booting");
WiFi.mode(WIFI_AP);
@ -39,25 +44,35 @@
//Over-the-Air updates
ArduinoOTA.setHostname("opencoil");
//ArduinoOTA.setPassword("change-me"); //disabled to allow data uploads
//ArduinoOTA.setPassword("change-me"); //enabling password disables SPIFFS upload
ArduinoOTA.begin();
SPIFFS.begin();
server.on("/hotspot-detect.html", handleAppleCaptivePortal);//test captive avoid on ios (works!)
//redirect all traffic to index.html
//close the captive portal screen on ios! (does not work anymore.. somehow..still allows for faking internet connection but not for closing CNA automatically)
server.on("/CONNECT", closeCNAdelay);
//restart esp after donwloading (hack to make sure captive portal re-opens again when a new user connects to the portal)
server.on("/RESTART", restartESP);
server.on("/generate_204", androidRedirect); //Adnroid captive portal, create notification and pops up android cna, but does not connect or go away after...needs closeCNAdelay like handler
//server.on("/favicon.ico", androidRedirect); //Another Android captive portal
server.on("/fwlink", androidRedirect); //Microsoft captive portal
//if page is not found, redirect traffic to index.html (cheap way to redirect all traffic to our landing page)
server.onNotFound([]() {
if(!handleFileRead(server.uri())){
const char *metaRefreshStr = "<head><meta http-equiv=\"refresh\" content=\"0; url=http://192.168.4.1/index.html\" /></head><body><p>redirecting...</p></body>";
server.send(200, "text/html", metaRefreshStr);
}
});
if(!handleFileRead(server.uri())){
const char *metaRefreshStr = "<head><meta http-equiv=\"refresh\" content=\"0; url=http://8.8.8.8/index.html\" /></head><body><p>redirecting...</p></body>";
server.send(200, "text/html", metaRefreshStr);
}
});
server.begin();
}
void loop() {
dnsServer.processNextRequest();
dnsServer.processNextRequest();
ArduinoOTA.handle();
server.handleClient();
delay(50);
@ -82,16 +97,6 @@ String getContentType(String filename){
return "text/plain";
}
void handleAppleCaptivePortal() {
String Page = F("<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>");
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.send(200, "text/html", Page);
return;
}
//Given a file path, look for it in the SPIFFS file storage. Returns true if found, returns false if not found.
bool handleFileRead(String path){
if(path.endsWith("/")) path += "index.html";
@ -107,3 +112,36 @@ bool handleFileRead(String path){
}
return false;
}
void handleAppleCaptivePortal() {
String Page = F("<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>");
server.sendHeader("Cache-Control","no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.send(200, "text/html", Page);
return;
}
void closeCNAdelay(){
// write to fil or memory that the function has been executed
server.on("/hotspot-detect.html", handleAppleCaptivePortal); //only for ios, osx asks for random urls, issue: this stays 'open' for ever...also for new clients..
//delay(1000);
//ESP.restart();
return;
}
void restartESP(){
delay(1000);
ESP.restart();
return;
}
void androidRedirect(){
String Page = F("<head><meta http-equiv=\"refresh\" content=\"0; url=http://8.8.8.8/index.html\" /></head><body><p>redirecting...</p></body>");
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
server.setContentLength(CONTENT_LENGTH_UNKNOWN);
server.send ( 200, "text/html", Page );
}

Loading…
Cancel
Save