From 95ae5336d32655422f94f0a63defd794b73ee2d6 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Fri, 15 Aug 2025 19:19:31 +0700 Subject: [PATCH] feat: custom CSS themes --- contrib/webconsole/style.css | 2 +- daemon/HTTPServer.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/contrib/webconsole/style.css b/contrib/webconsole/style.css index 89021539..ea8ffd4f 100644 --- a/contrib/webconsole/style.css +++ b/contrib/webconsole/style.css @@ -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 * diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 61bd2229..18fecce7 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -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); + } + + }