<!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-bs-toggle="collapse" data-bs-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-bs-toggle="tab" aria-controls="profile" role="tab"
						href="#tab-wifi">WiFi</a></li>
				<li class="nav-item omsg"><a class="nav-link" data-bs-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-bs-toggle="tab" aria-controls="profile" role="tab"
						href="#tab-cfg-audio">Audio</a></li>
				<li class="nav-item orec"><a class="nav-link" data-bs-toggle="tab" aria-controls="profile" role="tab"
						href="#tab-cfg-syst">System</a></li>
				<li class="nav-item orec"><a class="nav-link" data-bs-toggle="tab" aria-controls="profile" role="tab"
						href="#tab-cfg-hw">Hardware</a></li>
				<li class="nav-item"><a class="nav-link" data-bs-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-bs-toggle="tab" aria-controls="profile" role="tab"
						href="#tab-nvs">NVS Editor</a></li>
				<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" aria-controls="profile" role="tab"
						href="#tab-commands">Advanced</a></li>
				<li class="nav-item"><a class="nav-link" data-bs-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"
				aria-label="🛑">system_update_alt</span>
			<span id="battery" class="material-icons" style="fill:white; display: none"
				aria-label="🔋">battery_full</span>
			<span id="o_jack" class="material-icons" style="fill:white; display: none" aria-label="🎧">headphones</span>
			<span id="s_airplay" class="material-icons" style="fill:white; display: none" aria-label="🍎">airplay</span>
			<em id="s_cspot" class="fab fa-spotify" style="fill:white; display: inline"></em>
			<span data-bs-toggle="tooltip" id="o_type" data-bs-placement="top" title="">
				<span id="o_bt" class="material-icons" style="fill:white; display: none" aria-label="">bluetooth</span>
				<span id="o_spdif" class="material-icons" style="fill:white; display: none"
					aria-label="">graphic_eq</span>
				<span id="o_i2s" class="material-icons" style="fill:white; display: none" aria-label="🔈">speaker</span>
			</span>
			<span id="ethernet" class="material-icons if_eth" style="fill:white; display: none"
				aria-label="ETH">cable</span>
			<span id="wifiStsIcon" class="material-icons if_wifi" style="fill:white; display: none"
				aria-label=""></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" id="otadiv" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" id="fwProgressLabel">Upgrade Progress</h5>
						<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></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-bs-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-bs-toggle="modal" data-bs-target="#uCnfrm"
									class="btn btn-warning btn-sm flact" 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="btn-close" data-bs-dismiss="modal"
									aria-label="Close"></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-bs-dismiss="modal">Cancel</button>
								<button id="btn_flash" type="button" class="btn btn-warning"
									data-bs-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 flact" 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 class="form-group" id="output-tmpl">
								<label>Output</label><br>
								<div class="form-check form-check-inline">
									<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 form-check-inline">
									<label class="form-check-label">
										<input type="radio" class="form-check-input" name="output-tmpl" id="spdif">
										SPDIF
									</label>
								</div>
								<div class="form-check form-check-inline">
									<label class="form-check-label">
										<input type="radio" class="form-check-input" name="output-tmpl" id="bt">
										Bluetooth
									</label>
								</div>
							</fieldset>
							<fieldset>
							<div id="options">
								<div class="form-group"><label for="cmd_opt_n">Set the player name</label><input
										type="text" class="form-control sqcmd" placeholder="name" id="cmd_opt_n"></div>
								<div class="form-group"><label for="cmd_opt_s">Server</label><input type="text"
										class="form-control sqcmd" placeholder="server[:port]" id="cmd_opt_s"></div>
								<div class="form-group"><label for="cmd_opt_b">Stream and Output buffer sizes (in
										Kbytes)</label><input type="text" class="form-control sqcmd"
										placeholder="stream:output" id="cmd_opt_b"></div>
								<div class="form-group"><label for="cmd_opt_c">Restrict codecs </label><input
										type="text" class="form-control sqcmd" placeholder="codec1,codec2"
										id="cmd_opt_c"><small class="form-text text-muted">Supported: flac,pcm,mp3,ogg
										(mad,mpg for specific mp3 codec)</small></div>
								<div class="form-group"><label for="cmd_opt_C">Ouput device close timeout</label><input
										type="text" class="form-control sqcmd" placeholder="timeout"
										id="cmd_opt_C"><small class="form-text text-muted">Close output device after
										timeout seconds, default
										is to keep it open while player is 'on'</small></div>
								<div class="form-group"><label for="cmd_opt_d">Set logging level</label><input
										type="text" class="form-control sqcmd" placeholder="log=level"
										id="cmd_opt_d"><small class="form-text text-muted">Logs:
										all|slimproto|stream|decode|output, level:
										info|debug|sdebug</small></div>
								<div class="form-group"><label for="cmd_opt_e">Explicitly exclude native support of one
										or more codecs</label><input type="text" class="form-control sqcmd"
										placeholder="codec1,codec2" id="cmd_opt_e"><small
										class="form-text text-muted">Supported: flac,pcm,mp3,ogg (mad,mpg for specific
										mp3 codec)</small></div>
								<div class="form-group"><label for="cmd_opt_m">Set mac address</label><input type="text"
										class="form-control sqcmd" placeholder="mac addr" id="cmd_opt_m"><small
										class="form-text text-muted">Format: ab:cd:ef:12:34:56</small></div>
								<div class="form-group"><label for="cmd_opt_r">Sample rates supported, allows output to
										be off when squeezelite is started</label><input type="text"
										class="form-control sqcmd" placeholder="rates" id="cmd_opt_r"><small
										class="form-text text-muted">&lt;maxrate&gt;|&lt;minrate&gt;&lt;maxrate&gt;&lt;rate1&gt;&lt;rate2&gt;&lt;rate3&gt;</small>
								</div>

								<div class="form-group hide" id="cmd_opt_R">
									<label>Resample</label><br>
									<div class="form-check form-check-inline">
										<input class="form-check-input" type="radio" name="resample" id="resample_none"
											suffix="" checked aint="false">
										<label class="form-check-label" for="resampleNone">No resampling</label>
									</div>
									<div class="form-check form-check-inline">
										<input class="form-check-input" type="radio" name="resample" id="resample"
											suffix=' -R' aint="false">
										<label class="form-check-label" for="resampleNone">Default</label>
									</div>

									<div class="form-check form-check-inline">
										<input class="form-check-input" type="radio" name="resample" id="resample_b"
											suffix=' -R -u b' aint="true">
										<label class="form-check-label" for="resampleBasic">Basic linear
											interpolation</label>
									</div>
									<div class="form-check form-check-inline">
										<input class="form-check-input" type="radio" name="resample" id="resample_l"
											suffix=' -R -u l' aint="true">
										<label class="form-check-label" for="resample13Taps">13 taps</label>
									</div>
									<div class="form-check form-check-inline">
										<input class="form-check-input" type="radio" name="resample" id="resample_m"
											suffix=' -R -u m' aint="true">
										<label class="form-check-label" for="resample21Taps">21 taps</label>
									</div>
									<div class="form-check form-check-inline">
										<input class="form-check-input" type="checkbox" name="interpolate"
											id="resample_i" suffix=":i">
										<label class="form-check-label" for="interpolate">Interpolate filter
											coefficients</label>
									</div>
								</div>

								<div class="form-group"><label for="cmd_opt_Z">Report rate to server in helo as the
										maximum sample rate we can support</label><input type="text"
										class="form-control" placeholder="rate" id="cmd_opt_Z"></div>
								<div class="form-group">
									<div class="form-check">
										<label class="form-check-label">
											<input class="form-check-input" type="checkbox" id="cmd_opt_W" value=""
												checked="">
											Read wave and aiff format from header, ignore server parameters
										</label>
									</div>
								</div>
							</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 style="margin-top: 16px;">
								<div class="toast hide" role="alert" aria-live="assertive" aria-atomic="true"
									id="toast_cfg-audio-tmpl">
									<div class="toast-header"><strong class="mr-auto">Result</strong>
										<button type="button" class="btn-close" data-bs-dismiss="toast"
											aria-label="Close"></button>
									</div>
									<div class="toast-body" id="msg_cfg-audio-tmpl"></div>
								</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="btn-close" data-bs-dismiss="modal"
										aria-label="Close"></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-bs-dismiss="modal">Cancel</button>
									<button id="btn_disconnect" type="button" class="btn btn-warning"
										data-bs-dismiss="modal">Ok</button>
								</div>
							</div>
						</div>
					</div>
					<div class="modal" id="WifiConnectDialog" aria-hidden="true">
						<div class="modal-dialog ">
							<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="btn-close" data-bs-dismiss="modal"
										aria-label="Close"></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-bs-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-bs-dismiss="modal">Ok</button><button type="button" class="btn btn-danger"
										data-bs-toggle="modal" data-bs-dismiss="modal"
										data-bs-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>