Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 2h59m32s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 2h58m10s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 2h58m12s
190 lines
5.6 KiB
C++
190 lines
5.6 KiB
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <httplib.h>
|
|
#include <colors.h>
|
|
|
|
#include <web/index.html.h>
|
|
#include <web/Default_router_web_inerface_icon_with_wifi_icon_3.jpg.h>
|
|
#include <web/favicon.ico.h>
|
|
|
|
#include <web/css/bootstrap.min.css.h>
|
|
#include <web/css/form.css.h>
|
|
#include <web/css/index.css.h>
|
|
#include <web/css/info.css.h>
|
|
#include <web/css/notification.css.h>
|
|
#include <web/css/syslog.css.h>
|
|
#include <web/css/settings.css.h>
|
|
#include <web/css/update.css.h>
|
|
|
|
#include <web/js/bootstrap.min.js.h>
|
|
#include <web/js/header.js.h>
|
|
#include <web/js/login.js.h>
|
|
#include <web/js/notification.js.h>
|
|
#include <web/js/reboot.js.h>
|
|
#include <web/js/routes.js.h>
|
|
#include <web/js/syslog.js.h>
|
|
#include <web/js/theme.js.h>
|
|
#include <web/js/update.js.h>
|
|
|
|
#include <web/js/info/uptime.js.h>
|
|
|
|
#include <web/js/settings/backup.js.h>
|
|
#include <web/js/settings/dns.js.h>
|
|
#include <web/js/settings/ftp.js.h>
|
|
#include <web/js/settings/settings.js.h>
|
|
#include <web/js/settings/ssh.js.h>
|
|
#include <web/js/settings/telnet.js.h>
|
|
#include <web/js/settings/wifi.js.h>
|
|
|
|
enum {
|
|
INDEX_HTML,
|
|
DEFAULT_ROUTER_WEB_INERFACE_ICON_WITH_WIFI_ICON_3,
|
|
FAVICON,
|
|
BOOTSTRAP_MIN_CSS,
|
|
FORM_CSS,
|
|
INDEX_CSS,
|
|
INFO_CSS,
|
|
NOTIFICATION_CSS,
|
|
SETTINGS_CSS,
|
|
SYSLOG_CSS,
|
|
UPDATE_CSS,
|
|
BOOTSTRAP_MIN_JS,
|
|
HEADER_JS,
|
|
LOGIN_JS,
|
|
NOTIFICATION_JS,
|
|
REBOOT_JS,
|
|
ROUTES_JS,
|
|
SYSLOG_JS,
|
|
THEME_JS,
|
|
UPDATE_JS,
|
|
UPTIME_JS,
|
|
BACKUP_JS,
|
|
DNS_JS,
|
|
FTP_JS,
|
|
SETTINGS_JS,
|
|
SSH_JS,
|
|
TELNET_JS,
|
|
WIFI_JS
|
|
};
|
|
|
|
static std::map <std::string, int> staticfilemap{
|
|
{"/", INDEX_HTML},
|
|
{"/css/index.css", INDEX_CSS},
|
|
{"/css/form.css", FORM_CSS},
|
|
{"/css/settings.css", SETTINGS_CSS},
|
|
{"/css/notifications.css", NOTIFICATION_CSS},
|
|
{"/css/syslog.css", SYSLOG_CSS},
|
|
{"/css/info.css", INFO_CSS},
|
|
{"/css/update.css", UPDATE_CSS},
|
|
{"/css/bootstrap.min.css", BOOTSTRAP_MIN_CSS},
|
|
{"/js/header.js", HEADER_JS},
|
|
{"/js/routes.js", ROUTES_JS},
|
|
{"/js/notification.js", NOTIFICATION_JS},
|
|
{"/js/settings/settings.js", SETTINGS_JS},
|
|
{"/js/settings/telnet.js", TELNET_JS},
|
|
{"/js/settings/dns.js", DNS_JS},
|
|
{"/js/settings/ftp.js", FTP_JS},
|
|
{"/js/settings/ssh.js", SSH_JS},
|
|
{"/js/settings/wifi.js", WIFI_JS},
|
|
{"/js/settings/backup.js", BACKUP_JS},
|
|
{"/js/reboot.js", REBOOT_JS},
|
|
{"/js/syslog.js", SYSLOG_JS},
|
|
{"/js/info/uptime.js", UPTIME_JS},
|
|
{"/js/update.js", UPDATE_JS},
|
|
{"/js/login.js", LOGIN_JS},
|
|
{"/js/bootstrap.min.js", BOOTSTRAP_MIN_JS},
|
|
{"/js/theme.js", THEME_JS},
|
|
{"/favicon.ico", FAVICON}
|
|
};
|
|
|
|
inline void static_file(const httplib::Request& request, httplib::Response& response) {
|
|
std::cout << GREEN << request.path << RESET << " " << request.method << std::endl;
|
|
switch (staticfilemap[request.path]) {
|
|
case INDEX_HTML:
|
|
response.set_content((char*)index_html, "text/html");
|
|
break;
|
|
case INDEX_CSS:
|
|
response.set_content((char*)index_css, "text/css");
|
|
break;
|
|
case FORM_CSS:
|
|
response.set_content((char*)form_css, "text/css");
|
|
break;
|
|
case SETTINGS_CSS:
|
|
response.set_content((char*)settings_css, "text/css");
|
|
break;
|
|
case NOTIFICATION_CSS:
|
|
response.set_content((char*)notification_css, "text/css");
|
|
break;
|
|
case SYSLOG_CSS:
|
|
response.set_content((char*)syslog_css, "text/css");
|
|
break;
|
|
case INFO_CSS:
|
|
response.set_content((char*)info_css, "text/css");
|
|
break;
|
|
case UPDATE_CSS:
|
|
response.set_content((char*)update_css, "text/css");
|
|
break;
|
|
case BOOTSTRAP_MIN_CSS:
|
|
response.set_content((char*)bootstrap_min_css, "text/css");
|
|
break;
|
|
case HEADER_JS:
|
|
response.set_content((char*)header_js, "text/js");
|
|
break;
|
|
case ROUTES_JS:
|
|
response.set_content((char*)routes_js, "text/js");
|
|
break;
|
|
case NOTIFICATION_JS:
|
|
response.set_content((char*)notification_js, "text/js");
|
|
break;
|
|
case SETTINGS_JS:
|
|
response.set_content((char*)settings_js, "text/js");
|
|
break;
|
|
case TELNET_JS:
|
|
response.set_content((char*)telnet_js, "text/js");
|
|
break;
|
|
case DNS_JS:
|
|
response.set_content((char*)dns_js, "text/js");
|
|
break;
|
|
case FTP_JS:
|
|
response.set_content((char*)ftp_js, "text/js");
|
|
break;
|
|
case SSH_JS:
|
|
response.set_content((char*)ssh_js, "text/js");
|
|
break;
|
|
case WIFI_JS:
|
|
response.set_content((char*)wifi_js, "text/js");
|
|
break;
|
|
case BACKUP_JS:
|
|
response.set_content((char*)backup_js, "text/js");
|
|
break;
|
|
case REBOOT_JS:
|
|
response.set_content((char*)reboot_js, "text/js");
|
|
break;
|
|
case SYSLOG_JS:
|
|
response.set_content((char*)syslog_js, "text/js");
|
|
break;
|
|
case UPTIME_JS:
|
|
response.set_content((char*)uptime_js, "text/js");
|
|
break;
|
|
case UPDATE_JS:
|
|
response.set_content((char*)update_js, "text/js");
|
|
break;
|
|
case LOGIN_JS:
|
|
response.set_content((char*)login_js, "text/js");
|
|
break;
|
|
case BOOTSTRAP_MIN_JS:
|
|
response.set_content((char*)bootstrap_min_js, "text/js");
|
|
break;
|
|
case THEME_JS:
|
|
response.set_content((char*)theme_js, "text/js");
|
|
break;
|
|
case DEFAULT_ROUTER_WEB_INERFACE_ICON_WITH_WIFI_ICON_3:
|
|
response.set_content((char*)Default_router_web_inerface_icon_with_wifi_icon_3_jpg, "text/js");
|
|
break;
|
|
case FAVICON:
|
|
response.set_content((char*)favicon_ico, "text/js");
|
|
break;
|
|
}
|
|
}
|