aredn/files/app/main/firstuse-ram.ut

105 lines
3.9 KiB
Plaintext
Executable File

{%
/*
* Part of AREDN® -- Used for creating Amateur Radio Emergency Data Networks
* Copyright (C) 2024 Tim Wilkinson
* See Contributors file for additional contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms:
*
* Additional use restrictions exist on the AREDN® trademark and logo.
* See AREDNLicense.txt for more info.
*
* Attributions to the AREDN® Project must be retained in the source code.
* If importing this code into a new or existing project attribution
* to the AREDN® project must be added to the source code.
*
* You must not misrepresent the origin of the material contained within.
*
* Modified versions must be modified to attribute to the original source
* and be marked in reasonable ways as differentiate it from the original
* version
*/
%}
{%
if (request.env.REQUEST_METHOD === "POST") {
print(_R("reboot-firstuse-ram"));
response.upgrade = `/usr/local/bin/aredn_sysupgrade -n -q ${request.args.firmwarefile}`;
return;
}
%}
<!DOCTYPE>
<html>
<head>
<link href="/a/css/theme.css" rel="stylesheet">
<link href="/a/css/user.css" rel="stylesheet">
<link href="/a/css/admin.css" rel="stylesheet">
<script src="/a/js/htmx.min.js"></script>
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no">
</head>
<body>
<div id="all">
<div class="firstuse ram">
<div>
<div id="icon-logo""></div>
<div></div>
<div>AREDN<span>TM</span></div>
<div>Amateur Radio Emergency Data Network</div>
</div>
<div>
<div>Welcome</div>
<div>
<div>Congratulations on booting AREDN&reg;</div>
<div>AREDN&reg; is currently running in RAM. The next step is to install AREDN&reg; into Flash.</div>
<div>Download the <b>sysupgrade.bin</b> file for this device (it should be at the same place your found this
<b>kernel.bin</b> file) and upload it using the file selector below</div>
</div>
<div>
<div class="cols">
<div>Select Firmware File</div>
<div><input type="file" name="firmware" accept=".bin"></div>
</div>
<div class="cols">
<div></div>
<div><button disabled hx-trigger="none" hx-encoding="multipart/form-data">Upload &amp; Reboot</button></div>
</div>
</div>
</div>
</div>
</div>
<script>
(function(){
htmx.on("input[name=firmware]", "change", _ => {
if (htmx.find("input[name=firmware]").files[0]) {
htmx.find("button").disabled = false;
}
else {
htmx.find("button").disabled = true;
}
});
htmx.on("button", "click", e => {
htmx.find("button").disabled = true;
htmx.ajax("POST", "{{request.env.REQUEST_URI}}", {
source: e.currentTarget,
values: {
firmwarefile: htmx.find("input[name=firmware]").files[0],
},
swap: "none"
});
});
})();
</script>
</body>
</html>