upload testing
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run
This commit is contained in:
1 parent
65b29b105f
commit
dcc4f59552
8 files changed
+845
-357
No files matched your search
@@ -23,6 +23,7 @@ OpenRouter::OpenRouter()
|
||||
#ifdef __linux__
|
||||
this->srv.Get("/api/system/uptime", api::system::get_uptime);
|
||||
#endif // __linux__
|
||||
this->srv.Post("/api/system/upload", api::system::upload);
|
||||
|
||||
this->srv.Options("/(.*)", api::security::set_cors_headers);
|
||||
|
||||
|
||||
@@ -5,3 +5,4 @@
|
||||
#endif // __linux__
|
||||
#include <system/syslog/syslog.hpp>
|
||||
#include <system/reboot/reboot.hpp>
|
||||
#include <system/update/update.hpp>
|
||||
@@ -6,6 +6,7 @@
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
body {
|
||||
|
||||
+112
-1
@@ -1,6 +1,117 @@
|
||||
.uploadprogress {
|
||||
.progressbar {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: black;
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
.progressbar.hidden {
|
||||
height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bar {
|
||||
position: absolute;
|
||||
width: 50%;
|
||||
height: 20px;
|
||||
background-color: rgb(100, 100, 100);
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.percent {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.settingrectfooterbutton.hidden {
|
||||
width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hstack {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.hstack.hidden {
|
||||
height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.vstack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.vstack.hidden {
|
||||
height: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.checker {
|
||||
width: 45px;
|
||||
height: 15px;
|
||||
background-color: #8d9fa4;
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 5px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.checker.active {
|
||||
background-color: #93bc9a;
|
||||
}
|
||||
|
||||
.checker.hidden {
|
||||
height: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.checked {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
background: white;
|
||||
/* border: 1px solid; */
|
||||
border-radius: 25px;
|
||||
box-shadow: -1px -1px 5px black;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.checked.active {
|
||||
background-color: #5fac5a;
|
||||
box-shadow: -1px -1px 5px #5fac5a;
|
||||
transform: translateX(25px);
|
||||
}
|
||||
|
||||
.checked.hidden {
|
||||
height: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
+547
-285
@@ -1,304 +1,566 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="css/index.css" />
|
||||
<link rel="stylesheet" href="css/form.css" />
|
||||
<link rel="stylesheet" href="css/settings.css" />
|
||||
<link rel="stylesheet" href="css/notification.css" />
|
||||
<link rel="stylesheet" href="css/header.css" />
|
||||
<link rel="stylesheet" href="css/button.css" />
|
||||
<link rel="stylesheet" href="css/loader.css" />
|
||||
<link rel="stylesheet" href="css/syslog.css" />
|
||||
<link rel="stylesheet" href="css/info.css" />
|
||||
<link rel="stylesheet" href="css/update.css" />
|
||||
<title>Openrouter Admin</title>
|
||||
</head>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="css/index.css">
|
||||
<link rel="stylesheet" href="css/form.css">
|
||||
<link rel="stylesheet" href="css/settings.css">
|
||||
<link rel="stylesheet" href="css/notification.css">
|
||||
<link rel="stylesheet" href="css/header.css">
|
||||
<link rel="stylesheet" href="css/button.css">
|
||||
<link rel="stylesheet" href="css/loader.css">
|
||||
<link rel="stylesheet" href="css/syslog.css">
|
||||
<link rel="stylesheet" href="css/info.css">
|
||||
<link rel="stylesheet" href="css/update.css">
|
||||
<title>Openrouter Admin</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section class="adminpanel">
|
||||
<!-- header -->
|
||||
<header class="header">
|
||||
<button id="headermenubutton">▤</button>
|
||||
<div class="links">
|
||||
<button class="linkbutton" id="syslogbutton">Syslog</button>
|
||||
<button class="linkbutton" id="settingsbutton">Settings</button>
|
||||
<button class="linkbutton" id="infobutton">Info</button>
|
||||
<button class="linkbutton" id="rebootbutton">Reboot</button>
|
||||
</div>
|
||||
<h1><img id="openroutericon" src="favicon.ico" alt="icon">Openrouter Admin</h1>
|
||||
<div class="userbuttons">
|
||||
<h1 class="headerusername"></h1>
|
||||
<button class="exitbutton">Exit</button>
|
||||
</div>
|
||||
</header>
|
||||
<!-- header -->
|
||||
<!-- settings block -->
|
||||
<div class="section">
|
||||
<section class="settingssection">
|
||||
<!-- telnet settings -->
|
||||
<div class="settingrect ">
|
||||
<div class="settingrectheader">
|
||||
<h2>Telnet</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input type="checkbox" class="sc-gJwTLC ikxBAC" id="telnetenable">
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectbody telnetsettingbody">
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<label for="telnetportinput" class="forminputlabel">Port</label>
|
||||
<input type="text" id="telnetportinput" class="forminput">
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectfooter">
|
||||
<!-- <button class="settingrectfooterbutton hiddenbutton" id="add_telnet_user_button">Add telnet user</button> -->
|
||||
<button class="settingrectfooterbutton" id="set_telnet_settings">Confirm</button>
|
||||
</div>
|
||||
<body>
|
||||
<section class="adminpanel">
|
||||
<!-- header -->
|
||||
<header class="header">
|
||||
<button id="headermenubutton">▤</button>
|
||||
<div class="links">
|
||||
<button class="linkbutton" id="syslogbutton">Syslog</button>
|
||||
<button class="linkbutton" id="settingsbutton">
|
||||
Settings
|
||||
</button>
|
||||
<button class="linkbutton" id="infobutton">Info</button>
|
||||
<button class="linkbutton" id="rebootbutton">Reboot</button>
|
||||
</div>
|
||||
<!-- telnet settings -->
|
||||
<!-- DNS settings -->
|
||||
<div class="settingrect ">
|
||||
<div class="settingrectheader">
|
||||
<h2>DNS</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input type="checkbox" class="sc-gJwTLC ikxBAC" id="dnsenable">
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectbody" id="dnssettingsbody">
|
||||
<table class="dnsservers">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>DNS servers</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="dnsserverstablebody">
|
||||
</tbody>
|
||||
</table>
|
||||
<h3>Domains Table</h3>
|
||||
<table class="domains">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="three">IP</th>
|
||||
<th class="three">Domain</th>
|
||||
<!-- <th class="three">Del</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="domainsstablebody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="settingrectfooter">
|
||||
<button id="add_local_domain_button" class="hiddenbutton settingrectfooterbutton">Add Local
|
||||
Domain</button>
|
||||
<button id="add_dns_server_button" class="hiddenbutton settingrectfooterbutton">Add DNS
|
||||
server</button>
|
||||
<button class="settingrectfooterbutton" id="set_dns_settings">Confirm</button>
|
||||
</div>
|
||||
<h1>
|
||||
<img
|
||||
id="openroutericon"
|
||||
src="favicon.ico"
|
||||
alt="icon"
|
||||
/>Openrouter Admin
|
||||
</h1>
|
||||
<div class="userbuttons">
|
||||
<h1 class="headerusername"></h1>
|
||||
<button class="exitbutton">Exit</button>
|
||||
</div>
|
||||
<!-- DNS settings -->
|
||||
<!-- ftp settings -->
|
||||
<div class="settingrect ">
|
||||
<div class="settingrectheader">
|
||||
<h2>Ftp</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input type="checkbox" class="sc-gJwTLC ikxBAC" id="ftpenable">
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectfooter">
|
||||
<!-- <button>Add Ftp server</button> -->
|
||||
<button class="settingrectfooterbutton" id="set_ftp_settings">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ftp settings -->
|
||||
<!-- ssh settings -->
|
||||
<div class="settingrect ">
|
||||
<div class="settingrectheader">
|
||||
<h2>SSH</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input type="checkbox" class="sc-gJwTLC ikxBAC" id="sshenable">
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectbody" id="sshsettingsbody">
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<label for="sshserverinput" class="forminputlabel">Server</label>
|
||||
<select name="selectserver" id="sshserverinput">
|
||||
<option value="dropbear">dropbear</option>
|
||||
<option value="openssh">openssh</option>
|
||||
</select>
|
||||
<!-- <input type="text" id="sshserverinput" class="forminput"> -->
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<label for="sshportinput" class="forminputlabel">Port</label>
|
||||
<input type="text" id="sshportinput" class="forminput">
|
||||
</div>
|
||||
<table class="sshkeys">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>SSH keys</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sshkeystablebody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="settingrectfooter onebutton">
|
||||
<button id="add_ssh_key" class="hiddenbutton settingrectfooterbutton">Add SSH key</button>
|
||||
<button class="settingrectfooterbutton" id="set_ssh_settings">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ssh settings -->
|
||||
<!-- Wi-Fi settings -->
|
||||
<div class="settingrect ">
|
||||
<div class="settingrectheader">
|
||||
<h2>WIFI</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input type="checkbox" class="sc-gJwTLC ikxBAC" id="wifistatus">
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectbody" id="wifisettingsbody">
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<label for="SSID" class="forminputlabel">SSID</label>
|
||||
<input type="text" id="SSID" class="forminput">
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<label for="wifipassword" class="forminputlabel">Old password</label>
|
||||
<button id="showpasswordbutton">Show</button>
|
||||
<input type="password" id="wifipassword" class="forminput">
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<label for="newwifipassword" class="forminputlabel">New password</label>
|
||||
<button id="shownewpasswordbutton">Show</button>
|
||||
<input type="password" id="newwifipassword" class="forminput">
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<label for="wifichannel" class="forminputlabel">WIFI channel</label>
|
||||
<select id="wifichannel" class="forminput">
|
||||
<option class="channeloption" value="1" style="color: black">1</option>
|
||||
<option class="channeloption" value="6">6</option>
|
||||
<option class="channeloption" value="11">11</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<label for="wifiqr" class="forminputlabel">Show qr code</label>
|
||||
</header>
|
||||
<!-- header -->
|
||||
<!-- settings block -->
|
||||
<div class="section">
|
||||
<section class="settingssection">
|
||||
<!-- telnet settings -->
|
||||
<div class="settingrect">
|
||||
<div class="settingrectheader">
|
||||
<h2>Telnet</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input type="checkbox" class="sc-gJwTLC ikxBAC" id="wifiqr">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="sc-gJwTLC ikxBAC"
|
||||
id="telnetenable"
|
||||
/>
|
||||
</div>
|
||||
<div id="wifiqrimg"></div>
|
||||
</div>
|
||||
<div class="settingrectbody telnetsettingbody">
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<label
|
||||
for="telnetportinput"
|
||||
class="forminputlabel"
|
||||
>Port</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="telnetportinput"
|
||||
class="forminput"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectfooter">
|
||||
<!-- <button class="settingrectfooterbutton hiddenbutton" id="add_telnet_user_button">Add telnet user</button> -->
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="set_telnet_settings"
|
||||
>
|
||||
Confirm
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectfooter onebutton">
|
||||
<button class="settingrectfooterbutton" id="setwifisettings">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Wi-Fi settings -->
|
||||
<!-- backup settings -->
|
||||
<div class="settingrect ">
|
||||
<div class="settingrectheader">
|
||||
<h2>Backup settings</h2>
|
||||
</div>
|
||||
<div class="settingrectfooter" style="flex-direction: column;">
|
||||
<a id="backup_settings" class="settingrectfooterbutton" href="" download="backup_settings.json">
|
||||
<button class="settingrectfooterbutton">Backup settings</button>
|
||||
</a>
|
||||
<input type="file" name="" id="restore_settings_input" hidden>
|
||||
<button class="settingrectfooterbutton" id="restore_settings">Restore settings</button>
|
||||
<button class="settingrectfooterbutton" id="start_restore_settings">Start restore settings</button>
|
||||
<button class="settingrectfooterbutton" id="restore_default_settings">Rrestore default settings</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- backup settings -->
|
||||
<!-- update firmware -->
|
||||
<div class="settingrect ">
|
||||
<div class="settingrectheader">
|
||||
<h2>Update Firmware</h2>
|
||||
</div>
|
||||
<div class="settingrectfooter" style="flex-direction: column;">
|
||||
<input type="file" name="" id="upload_image_input" hidden>
|
||||
<button class="settingrectfooterbutton" id="upload_image_button">Update firmware</button>
|
||||
<div class="uploadprogress">
|
||||
<div class="uploadbar"></div>
|
||||
<div class="uploadpercent">Uploaded 50 %</div>
|
||||
<!-- telnet settings -->
|
||||
<!-- DNS settings -->
|
||||
<div class="settingrect">
|
||||
<div class="settingrectheader">
|
||||
<h2>DNS</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="sc-gJwTLC ikxBAC"
|
||||
id="dnsenable"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectbody" id="dnssettingsbody">
|
||||
<table class="dnsservers">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>DNS servers</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="dnsserverstablebody"></tbody>
|
||||
</table>
|
||||
<h3>Domains Table</h3>
|
||||
<table class="domains">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="three">IP</th>
|
||||
<th class="three">Domain</th>
|
||||
<!-- <th class="three">Del</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="domainsstablebody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="settingrectfooter">
|
||||
<button
|
||||
id="add_local_domain_button"
|
||||
class="hiddenbutton settingrectfooterbutton"
|
||||
>
|
||||
Add Local Domain
|
||||
</button>
|
||||
<button
|
||||
id="add_dns_server_button"
|
||||
class="hiddenbutton settingrectfooterbutton"
|
||||
>
|
||||
Add DNS server
|
||||
</button>
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="set_dns_settings"
|
||||
>
|
||||
Confirm
|
||||
</button>
|
||||
</div>
|
||||
<button class="settingrectfooterbutton" id="update_image_button">Update</button>
|
||||
</div>
|
||||
<!-- DNS settings -->
|
||||
<!-- ftp settings -->
|
||||
<div class="settingrect">
|
||||
<div class="settingrectheader">
|
||||
<h2>Ftp</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="sc-gJwTLC ikxBAC"
|
||||
id="ftpenable"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectfooter">
|
||||
<!-- <button>Add Ftp server</button> -->
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="set_ftp_settings"
|
||||
>
|
||||
Confirm
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ftp settings -->
|
||||
<!-- ssh settings -->
|
||||
<div class="settingrect">
|
||||
<div class="settingrectheader">
|
||||
<h2>SSH</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="sc-gJwTLC ikxBAC"
|
||||
id="sshenable"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectbody" id="sshsettingsbody">
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<label
|
||||
for="sshserverinput"
|
||||
class="forminputlabel"
|
||||
>Server</label
|
||||
>
|
||||
<select name="selectserver" id="sshserverinput">
|
||||
<option value="dropbear">dropbear</option>
|
||||
<option value="openssh">openssh</option>
|
||||
</select>
|
||||
<!-- <input type="text" id="sshserverinput" class="forminput"> -->
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<label for="sshportinput" class="forminputlabel"
|
||||
>Port</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="sshportinput"
|
||||
class="forminput"
|
||||
/>
|
||||
</div>
|
||||
<table class="sshkeys">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>SSH keys</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sshkeystablebody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="settingrectfooter onebutton">
|
||||
<button
|
||||
id="add_ssh_key"
|
||||
class="hiddenbutton settingrectfooterbutton"
|
||||
>
|
||||
Add SSH key
|
||||
</button>
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="set_ssh_settings"
|
||||
>
|
||||
Confirm
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ssh settings -->
|
||||
<!-- Wi-Fi settings -->
|
||||
<div class="settingrect">
|
||||
<div class="settingrectheader">
|
||||
<h2>WIFI</h2>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="sc-gJwTLC ikxBAC"
|
||||
id="wifistatus"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectbody" id="wifisettingsbody">
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<label for="SSID" class="forminputlabel"
|
||||
>SSID</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="SSID"
|
||||
class="forminput"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<label for="wifipassword" class="forminputlabel"
|
||||
>Old password</label
|
||||
>
|
||||
<button id="showpasswordbutton">Show</button>
|
||||
<input
|
||||
type="password"
|
||||
id="wifipassword"
|
||||
class="forminput"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<label
|
||||
for="newwifipassword"
|
||||
class="forminputlabel"
|
||||
>New password</label
|
||||
>
|
||||
<button id="shownewpasswordbutton">Show</button>
|
||||
<input
|
||||
type="password"
|
||||
id="newwifipassword"
|
||||
class="forminput"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<label for="wifichannel" class="forminputlabel"
|
||||
>WIFI channel</label
|
||||
>
|
||||
<select id="wifichannel" class="forminput">
|
||||
<option
|
||||
class="channeloption"
|
||||
value="1"
|
||||
style="color: black"
|
||||
>
|
||||
1
|
||||
</option>
|
||||
<option class="channeloption" value="6">
|
||||
6
|
||||
</option>
|
||||
<option class="channeloption" value="11">
|
||||
11
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<label for="wifiqr" class="forminputlabel"
|
||||
>Show qr code</label
|
||||
>
|
||||
<div class="checkbox-wrapper-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="sc-gJwTLC ikxBAC"
|
||||
id="wifiqr"
|
||||
/>
|
||||
</div>
|
||||
<div id="wifiqrimg"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settingrectfooter onebutton">
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="setwifisettings"
|
||||
>
|
||||
Confirm
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Wi-Fi settings -->
|
||||
<!-- backup settings -->
|
||||
<div class="settingrect">
|
||||
<div class="settingrectheader">
|
||||
<h2>Backup settings</h2>
|
||||
</div>
|
||||
<div
|
||||
class="settingrectfooter"
|
||||
style="flex-direction: column"
|
||||
>
|
||||
<a
|
||||
id="backup_settings"
|
||||
class="settingrectfooterbutton"
|
||||
href=""
|
||||
download="backup_settings.json"
|
||||
>
|
||||
<button class="settingrectfooterbutton">
|
||||
Backup settings
|
||||
</button>
|
||||
</a>
|
||||
<input
|
||||
type="file"
|
||||
name=""
|
||||
id="restore_settings_input"
|
||||
hidden
|
||||
/>
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="restore_settings"
|
||||
>
|
||||
Restore settings
|
||||
</button>
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="start_restore_settings"
|
||||
>
|
||||
Start restore settings
|
||||
</button>
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="restore_default_settings"
|
||||
>
|
||||
Rrestore default settings
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- backup settings -->
|
||||
<!-- update firmware -->
|
||||
<div class="settingrect">
|
||||
<div class="settingrectheader">
|
||||
<h2>Update Firmware</h2>
|
||||
</div>
|
||||
<div
|
||||
class="settingrectfooter"
|
||||
style="flex-direction: column"
|
||||
>
|
||||
<input
|
||||
type="file"
|
||||
name=""
|
||||
id="upload_image_input"
|
||||
hidden
|
||||
/>
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="upload_image_button"
|
||||
>
|
||||
Update firmware
|
||||
</button>
|
||||
<div class="progressbar hidden" id="uploadprogress">
|
||||
<div class="bar" id="uploadbar"></div>
|
||||
<div class="percent" id="uploadpercent">
|
||||
Uploaded 50 %
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="vstack hidden"
|
||||
style="width: 100%; gap: 10px; padding: 0"
|
||||
id="update_block"
|
||||
>
|
||||
<div
|
||||
class="hstack"
|
||||
style="
|
||||
justify-content: space-around;
|
||||
width: 100%;
|
||||
"
|
||||
>
|
||||
<label for="auto_reboot_flag">
|
||||
Reboot after update?
|
||||
</label>
|
||||
<div class="checker">
|
||||
<div class="checked"></div>
|
||||
</div>
|
||||
<div id="noyes">(No)</div>
|
||||
</div>
|
||||
<input
|
||||
id="auto_reboot_flag"
|
||||
type="checkbox"
|
||||
hidden
|
||||
/>
|
||||
<button
|
||||
class="settingrectfooterbutton"
|
||||
id="update_image_button"
|
||||
>
|
||||
Update
|
||||
</button>
|
||||
</div>
|
||||
<div class="progressbar hidden" id="updateprogress">
|
||||
<div class="bar" id="updatebar"></div>
|
||||
<div class="percent" id="updatepercent">
|
||||
Updated 50 %
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- update firmware -->
|
||||
</section>
|
||||
<!-- syslog block -->
|
||||
<section class="syslogsection">
|
||||
<div class="syslogheader">
|
||||
<h2 class="syslogheader">Syslog</h2>
|
||||
<button id="openrouterfilter">openrouter</button>
|
||||
<button id="authservicefilter">auth_service</button>
|
||||
<button id="refreshbutton">↺</button>
|
||||
<label for="realtimesyslog">Realtime</label>
|
||||
<input type="checkbox" id="realtimesyslog" />
|
||||
</div>
|
||||
<div class="syslogdata"></div>
|
||||
</section>
|
||||
<!-- syslog block -->
|
||||
<section class="infosection">
|
||||
<div class="inforect">
|
||||
<label for="infoversion">Version: </label>
|
||||
<p id="version">0.1.1</p>
|
||||
</div>
|
||||
<div class="inforect">
|
||||
<label for="infouptime">Uptime: </label>
|
||||
<p id="uptime"></p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<!-- settings block -->
|
||||
</section>
|
||||
|
||||
<!-- notification block -->
|
||||
<div class="notificationsection"></div>
|
||||
<!-- notification block -->
|
||||
<!-- login form -->
|
||||
<div class="form loginform">
|
||||
<form class="formbody loginformbody">
|
||||
<h1 class="formheader">OpenRouter Login</h1>
|
||||
<div class="forminputbody">
|
||||
<label for="loginusernameinput" class="forminputlabel"
|
||||
>Username</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
id="loginusernameinput"
|
||||
class="forminput"
|
||||
/>
|
||||
</div>
|
||||
<!-- update firmware -->
|
||||
</section>
|
||||
<!-- syslog block -->
|
||||
<section class="syslogsection">
|
||||
<div class="syslogheader">
|
||||
<h2 class="syslogheader">Syslog</h2>
|
||||
<button id="openrouterfilter">openrouter</button>
|
||||
<button id="authservicefilter">auth_service</button>
|
||||
<button id="refreshbutton">↺</button>
|
||||
<label for="realtimesyslog">Realtime</label>
|
||||
<input type="checkbox" id="realtimesyslog">
|
||||
<div class="forminputbody">
|
||||
<label for="loginpasswordinput" class="forminputlabel"
|
||||
>Username</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
required
|
||||
id="loginpasswordinput"
|
||||
class="forminput"
|
||||
/>
|
||||
</div>
|
||||
<div class="syslogdata"></div>
|
||||
</section>
|
||||
<!-- syslog block -->
|
||||
<section class="infosection">
|
||||
<div class="inforect">
|
||||
<label for="infoversion">Version: </label>
|
||||
<p id="version">0.1.1</p>
|
||||
<div class="forminputbody">
|
||||
<button class="formbutton">Login</button>
|
||||
</div>
|
||||
<div class="inforect">
|
||||
<label for="infouptime">Uptime: </label>
|
||||
<p id="uptime"></p>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
<!-- settings block -->
|
||||
</section>
|
||||
|
||||
<!-- notification block -->
|
||||
<div class="notificationsection"></div>
|
||||
<!-- notification block -->
|
||||
<!-- login form -->
|
||||
<div class="form loginform">
|
||||
<form class="formbody loginformbody">
|
||||
<h1 class="formheader">OpenRouter Login</h1>
|
||||
<div class="forminputbody">
|
||||
<label for="loginusernameinput" class="forminputlabel">Username</label>
|
||||
<input type="text" required id="loginusernameinput" class="forminput">
|
||||
<!-- login form -->
|
||||
<!-- loader -->
|
||||
<div class="loader">
|
||||
<h1 id="loaderheader">Reboting</h1>
|
||||
<div class="loadertip">
|
||||
<div class="progress"></div>
|
||||
</div>
|
||||
<div class="forminputbody">
|
||||
<label for="loginpasswordinput" class="forminputlabel">Username</label>
|
||||
<input type="password" required id="loginpasswordinput" class="forminput">
|
||||
</div>
|
||||
<div class="forminputbody">
|
||||
<button class="formbutton">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- login form -->
|
||||
<!-- loader -->
|
||||
<div class="loader">
|
||||
<h1 id="loaderheader">Reboting</h1>
|
||||
<div class="loadertip">
|
||||
<div class="progress"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- loader -->
|
||||
<script src="js/header.js"></script>
|
||||
<script src="js/routes.js"></script>
|
||||
<script src="js/notification.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
<!-- loader -->
|
||||
<script src="js/header.js"></script>
|
||||
<script src="js/routes.js"></script>
|
||||
<script src="js/notification.js"></script>
|
||||
<script src="js/loader.js"></script>
|
||||
|
||||
<script src="js/settings/settings.js"></script>
|
||||
<script src="js/settings/telnet.js"></script>
|
||||
<script src="js/settings/dns.js"></script>
|
||||
<script src="js/settings/ftp.js"></script>
|
||||
<script src="js/settings/ssh.js"></script>
|
||||
<script src="js/settings/wifi.js"></script>
|
||||
<script src="js/settings/backup.js"></script>
|
||||
|
||||
<script src="js/reboot.js"></script>
|
||||
<script src="js/syslog.js"></script>
|
||||
<script src="js/info/uptime.js"></script>
|
||||
<script src="js/login.js"></script>
|
||||
</body>
|
||||
<script src="js/settings/settings.js"></script>
|
||||
<script src="js/settings/telnet.js"></script>
|
||||
<script src="js/settings/dns.js"></script>
|
||||
<script src="js/settings/ftp.js"></script>
|
||||
<script src="js/settings/ssh.js"></script>
|
||||
<script src="js/settings/wifi.js"></script>
|
||||
<script src="js/settings/backup.js"></script>
|
||||
|
||||
<script src="js/reboot.js"></script>
|
||||
<script src="js/syslog.js"></script>
|
||||
<script src="js/info/uptime.js"></script>
|
||||
<script src="js/update.js"></script>
|
||||
<script src="js/login.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+73
-56
@@ -1,79 +1,96 @@
|
||||
const loginform = document.querySelector('.loginform')
|
||||
const loginformbody = document.querySelector('.loginformbody')
|
||||
const loginusername = document.querySelector("#loginusernameinput")
|
||||
const loginpassword = document.querySelector("#loginpasswordinput")
|
||||
const exitbutton = document.querySelector('.exitbutton')
|
||||
const adminpanelsection = document.querySelector('.adminpanel')
|
||||
const headerusername = document.querySelector('.headerusername')
|
||||
const loginform = document.querySelector(".loginform");
|
||||
const loginformbody = document.querySelector(".loginformbody");
|
||||
const loginusername = document.querySelector("#loginusernameinput");
|
||||
const loginpassword = document.querySelector("#loginpasswordinput");
|
||||
const exitbutton = document.querySelector(".exitbutton");
|
||||
const adminpanelsection = document.querySelector(".adminpanel");
|
||||
const headerusername = document.querySelector(".headerusername");
|
||||
|
||||
const hashPassword = async (password) => {
|
||||
const encoder = new TextEncoder()
|
||||
const data = encoder.encode(password)
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data)
|
||||
const hashArray = Array.from(new Uint8Array(hashBuffer))
|
||||
const hashHex = hashArray.map(b=>('00' + b.toString(16)).slice(-2)).join('')
|
||||
return hashHex
|
||||
}
|
||||
const encoder = new TextEncoder();
|
||||
const data = encoder.encode(password);
|
||||
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
||||
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
||||
const hashHex = hashArray
|
||||
.map((b) => ("00" + b.toString(16)).slice(-2))
|
||||
.join("");
|
||||
return hashHex;
|
||||
};
|
||||
|
||||
if (localStorage.getItem("token") === null) {
|
||||
adminpanelsection.classList.remove('active')
|
||||
loginform.classList.add('active')
|
||||
adminpanelsection.classList.remove("active");
|
||||
loginform.classList.add("active");
|
||||
} else {
|
||||
adminpanelsection.classList.add('active')
|
||||
infosection.classList.add('active')
|
||||
headerusername.innerHTML = JSON.parse(localStorage.getItem('userdata')).username
|
||||
adminpanelsection.classList.add("active");
|
||||
infosection.classList.add("active");
|
||||
headerusername.innerHTML = JSON.parse(
|
||||
localStorage.getItem("userdata"),
|
||||
).username;
|
||||
}
|
||||
|
||||
loginformbody.addEventListener('submit', (e) => {
|
||||
e.preventDefault()
|
||||
hashPassword(loginpassword.value).then(hashedpassword => {
|
||||
login(loginusername.value, hashedpassword)
|
||||
})
|
||||
})
|
||||
loginformbody.addEventListener("submit", (e) => {
|
||||
e.preventDefault();
|
||||
hashPassword(loginpassword.value).then((hashedpassword) => {
|
||||
login(loginusername.value, hashedpassword);
|
||||
});
|
||||
});
|
||||
|
||||
const login = async (username, password) => {
|
||||
const response = await fetch(routes.login(), {
|
||||
method: 'POST',
|
||||
body: `{"username":"${username}","password":"${password}"}`
|
||||
}).then(data => data.json()).then(jsondata => jsondata).catch((error) => {
|
||||
if (error.message === "Unexpected end of JSON input") {
|
||||
notification(`Ошибка на сервере: Создайте файл users.json и запишите в него первого пользователя`, "error")
|
||||
} else {
|
||||
notification(`Ошибка на сервере: ${error}`, "error")
|
||||
}
|
||||
method: "POST",
|
||||
body: `{"username":"${username}","password":"${password}"}`,
|
||||
})
|
||||
.then((data) => data.json())
|
||||
.then((jsondata) => jsondata)
|
||||
.catch((error) => {
|
||||
if (error.message === "Unexpected end of JSON input") {
|
||||
notification(
|
||||
`Ошибка на сервере: Создайте файл users.json и запишите в него первого пользователя`,
|
||||
"error",
|
||||
);
|
||||
} else {
|
||||
notification(`Ошибка на сервере: ${error}`, "error");
|
||||
}
|
||||
});
|
||||
if (response.status === "403") {
|
||||
notification("Неправильный логин или пароль", "error")
|
||||
notification("Неправильный логин или пароль", "error");
|
||||
}
|
||||
if (response.token) {
|
||||
notification("Успешно", "success")
|
||||
loginform.classList.remove("active")
|
||||
localStorage.setItem("token", response.token)
|
||||
await get_all_settings()
|
||||
adminpanelsection.classList.add('active')
|
||||
await get_user_data()
|
||||
loginusername.value = ""
|
||||
loginpassword.value = ""
|
||||
settingssection.classList.add('active')
|
||||
notification("Успешно", "success");
|
||||
loginform.classList.remove("active");
|
||||
localStorage.setItem("token", response.token);
|
||||
await get_all_settings();
|
||||
adminpanelsection.classList.add("active");
|
||||
await get_user_data();
|
||||
loginusername.value = "";
|
||||
loginpassword.value = "";
|
||||
settingssection.classList.add("active");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const get_user_data = async () => {
|
||||
const response = await fetch(routes.user(), {
|
||||
method: "POST",
|
||||
body: `{"token":"${localStorage.getItem("token")}"}`
|
||||
}).then(data => data.json()).then(jsondata => jsondata).catch((error) => {
|
||||
notification(`Ошибка на сервере: ${error}`, "error")
|
||||
body: `{"token":"${localStorage.getItem("token")}"}`,
|
||||
})
|
||||
.then((data) => data.json())
|
||||
.then((jsondata) => jsondata)
|
||||
.catch((error) => {
|
||||
notification(`Ошибка на сервере: ${error}`, "error");
|
||||
});
|
||||
if (response.id) {
|
||||
headerusername.innerHTML = response.username
|
||||
localStorage.setItem("userdata", JSON.stringify(response))
|
||||
headerusername.innerHTML = response.username;
|
||||
localStorage.setItem("userdata", JSON.stringify(response));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exitbutton.addEventListener('click', () => {
|
||||
localStorage.clear()
|
||||
loginform.classList.add('active')
|
||||
notification('Вы вышли', "success")
|
||||
adminpanelsection.classList.remove('active')
|
||||
})
|
||||
const logout = () => {
|
||||
localStorage.clear();
|
||||
loginform.classList.add("active");
|
||||
notification("Вы вышли", "success");
|
||||
adminpanelsection.classList.remove("active");
|
||||
};
|
||||
|
||||
exitbutton.addEventListener("click", () => {
|
||||
logout();
|
||||
});
|
||||
+22
-15
@@ -1,20 +1,27 @@
|
||||
const host = window.location.origin
|
||||
const prefix = 'api'
|
||||
const host = window.location.origin;
|
||||
const prefix = "api";
|
||||
|
||||
const routes = {
|
||||
login: () => ["http://localhost:43243", prefix, 'token'].join('/'),
|
||||
user: () => ["http://localhost:43243", prefix, 'users', 'user'].join('/'),
|
||||
login: () => ["http://localhost:43243", prefix, "token"].join("/"),
|
||||
user: () => ["http://localhost:43243", prefix, "users", "user"].join("/"),
|
||||
|
||||
wifi_password_set: () => [host, prefix, 'settings', 'wifi', 'password', 'set'].join('/'),
|
||||
wifi_qr_get: () => [host, prefix, 'settings', 'wifi', 'qr', 'get'].join('/'),
|
||||
wifi_password_set: () =>
|
||||
[host, prefix, "settings", "wifi", "password", "set"].join("/"),
|
||||
wifi_qr_get: () =>
|
||||
[host, prefix, "settings", "wifi", "qr", "get"].join("/"),
|
||||
|
||||
settings_get: () => [host, prefix, 'settings', 'get'].join('/'),
|
||||
settings_set: () => [host, prefix, 'settings', 'set'].join('/'),
|
||||
settings_backup: () => [host, prefix, 'settings', 'backup'].join('/'),
|
||||
settings_restore: () => [host, prefix, 'settings', 'restore'].join('/'),
|
||||
restore_defaults: () => [host, prefix, 'settings', 'restore', 'defaults'].join('/'),
|
||||
settings_get: () => [host, prefix, "settings", "get"].join("/"),
|
||||
settings_set: () => [host, prefix, "settings", "set"].join("/"),
|
||||
settings_backup: () => [host, prefix, "settings", "backup"].join("/"),
|
||||
settings_restore: () => [host, prefix, "settings", "restore"].join("/"),
|
||||
restore_defaults: () =>
|
||||
[host, prefix, "settings", "restore", "defaults"].join("/"),
|
||||
|
||||
reboot: () => [host, prefix, 'system', 'reboot'].join('/'),
|
||||
syslog: () => [host, prefix, 'system', 'syslog'].join('/'),
|
||||
uptime: () => [host, prefix, 'system', 'uptime'].join('/'),
|
||||
}
|
||||
reboot: () => [host, prefix, "system", "reboot"].join("/"),
|
||||
syslog: () => [host, prefix, "system", "syslog"].join("/"),
|
||||
uptime: () => [host, prefix, "system", "uptime"].join("/"),
|
||||
|
||||
upload_image: () => [host, prefix, "system", "upload"].join("/"),
|
||||
update_image: () => [host, prefix, "system", "update"].join("/"),
|
||||
update_progress: () => [host, prefix, "system", "progress"].join("/"),
|
||||
};
|
||||
@@ -0,0 +1,88 @@
|
||||
const checker = document.querySelector(".checker");
|
||||
const checked = document.querySelector(".checked");
|
||||
const noyes = document.querySelector("#noyes");
|
||||
const auto_reboot_flag = document.querySelector("#auto_reboot_flag");
|
||||
|
||||
const upload_image_button = document.querySelector("#upload_image_button");
|
||||
const upload_image_input = document.querySelector("#upload_image_input");
|
||||
const update_block = document.querySelector("#update_block");
|
||||
const uploadprogress_block = document.querySelector("#uploadprogress");
|
||||
const upload_progress_bar = document.querySelector("#uploadbar");
|
||||
const upload_percents = document.querySelector("#uploadpercent");
|
||||
|
||||
const update_image_button = document.querySelector("#update_image_button");
|
||||
const updateprogress = document.querySelector("#updateprogress");
|
||||
|
||||
checker.addEventListener("click", () => {
|
||||
auto_reboot_flag.checked = !auto_reboot_flag.checked;
|
||||
if (auto_reboot_flag.checked) {
|
||||
checker.classList.add("active");
|
||||
checked.classList.add("active");
|
||||
noyes.innerHTML = "(Yes)";
|
||||
} else {
|
||||
checked.classList.remove("active");
|
||||
checker.classList.remove("active");
|
||||
noyes.innerHTML = "(No)";
|
||||
}
|
||||
});
|
||||
|
||||
upload_image_button.addEventListener("click", () => {
|
||||
upload_image_input.click();
|
||||
update_block.classList.remove("hidden");
|
||||
uploadprogress.classList.remove("hidden");
|
||||
});
|
||||
|
||||
update_image_button.addEventListener("click", () => {
|
||||
updateprogress.classList.remove("hidden");
|
||||
});
|
||||
|
||||
const upload_firmware_image = async () => {
|
||||
upload_percents.innerHTML = "Upload progress 0 %";
|
||||
upload_progress_bar.style.width = "0%";
|
||||
uploadprogress_block.classList.remove("hidden");
|
||||
let image = update_firmware_input.files[0];
|
||||
let formData = new FormData();
|
||||
formData.append(image.name, image);
|
||||
var request = new XMLHttpRequest();
|
||||
request.upload.addEventListener("progress", (e) => {
|
||||
var file1Size = image.size;
|
||||
if (e.loaded <= file1Size) {
|
||||
var percent = Math.round((e.loaded / file1Size) * 100);
|
||||
upload_progress_bar.style.width = `${percent}%`;
|
||||
upload_percents.innerHTML = `Upload progress ${percent} %`;
|
||||
}
|
||||
|
||||
if (e.loaded == e.total) {
|
||||
upload_progress_bar.style.width = "100%";
|
||||
upload_percents.innerHTML = "Upload progress 100 %";
|
||||
}
|
||||
});
|
||||
request.onreadystatechange = () => {
|
||||
if (request.readyState === 4) {
|
||||
let jsondata = JSON.parse(request.responseText);
|
||||
if (jsondata.success) {
|
||||
image_table_body.innerHTML = `
|
||||
<td><b>${jsondata.response.file.name}<b/></td>
|
||||
<td>${(jsondata.response.file.size / 1024 / 1024).toFixed(2)}MB</td>
|
||||
<td>${jsondata.response.cpu}</td>
|
||||
<td>${jsondata.response.deviceName}</td>
|
||||
<td>${jsondata.response.version}</td>
|
||||
`;
|
||||
image_table.classList.remove("hidden-table");
|
||||
start_update_button.classList.remove("hidden-button");
|
||||
}
|
||||
}
|
||||
};
|
||||
request.open(
|
||||
"post",
|
||||
window.location.origin + "/wimic/updatefirmware/upload",
|
||||
);
|
||||
request.timeout = 45000;
|
||||
request.send(formData);
|
||||
};
|
||||
|
||||
upload_image_input.addEventListener("change", (event) => {
|
||||
if (event.target.files[0]) {
|
||||
upload_firmware_image();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user