Commit 07276f4b authored by jan.koester's avatar jan.koester
Browse files

wokr work

parent ace75558
Loading
Loading
Loading
Loading
+5
Changes for CMakeSettings.json: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,11 @@
                    "name": "smtpclient_DIR",
                    "value": "C:/Users/jan.koester/source/repos/CPP-SMTPClient-library/out/install/x64-Debug/lib/cmake/smtpclient",
                    "type": "PATH"
                },
                {
                    "name": "Hiredis_DIR",
                    "value": "C:/Users/jan.koester/source/repos/hiredis/out/install/x64-Debug/share/hiredis",
                    "type": "PATH"
                }
            ]
        }
−137

File deleted.

+1 −1
Changes for plugins/media/CMakeLists.txt: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ target_include_directories(media PUBLIC
)

if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
    target_link_libraries(media PUBLIC uuidp::uuidp kernel32.lib blogidev ${Hiredis_LIBRARIES})
    target_link_libraries(media PUBLIC uuidp::uuidp kernel32.lib blogidev hiredis::hiredis ${Hiredis_LIBRARIES})
else()
    target_link_libraries(media PUBLIC uuidp::uuidp dl blogidev ${Hiredis_LIBRARIES})
endif()
+18 −5
Changes for src/theme.cpp: 18 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -56,9 +56,10 @@ blogi::Theme::Theme(blogi::ThemeConfig& config,bool formated){
#ifdef Windows
    // Construct the path using std::filesystem::path, which handles separators portably
    
    _Config.Theme += "/public";
    std::string ppath(_Config.Theme);
    ppath+="\\public";

    std::filesystem::path public_path = std::filesystem::path(_Config.Theme);
    std::filesystem::path public_path = std::filesystem::path(ppath);

    // Check if the directory exists before attempting to iterate
    if (std::filesystem::exists(public_path) && std::filesystem::is_directory(public_path)) {
@@ -189,18 +190,26 @@ blogi::Theme::~Theme(){

void blogi::Theme::renderPage(const int tid,const char *name,libhtmlpp::HtmlPage& page, libhtmlpp::HtmlElement &index){
    std::string htmlfile=_Config.Theme;
#ifdef Windows
    htmlfile.append("\\");
#else
    htmlfile.append("/");
#endif // Windows
    htmlfile.append(name);

    std::ifstream fhfile(htmlfile);
    std::fstream fhfile(htmlfile);
    std::vector<char> temp,data;

    if (fhfile.is_open()) {
        while ( fhfile.good() ){
            temp.push_back(fhfile.get());
        char ch;
        // The loop continues as long as a character can be successfully read.
        while (fhfile.get(ch)) {
            temp.push_back(ch);
        }
        fhfile.close();
    } else {
        // Handle error, e.g., print to console
        std::cerr << "Error: Could not open file " << htmlfile << std::endl;
        return;
    }

@@ -208,6 +217,10 @@ void blogi::Theme::renderPage(const int tid,const char *name,libhtmlpp::HtmlPage

    do{
        pos=std::find(epos, temp.end(),'$');
        if (pos==temp.end()){
			std::copy(epos, temp.end(), std::inserter<std::vector<char>>(data, data.end()));
            break;
        }
        std::copy(epos,pos,std::inserter<std::vector<char>>(data,data.end()));
        std::copy(_Config.config->getprefix(),_Config.config->getprefix()+strlen(_Config.config->getprefix()),
                  std::inserter<std::vector<char>>(data,data.end()));