Newer
Older
smart-home-server / devices / sh_core_esp8266 / src / WebPages.cpp
#include "sh_core_esp8266.h"

const char* wifi_setup_page = R"HTML(
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>WiFi setup</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link
    href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
    rel="stylesheet">
</head>
<body class="bg-dark text-light">
  <div class="container py-4">
    <div class="row justify-content-center">
      <div class="col-12 col-md-8 col-lg-5">
        <div class="card shadow-sm">
          <div class="card-body">
            <h1 class="h4 text-center mb-3">WiFi setup</h1>
            <p class="text-muted text-center mb-4">
              Connect the device to your home WiFi network.
            </p>
            <form method="POST" action="/save_wifi">
              <div class="mb-3">
                <label class="form-label">WiFi SSID</label>
                <input name="ssid" class="form-control" placeholder="MyWiFi">
              </div>
              <div class="mb-3">
                <label class="form-label">Password</label>
                <input name="pass" type="password" class="form-control" placeholder="••••••••">
              </div>
              <div class="d-grid">
                <button type="submit" class="btn btn-primary">
                  Save &amp; reboot
                </button>
              </div>
            </form>
          </div>
        </div>
        <p class="text-center text-muted mt-3 mb-0">
          ESP-01 Relay
        </p>
      </div>
    </div>
  </div>
</body>
</html>
)HTML";

const char* update_page = R"HTML(
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Firmware Update</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link
    href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
    rel="stylesheet">
</head>
<body class="bg-dark text-light">
  <div class="container py-4">
    <div class="row justify-content-center">
      <div class="col-12 col-md-8 col-lg-5">
        <div class="card shadow-sm">
          <div class="card-body">
            <h1 class="h4 mb-3 text-center">Firmware Update</h1>
            <p class="text-muted text-center mb-4">
              Select a compiled <code>.bin</code> file and upload it to update the firmware.
            </p>
            <form method="POST" action="/update" enctype="multipart/form-data">
              <div class="mb-3">
                <input type="file" name="firmware" class="form-control">
              </div>
              <div class="d-grid">
                <button type="submit" class="btn btn-primary">
                  Upload &amp; flash
                </button>
              </div>
            </form>
          </div>
        </div>
        <p class="text-center mt-3 mb-0">
          <a href="/" class="link-light text-decoration-none">Back</a>
        </p>
      </div>
    </div>
  </div>
</body>
</html>
)HTML";