Add a 'starting up' install screen for when system isnt quite ready (#1555)

This commit is contained in:
Tim Wilkinson 2024-09-21 09:50:55 -07:00 committed by GitHub
parent 1fc7d82f55
commit 1525783d5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 77 additions and 10 deletions

View File

@ -0,0 +1,69 @@
{%
/*
* 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
*/
%}
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8">
<link href="/a/css/theme.css" rel="stylesheet">
<link href="/a/css/user.css" rel="stylesheet">
<link href="/a/css/admin.css" rel="stylesheet">
<meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no">
</head>
<body>
<div id="all">
<div class="firstuse">
<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>AREDN&reg; is starting up. Please wait ...</div>
</div>
</div>
</div>
</div>
<script>
(function(){
setTimeout(function() {
location.replace(location.origin);
}, 5000);
})();
</script>
</body>
</html>

View File

@ -36,16 +36,10 @@
import * as xuci from "uci";
if ((auth.isFirstUse || !config.authenable) && request.env.REQUEST_METHOD === "PUT") {
for (let i = 0; i < 10; i++) {
const mac2 = xuci.cursor("/etc/local/uci").get("hsmmmesh", "settings", "mac2");
if (match(mac2, /^\d+\.\d+\.\d+$/)) {
system(`/usr/local/bin/firstuse-setup '${request.args.name}' '${request.args.passwd}'`);
response.reboot = true;
print(_R("reboot-firstuse"));
return;
}
sleep(1000);
}
system(`/usr/local/bin/firstuse-setup '${request.args.name}' '${request.args.passwd}'`);
response.reboot = true;
print(_R("reboot-firstuse"));
return;
}
%}
<!DOCTYPE>

View File

@ -400,6 +400,10 @@ global.handle_request = function(env)
for (let l = f.read("line"); length(l); l = f.read("line")) {
if (index(l, "overlay") !== -1 || index(l, "ext4") !== -1) {
tpath = `${config.application}/main/firstuse.ut`;
const mac2 = uci.cursor("/etc/local/uci").get("hsmmmesh", "settings", "mac2");
if (!match(mac2, /^\d+\.\d+\.\d+$/)) {
tpath = `${config.application}/main/firstuse-start.ut`;
}
break;
}
}