Files
squeezelite-esp32/components/wifi-manager/webapp/src/index.ejs

480 lines
20 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="apple-mobile-web-app-capable" content="yes" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<title></title>
</head>
<body class="d-flex flex-column">
<header class="navbar navbar-expand-sm navbar-dark bg-primary sticky-top border-bottom border-dark" id="mainnav">
<a class="navbar-brand" id="navtitle" href="#"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="nav navbar-nav mr-auto" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-wifi">WiFi</a></li>
<li class="nav-item omsg"><a class="nav-link" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-syslog">Status<span
class="badge badge-pill badge-success" id="msgcnt"></span></a></li>
<li class="nav-item orec"><a class="nav-link" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-cfg-audio">Audio</a></li>
<li class="nav-item orec"><a class="nav-link" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-cfg-syst">System</a></li>
<li class="nav-item orec"><a class="nav-link" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-cfg-hw">Hardware</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-cfg-fw">Updates</a></li>
<div class="dropdown-divider"></div>
<li class="nav-item"><a class="nav-link" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-nvs">NVS Editor</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-commands">Advanced</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" aria-controls="profile" role="tab" href="#tab-credits">Credits</a></li>
</ul>
</div>
<div class="info navbar-right" style="display: inline-flex;">
<span class="recovery_element material-icons " style="color:orange; display: none" >system_update_alt</span>
<span id="battery" class="material-icons" style="fill:white; display: none">battery_full</span>
<span id="o_jack" class="material-icons" style="fill:white; display: none">headphones</span>
<span id="s_airplay" class="material-icons" style="fill:white; display: none">airplay</span>
<em id="s_cspot" class="fab fa-spotify" style="fill:white; display: inline"></em>
<span data-toggle="tooltip" id="o_type" data-placement="top" title="">
<span id="o_bt" class="material-icons" style="fill:white; display: none" >bluetooth</span>
<span id="o_spdif" class="material-icons" style="fill:white; display: none" >graphic_eq</span>
<span id="o_i2s" class="material-icons" style="fill:white; display: none" >speaker</span>
</span>
<span id="ethernet" class="material-icons if_eth" style="fill:white; display: none" >cable</span>
<span id="wifiStsIcon" class="material-icons if_wifi" style="fill:white; display: none">signal_wifi_statusbar_4_bar</span>
</div>
</header>
<main role="main" class="flex-grow mt-1 mb-12" style="margin-bottom: 7rem;" id="content">
<!-- Button trigger modal -->
<!-- Modal -->
<div class="modal fade" id="otadiv" tabindex="-1" role="dialog" aria-labelledby="fwProgressLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fwProgressLabel">Upgrade Progress</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<span id="flash-status"></span>
<div class="progress" id="progress">
<div class="progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width:0%">
0%
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade" id="tab-cfg-hw"> </div>
<div class="tab-pane fade" id="tab-cfg-syst"></div>
<div class="tab-pane fade" id="tab-cfg-gen"></div>
<div class="tab-pane fade" id="tab-cfg-fw">
<div class="card text-white mb-3">
<div class="card-header">Software Updates</div>
<div class="card-body">
<table class="table table-hover table-striped table-dark">
<thead>
<tr>
<th class="border-bottom-0 pb-0" scope="col">Version</th>
<th class="border-bottom-0 pb-0" scope="col">Date/Time</th>
<th class="border-bottom-0 pb-0" scope="col">Platform</th>
<th class="border-bottom-0 pb-0" scope="col">Branch</th>
<th class="border-bottom-0 pb-0" scope="col">Bit Depth</th>
</tr>
<tr>
<th class="border-top-0 pt-0" scope="col"><input class="form-control-sm upSrch"
id="svrs" type="text" placeholder="search releases"></th>
<th class="border-top-0 pt-0" scope="col"></th>
<th class="border-top-0 pt-0" scope="col"><input class="form-control-sm upSrch"
id="splf" type="text" placeholder="search platform"></th>
<th class="border-top-0 pt-0" scope="col"><select class="form-control-sm upSrch"
id="fwbranch">
<option selected="">Choose FW branch</option>
</select>
<th class="border-top-0 pt-0" scope="col"><input class="form-control-sm upSrch"
id="bits" type="text" placeholder="search bit depth"></th>
</th>
</tr>
</thead>
<tbody id="rTable"></tbody>
</table>
<div class="form-group row">
<div class="col-auto">
<button type="button" id="chkUpdates" class="btn btn-info btn-sm">Check for
updates</button>
</div>
<label class="col-auto col-form-label" for="fw-url-input">Firmware URL</label>
<div class="col">
<input type="text" class="form-control"
placeholder="select entry from list or enter known url" id="fw-url-input">
</div>
<div class="col-auto">
<button type="button" id='start-flash' data-toggle="modal" data-target="#uCnfrm"
class="btn btn-warning btn-sm" style="display: none;">Flash Firmware</button>
</div>
<div class="col-auto">
<button id="btn_reboot_recovery" class="btn-warning ota_element" type="submit" >Recovery</button>
</div>
</div>
</div>
</div>
<div class="modal" id="uCnfrm">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Firmware Flash</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Flash URL <span id="selectedFWURL" class="text-break"></span> to device?</p>
</div>
<div class="modal-footer ">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button id="btn_flash" type="button" class="btn btn-warning" data-dismiss="modal" >Ok</button>
</div>
</div>
</div>
</div>
<div class="card text-white mb-3" >
<div class="card-header">Local Firmware Upload</div>
<div class="card-body">
<div id="uploaddiv" class="form-group row">
<label for="flashfilename" class="col-auto col-form-label">Local File</label>
<div class="col">
<input type="file" class="form-control-file" id="flashfilename" aria-describedby="fileHelp">
</div>
<div class="col-auto">
<div class="buttons">
<button type="button" class="btn btn-danger" id="fwUpload">Upload!</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab-nvs">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Key</th>
<th scope="col">Value</th>
</tr>
</thead>
<tbody id="nvsTable">
</tbody>
</table>
<div class="buttons">
<button button id="btn_reboot" class="btn btn-primary" style="float:right" type="submit" >Reboot</button>
<input id="save-nvs" type="button" class="btn btn-success" value="Commit">
<input id="save-as-nvs" type="button" class="btn btn-success" value="Download config">
<input id="load-nvs" type="button" class="btn btn-success" value="Load File">
<input aria-describedby="fileHelp" id="nvsfilename" type="file" style="display:none">
</div>
</div>
<div class="tab-pane fade" id="tab-cfg-audio">
<div class="card text-white mb-3">
<div class="card-header">Usage Templates</div>
<div class="card-body">
<fieldset>
<fieldset class="form-group" id="output-tmpl">
<legend>Output</legend>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="output-tmpl" id="i2s">
I2S Dac
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="output-tmpl" id="spdif">
SPDIF
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="output-tmpl" id="bt">
Bluetooth
</label>
</div>
</fieldset>
<div class="form-group"><label for="player">Player Name</label><input type="text"
class="form-control " placeholder="Squeezelite" id="player"></div>
<div class="form-group"><label for="optional">Optional setting (e.g. for LMS IP
address)</label><input type="text" class="form-control" id="optional"></div>
<div class="form-group">
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" id="disable-squeezelite" value=""
checked="">
Disable Squeezelite
</label>
</div>
</div>
<div class="toast show" role="alert" aria-live="assertive" aria-atomic="true"
style="display: none;" id="toast_cfg-audio-tmpl">
<div class="toast-header"><strong class="mr-auto">Result</strong><button type="button"
class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"
onclick="hideSurrounding(this)"><span aria-hidden="true">×</span></button></div>
<div class="toast-body" id="msg_cfg-audio-tmpl"></div>
</div>
<button id="save-autoexec1" type="submit" class="btn btn-info" cmdname="cfg-audio-tmpl">Save</button>
<button id="commit-autoexec1" type="submit" class="btn btn-warning" cmdname="cfg-audio-tmpl">Apply</button>
</fieldset>
</div>
</div>
</div>
<div class="tab-pane fade active show" id="tab-wifi">
<div class="card text-white mb-3">
<div class="card-header">WiFi Status</div>
<div class="card-body if_eth" style="display: none">
<h2>Connected to Ethernet</h2>
<p>WiFi is inactive while connected to a wired network.
</div>
<div class="card-body if_wifi" style="display: none" >
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Joined</th>
<th scope="col">Name</th>
<th scope="col">Signal</th>
<th scope="col">Security</th>
</tr>
</thead>
<tbody id="wifiTable"></tbody>
</table>
<button type="button" id="updateAP" class="btn btn-info btn-sm">Scan</button>
</div>
<div class="modal" id="WiFiDisconnectConfirm">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Disconnect</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Disconnect from network? After disconnecting, the system won't be accessible from
the current address and will expose itself as access point name <span
id="apName"></span> with password <span id="apPass"></span> </p>
</div>
<div class="modal-footer connecting-success connecting-status">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button id="btn_disconnect" type="button" class="btn btn-warning" data-dismiss="modal">Ok</button>
</div>
</div>
</div>
</div>
<div class="modal" id="WifiConnectDialog">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title connecting connecting-init connecting-fail">Connect to WiFi
</h5>
<h5 class="modal-title connecting-status connecting-success">Status</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<fieldset class="connecting-init connecting-fail">
<div class="form-group"><label for="manual_ssid">Wifi Name</label><input type="text"
class="form-control" placeholder="Enter Name" id="manual_ssid"></div>
<div class="form-group"><label for="manual_pwd">Password</label><input
type="password" class="form-control" placeholder="Enter Name"
id="manual_pwd"></div>
</fieldset>
<div id="connect-wait" class="connecting">
<div>Connecting to <span id="ssid-wait"></span> </div>
<div>
You may lose wifi access while the esp32 recalibrates
its radio. Please
wait until your device automatically reconnects. This can take up to
30s.
</div>
</div>
<div id="connect-success" class="connecting-success connecting-status">
<div> Connected to Access Point : <span id="connectedToSSID"></span></div>
<div> Device IP address : <span id="ipAddress"></span></div>
<div>Subnet Mask:<span id="netmask"></span></div>
<div>Default Gateway:<span id="gateway"></span></div>
</div>
<div id="connect-fail" class="connecting-fail">
<h3 class="text-error">Connection failed</h3>
<p>Please double-check wifi password if any and make sure the access point has
good signal.</p>
</div>
</div>
<div class="modal-footer ">
<button type="button"
class="btn btn-secondary connecting-init connecting-fail connecting"
data-dismiss="modal">Close</button>
<button type="button" id="btnJoin"
class="btn btn-primary connecting-init connecting-fail">Join</button>
<button type="button" class="connecting btn btn-primary" disabled>
<span class="spinner-border spinner-border-sm" role="status"
aria-hidden="true"></span>
<span class="sr-only">Connecting...</span></button>
</div>
<div class="modal-footer connecting-success connecting-status justify-content-between" style=""><button type="button"
class="btn btn-primary" data-dismiss="modal">Ok</button><button type="button" class="btn btn-danger"
data-toggle="modal" data-dismiss="modal" data-target="#WiFiDisconnectConfirm">Disconnect</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade " id="tab-commands">
<fieldset id="commands-list"></fieldset>
</div>
<!-- Status -->
<div class="tab-pane fade " id="tab-syslog">
<div class="card border-primary mb-3">
<div class="card-header">Logs</div>
<div class="card-body">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Timestamp</th>
<th scope="col">Message</th>
</tr>
</thead>
<tbody id="syslogTable">
</tbody>
</table>
<div class="buttons">
<input id="clear-syslog" type="button" class="btn btn-danger btn-sm" value="Clear" />
</div>
</div>
</div>
<div class="card border-primary mb-3" id="pins" style="display: none;">
<div class="card-header">Pin Assignments</div>
<div class="card-body">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Device</th>
<th scope="col">Pin Name</th>
<th scope="col">GPIO Number</th>
<th scope="col">Type</th>
</tr>
</thead>
<tbody id="gpiotable"></tbody>
</table>
</div>
</div>
<div class="card border-primary mb-3" style="visibility: collapse;" id="tasks_sect">
<div class="card-header">Tasks</div>
<div class="card-body">
<table class="table table-hover">
<!-- console.log(msg_time.toLocaleString() + '\tname' + '\tcpu' + '\tstate' + '\tminstk' + '\tbprio' + '\tcprio' + '\tnum'); -->
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Task Name</th>
<th scope="col">CPU</th>
<th scope="col">State</th>
<th scope="col">Min Stack</th>
<th scope="col">Base Priority</th>
<th scope="col">Cur Priority</th>
</tr>
</thead>
<tbody id="tasks"></tbody>
</table>
</div>
</div>
</div>
<!-- syslog -->
<div class="tab-pane fade " id="tab-credits">
<div class="card text-white mb-3">
<div class="card-header">Credits</div>
<div class="card-body">
<p><strong><a
href="https://github.com/sle118/squeezelite-esp32">squeezelite-esp32</a><br></strong>&copy;
2020, philippe44, sle118, daduke<br /><a href="https://opensource.org/licenses/MIT">This
software is released under the MIT License.</a></p>
<p>
This app would not be possible without the following libraries:
</p>
<ul>
<li>squeezelite, &copy; 2012-2019, Adrian Smith and Ralph Irving. Licensed under the GPL
License.</li>
<li>esp32-wifi-manager, &copy; 2017-2019, Tony Pottier. Licensed under the MIT License.</li>
<li>SpinKit, &copy; 2015, Tobias Ahlin. Licensed under the MIT License.</li>
<li>jQuery, The jQuery Foundation. Licensed under the MIT License.</li>
<li>cJSON, &copy; 2009-2017, Dave Gamble and cJSON contributors. Licensed under the MIT
License.
</li>
<li>esp32-rotary-encoder, &copy; 2011-2019, David Antliff and Ben Buxton. Licensed under the
GPL
License.</li>
<li>tarablessd1306, &copy; 2017-2018, Tara Keeling. Licensed under the MIT license.</li>
<li>CSpot, &copy; 2020 feelfreelinux & alufers. Licensed under the GPL License</li>
</ul>
</div>
</div>
<div class="card text-white mb-3">
<div class="card-header">Extras/Overrides</div>
<div class="card-body">
<fieldset>
<div class="form-check">
<label class="form-check-label"><input type="checkbox" id="show-nvs"
class="form-check-input " value="">Show NVS Editor</label>
</div>
</fieldset>
<fieldset>
<div class="form-check">
<label class="form-check-label"><input type="checkbox" id="show-commands"
class="form-check-input " value="">Show Advanced Commands</label>
</div>
</fieldset>
</div>
</div>
</div>
<!-- credits -->
</div>
</div>
</main>
<footer>
<div class="fixed-bottom d-flex justify-content-between border-top border-dark p-3 bg-primary">
<span class="text-center" id="foot-fw"></span><button class="btn-warning ota_element " id="reboot_nav"
type="submit" style="display: none;">Reboot</button>
<button class="btn-warning recovery_element" id="reboot_ota_nav" type="submit"
style="display: none;">Exit Recovery</button><span class="text-center" id="foot-if"></span>
</div>
</footer>
</body>
</html>