mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-08-26 08:41:50 +00:00
feat: custom CSS themes
This commit is contained in:
parent
d148dd0b5e
commit
95ae5336d3
@ -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
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
|
@ -42,10 +42,10 @@
|
|||||||
|
|
||||||
namespace i2p {
|
namespace i2p {
|
||||||
namespace http {
|
namespace http {
|
||||||
static void LoadExtCSS ()
|
static void LoadExtCSS (std::string fileName = "style.css")
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
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)) {
|
if (i2p::fs::Exists(styleFile)) {
|
||||||
std::ifstream f(styleFile, std::ifstream::binary);
|
std::ifstream f(styleFile, std::ifstream::binary);
|
||||||
s << f.rdbuf();
|
s << f.rdbuf();
|
||||||
@ -168,7 +168,15 @@ namespace http {
|
|||||||
std::string webroot; i2p::config::GetOption("http.webroot", webroot);
|
std::string webroot; i2p::config::GetOption("http.webroot", webroot);
|
||||||
|
|
||||||
std::string theme; i2p::config::GetOption("http.theme", theme);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user