feat: http theme for webconsole

This commit is contained in:
Anonymous 2025-08-15 10:22:58 +07:00
parent f38612b8e9
commit d148dd0b5e
2 changed files with 17 additions and 0 deletions

View file

@ -167,6 +167,11 @@ namespace http {
{
std::string webroot; i2p::config::GetOption("http.webroot", webroot);
std::string theme; i2p::config::GetOption("http.theme", theme);
if(theme != "light" && theme != "black" ) theme = "light";
// Page language
std::string currLang = i2p::client::context.GetLanguage ()->GetLanguage(); // get current used language
auto it = i2p::i18n::languages.find(currLang);
@ -184,6 +189,17 @@ namespace http {
" <link rel=\"shortcut icon\" href=\"" << itoopieFavicon << "\">\r\n"
" <title>" << tr(/* tr: Webconsole page title */ "Purple I2P Webconsole") << "</title>\r\n";
GetStyles(s);
if (theme == "black")
{
s <<
"<style>:root {\r\n"
"--main-bg-color: #242424;\r\n"
"--main-text-color: #17ab5c;\r\n"
"--main-link-color: #bf64b7;\r\n"
"--main-link-hover-color: #000000;\r\n"
"}\r\n</style>";
}
s <<
"</head>\r\n"
"<body>\r\n"

View file

@ -97,6 +97,7 @@ namespace config {
("http.webroot", value<std::string>()->default_value("/"), "WebUI root path (default: / )")
("http.lang", value<std::string>()->default_value("english"), "WebUI language (default: english )")
("http.showTotalTCSR", value<bool>()->default_value(false), "Show additional value with total TCSR since router's start (default: false)")
("http.theme", value<std::string>()->default_value("light"), "Theme for http web console")
;
options_description httpproxy("HTTP Proxy options");