1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-08-26 12:51:54 +00:00

feat: custom CSS themes

This commit is contained in:
Anonymous 2025-08-15 19:19:31 +07:00
parent d148dd0b5e
commit 95ae5336d3
2 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023, The PurpleI2P Project
* Copyright (c) 2021-2025, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*

View File

@ -42,10 +42,10 @@
namespace i2p {
namespace http {
static void LoadExtCSS ()
static void LoadExtCSS (std::string fileName = "style.css")
{
std::stringstream s;
std::string styleFile = i2p::fs::DataDirPath ("webconsole/style.css");
std::string styleFile = i2p::fs::DataDirPath ("webconsole/"+fileName+".css");
if (i2p::fs::Exists(styleFile)) {
std::ifstream f(styleFile, std::ifstream::binary);
s << f.rdbuf();
@ -168,7 +168,15 @@ 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";
if(theme != "light" && theme != "black" )
{
if (theme =="white") {
theme = "light";
} else {
LoadExtCSS(theme);
}
}