pull/8/head
Hieromon Ikasamo 7 years ago
parent 7817433eac
commit c68b1d6619
  1. BIN
      docs/images/PageBuilder.png
  2. 79
      examples/Credential/Credential.ino
  3. 10
      examples/HandleClient/HandleClient.ino
  4. 10
      examples/HandlePortal/HandlePortal.ino
  5. 76
      examples/HandlePortalEX/HandlePortalEX.ino
  6. 2
      library.json
  7. 2
      library.properties
  8. BIN
      mkdocs/images/PageBuilder.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 251 KiB

@ -41,47 +41,48 @@ String delCredential(PageArgument&);
* The number of the entry to be deleted is passed to the function in the * The number of the entry to be deleted is passed to the function in the
* POST method. * POST method.
*/ */
static const char html[] PROGMEM = { static const char PROGMEM html[] = R"*lit(
"<!DOCTYPE html>" <!DOCTYPE html>
"<html>" <html>
"<head>" <head>
"<meta charset=\"UTF-8\" name=\"viewport\" content=\"width=device-width, initial-scale=1\">" <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
"<style>" <style>
"html {" html {
"font-family:Helvetica,Arial,sans-serif;" font-family:Helvetica,Arial,sans-serif;
"-ms-text-size-adjust:100%;" -ms-text-size-adjust:100%;
"-webkit-text-size-adjust:100%;" -webkit-text-size-adjust:100%;
"}" }
"a:link, a:visited {" .menu > a:link {
"background-color: #2f4f4f;" position: absolute;
"border-radius: 4px;" display: inline-block;
"color: white;" right: 12px;
"display: inline-block;" padding: 0 6px;
"padding: 6px 12px;" text-decoration: none;
"text-align: center;" }
"text-decoration: none;" </style>
"}" </head>
"a:hover, a:active {" <body>
"background-color: #132020;" <div class="menu">{{AUTOCONNECT_MENU}}</div>
"}" <form action="/del" method="POST">
"</style>" <ol>
"</head>" {{SSID}}
"<body>" </ol>
"<form action=\"/del\" method=\"POST\">" <p>Enter deleting entry:</p>
"<ol>" <input type="number" min="1" name="num">
"{{SSID}}" <input type="submit">
"</ol>" </form>
"<p>Enter deleting entry:</p>" </body>
"<input type=\"number\" min=\"1\" name=\"num\">" </html>
"<input type=\"submit\">" )*lit";
"</form>"
"<p><a href=\"" AUTOCONNECT_URI "\">Menu</a></p>" static const char PROGMEM autoconnectMenu[] = { AUTOCONNECT_LINK(BAR_24) };
"</body>"
"</html>"
};
// URL path as '/' // URL path as '/'
PageElement elmList(html, {{ "SSID", viewCredential }}); PageElement elmList(html,
{{ "SSID", viewCredential },
{ "AUTOCONNECT_MENU", [](PageArgument& args) {
return String(FPSTR(autoconnectMenu));} }
});
PageBuilder rootPage("/", { elmList }); PageBuilder rootPage("/", { elmList });
// URL path as '/del' // URL path as '/del'

@ -26,8 +26,12 @@ void handleRoot() {
"font-family:'Arial',sans-serif;" "font-family:'Arial',sans-serif;"
"text-align:center;" "text-align:center;"
"}" "}"
".menu {" ".menu > a:link {"
"text-align:right;" "position: absolute;"
"display: inline-block;"
"right: 12px;"
"padding: 0 6px;"
"text-decoration: none;"
"}" "}"
".button {" ".button {"
"display:inline-block;" "display:inline-block;"
@ -41,7 +45,7 @@ void handleRoot() {
"</style>" "</style>"
"</head>" "</head>"
"<body>" "<body>"
"<p class=\"menu\">" AUTOCONNECT_LINK(BAR_32) "</p>" "<div class=\"menu\">" AUTOCONNECT_LINK(BAR_24) "</div>"
"BUILT-IN LED<br>" "BUILT-IN LED<br>"
"GPIO("); "GPIO(");
page += String(BUILTIN_LED); page += String(BUILTIN_LED);

@ -32,8 +32,12 @@ void handleRoot() {
"font-family:'Arial',sans-serif;" "font-family:'Arial',sans-serif;"
"text-align:center;" "text-align:center;"
"}" "}"
".menu {" ".menu > a:link {"
"text-align:right;" "position: absolute;"
"display: inline-block;"
"right: 12px;"
"padding: 0 6px;"
"text-decoration: none;"
"}" "}"
".button {" ".button {"
"display:inline-block;" "display:inline-block;"
@ -47,7 +51,7 @@ void handleRoot() {
"</style>" "</style>"
"</head>" "</head>"
"<body>" "<body>"
"<p class=\"menu\">" AUTOCONNECT_LINK(BAR_32) "</p>" "<div class=\"menu\">" AUTOCONNECT_LINK(BAR_32) "</div>"
"BUILT-IN LED<br>" "BUILT-IN LED<br>"
"GPIO("); "GPIO(");
page += String(BUILTIN_LED); page += String(BUILTIN_LED);

@ -23,39 +23,45 @@
ESP8266WebServer server; ESP8266WebServer server;
AutoConnect portal(server); AutoConnect portal(server);
static const char mold_page[] PROGMEM = { static const char PROGMEM mold_page[] = R"*lit(
"<html>" <html>
"</head>" </head>
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">" <meta name="viewport" content="width=device-width, initial-scale=1">
"<style type=\"text/css\">" <style type="text/css">
"body {" body {
"-webkit-appearance:none;" -webkit-appearance:none;
"-moz-appearance:none;" -moz-appearance:none;
"font-family:'Arial',sans-serif;" font-family:'Arial',sans-serif;
"text-align:center;" text-align:center;
"}" }
".menu {" .menu > a:link {
"text-align:right;" position: absolute;
"}" display: inline-block;
".button {" right: 12px;
"display:inline-block;" padding: 0 6px;
"border-radius:7px;" text-decoration: none;
"background:#73ad21;" }
"margin:0 10px 0 10px;" .button {
"padding:10px 20px 10px 20px;" display:inline-block;
"text-decoration:none;" border-radius:7px;
"color:#000000;" background:#73ad21;
"}" margin:0 10px 0 10px;
"</style>" padding:10px 20px 10px 20px;
"</head>" text-decoration:none;
"<body>" color:#000000;
"<p class=\"menu\">" AUTOCONNECT_LINK(BAR_32) "</p>" }
"BUILT-IN LED<br>" </style>
"GPIO({{LED}}) : <span style=\"font-weight:bold;color:{{COLOR}}\">{{GPIO}}</span>" </head>
"<p><a class=\"button\" href=\"/io?v=low\">low</a><a class=\"button\" href=\"/io?v=high\">high</a></p>" <body>
"</body>" <div class="menu">{{AUTOCONNECT_MENU}}</div>
"</html>" BUILT-IN LED<br>
}; GPIO({{LED}}) : <span style="font-weight:bold;color:{{COLOR}}">{{GPIO}}</span>
<p><a class="button" href="/io?v=low">low</a><a class="button" href="/io?v=high">high</a></p>
</body>
</html>
)*lit";
static const char PROGMEM autoconnectMenu[] = { AUTOCONNECT_LINK(BAR_24) };
String getLEDPort(PageArgument& args) { String getLEDPort(PageArgument& args) {
return String(BUILTIN_LED); return String(BUILTIN_LED);
@ -72,7 +78,9 @@ String readLEDPort(PageArgument& args) {
PageElement elm_gpio(mold_page, { PageElement elm_gpio(mold_page, {
{"LED", getLEDPort}, {"LED", getLEDPort},
{"COLOR", setColor}, {"COLOR", setColor},
{"GPIO", readLEDPort} {"GPIO", readLEDPort},
{"AUTOCONNECT_MENU", [](PageArgument& args) {
return String(FPSTR(autoconnectMenu));}}
}); });
PageBuilder root("/", { elm_gpio }); PageBuilder root("/", { elm_gpio });

@ -17,6 +17,6 @@
], ],
"frameworks": "arduino", "frameworks": "arduino",
"platforms": "espressif8266", "platforms": "espressif8266",
"version": "0.9.1", "version": "0.9.2",
"license": "MIT" "license": "MIT"
} }

@ -1,5 +1,5 @@
name=AutoConnect name=AutoConnect
version=0.9.1 version=0.9.2
author=Hieromon Ikasamo <hieromon@gmail.com> author=Hieromon Ikasamo <hieromon@gmail.com>
maintainer=Hieromon Ikasamo <hieromon@gmail.com> maintainer=Hieromon Ikasamo <hieromon@gmail.com>
sentence=ESP8266 WLAN configuration at runtime with web interface. sentence=ESP8266 WLAN configuration at runtime with web interface.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 251 KiB

Loading…
Cancel
Save