added update
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
e115578b57
commit
65b29b105f
7 files changed
+60
-1
No files matched your search
+1
-1
@@ -34,9 +34,9 @@ add_executable(
|
||||
src/settings/ftp/ftp.cpp
|
||||
|
||||
src/system/reboot/reboot.cpp
|
||||
|
||||
src/system/syslog/syslog.cpp
|
||||
src/system/uptime/uptime.cpp
|
||||
src/system/update/update.cpp
|
||||
|
||||
src/OpenRouter/OpenRouter.cpp
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ SOURCES=src/openrouter.cpp \
|
||||
src/system/reboot/reboot.cpp \
|
||||
src/system/syslog/syslog.cpp \
|
||||
src/system/uptime/uptime.cpp \
|
||||
src/system/update/update.cpp \
|
||||
src/OpenRouter/OpenRouter.cpp \
|
||||
src/auth/auth.cpp \
|
||||
src/libs/QR-Code-generator/qrcodegen.cpp \
|
||||
|
||||
@@ -31,6 +31,8 @@ executable(
|
||||
'src/system/reboot/reboot.cpp',
|
||||
'src/system/syslog/syslog.cpp',
|
||||
'src/system/uptime/uptime.cpp',
|
||||
'src/system/update/update.cpp',
|
||||
|
||||
'src/OpenRouter/OpenRouter.cpp',
|
||||
'src/auth/auth.cpp',
|
||||
'src/libs/QR-Code-generator/qrcodegen.cpp',
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <system/update/update.hpp>
|
||||
#include <types.hpp>
|
||||
|
||||
namespace api
|
||||
{
|
||||
namespace system
|
||||
{
|
||||
void upload(const httplib::Request& request, httplib::Response& response) {
|
||||
std::size_t size = request.files.size();
|
||||
std::cout << "file size::" << size << std::endl;
|
||||
bool ret = request.has_file("image");
|
||||
std::cout << "file ret::" << ret << std::endl;
|
||||
const httplib::MultipartFormData& file = request.get_file_value("restore_settings");
|
||||
std::ofstream tmp_image_file("/tmp/image");
|
||||
tmp_image_file << file.content;
|
||||
tmp_image_file.close();
|
||||
response.set_content(R"({"status":true})", JSON_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <httplib.h>
|
||||
|
||||
namespace api
|
||||
{
|
||||
namespace system
|
||||
{
|
||||
void upload(const httplib::Request& request, httplib::Response& response);
|
||||
// void update(const httplib::Request& request, httplib::Response& response);
|
||||
// void progress(const httplib::Request& request, httplib::Response& response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
.uploadprogress {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
<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>
|
||||
|
||||
@@ -208,6 +209,22 @@
|
||||
</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>
|
||||
</div>
|
||||
<button class="settingrectfooterbutton" id="update_image_button">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- update firmware -->
|
||||
</section>
|
||||
<!-- syslog block -->
|
||||
<section class="syslogsection">
|
||||
|
||||
Reference in new issue
Block a user