Loading client/CMakeLists.txt +2 −0 Changes for client/CMakeLists.txt: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ qt_add_executable(blogi-editor main.cpp documentmanager.cpp documentmanager.h edit.cpp edit.h publishclient.cpp publishclient.h localapi.cpp Loading src/edit.cpp→client/edit.cpp +0 −0 File moved. View file src/edit.h→client/edit.h +0 −0 File moved. View file src/CMakeLists.txt +0 −1 Changes for src/CMakeLists.txt: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ add_library(blogidev STATIC theme.cpp cookie.cpp mail.cpp edit.cpp ) target_include_directories(blogidev PRIVATE ${SMTPCLIENT_INCLUDE_DIR}) Loading src/blogi.cpp +32 −28 Changes for src/blogi.cpp: 32 added lines, 28 removed lines. Original line number Diff line number Diff line Loading @@ -67,8 +67,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "blogi.h" #include "compress.h" #include "edit.h" #define cookieid "2d1b0348-1491-11f0-8c81-3cecefce9ac2" #define MAX_RETRIES 5 Loading Loading @@ -99,10 +97,6 @@ static std::string cookieDomain(libhttppp::HttpRequest &req) { std::unique_ptr<blogi::Config> blogi::Blogi::Cfg; namespace blogi { std::unique_ptr<webedit::WebEditor> testedit; }; blogi::Blogi::Blogi(std::vector<netplus::socket*> serversocket,bool debug) : HttpEvent(serversocket){ PlgArgs = std::make_unique<PluginArgs>(); PlgArgs->debug=debug; Loading @@ -110,8 +104,6 @@ blogi::Blogi::Blogi(std::vector<netplus::socket*> serversocket,bool debug) : Htt std::cerr << "Initializing Blogi with DB Driver: " << Blogi::Cfg->getdbdriver() << " on " << Blogi::Cfg->getdbopts() << std::endl; testedit=std::make_unique<webedit::WebEditor>(*PlgArgs); try{ for (int i = 0; i < threads; i++) { PlgArgs->database.emplace_back( Loading Loading @@ -155,15 +147,6 @@ blogi::Blogi::Blogi(std::vector<netplus::socket*> serversocket,bool debug) : Htt return; } try{ testedit->initTables(*initdb); }catch(std::runtime_error &e){ std::cerr << "WebEditor table init failed: " << e.what() << std::endl; return; } testedit->registerEditorGPOs(); PlgArgs->smtp=std::make_unique<SmtpSettings>(); try{ Loading Loading @@ -349,7 +332,6 @@ void blogi::Blogi::api(libhttppp::HttpRequest& curreq, const int tid){ // 4. Process commands in external modules/plugins (Only if authentication succeeded) if(asuccess){ testedit->JsonApi(tid,jrequest,jresponse,BlogiPlg.get()); } // 5. Send JSON Response Loading Loading @@ -2035,15 +2017,6 @@ RETRY_REQUEST: }else if(curreq.getRequestURL().compare(0,PlgArgs->config->buildurl("sitemap.xml").length(),PlgArgs->config->buildurl("sitemap.xml"))==0){ sitemapXML(curreq,tid,sessid); return; }else if(curreq.getRequestURL().compare(0,PlgArgs->config->buildurl("editor").length(),PlgArgs->config->buildurl("editor"))==0){ std::string sessionid; if(!PlgArgs->auth->isLoggedIn(tid,curreq,sessionid)){ libhttppp::HTTPException err; err[libhttppp::HTTPException::Error] << "you are not logged in permission denied"; throw err; } testedit->Editor(curreq,tid,sessid); return; }else if(curreq.getRequestURL().compare(0,PlgArgs->config->buildurl("render").length(),PlgArgs->config->buildurl("render"))==0){ libhttppp::HttpForm renderopts; Loading Loading @@ -2101,7 +2074,38 @@ RETRY_REQUEST: curplg->getInstace()->Rendering(tid,curreq,&index,RenderingType::Desktop); } testedit->Renderer(curreq,tid,sessid,index,BlogiPlg.get(),publishTarget,publishParams,html); { libhtmlpp::HtmlString out; libhtmlpp::HtmlElement *root = index.getElementbyID("main"); if(root && !html.empty()){ libhtmlpp::HtmlString htmlStr; htmlStr << html.c_str(); root->appendChild(htmlStr.parse()); } // If publish preview requested, wrap through the target plugin if (!publishTarget.empty() && BlogiPlg && root) { libhtmlpp::HtmlString rootHtml; libhtmlpp::print(*root, rootHtml); std::string renderedHtml = rootHtml.str(); for (const Plugin::PluginData *curplg = BlogiPlg->getFirstPlugin(); curplg; curplg = curplg->getNextPlg()) { PluginApi *api = curplg->getInstace(); if (api && api->canPublish() && api->getName() == publishTarget) { api->RenderPublished(tid, renderedHtml, publishParams, index); break; } } } PlgArgs->theme->printSite(tid,out,&index,curreq.getRequestURL(),false); libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setContentType("text/html"); curres.send(curreq,out.data(),out.length()); } if(publishParams) json_object_put(publishParams); return; Loading Loading
client/CMakeLists.txt +2 −0 Changes for client/CMakeLists.txt: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -11,6 +11,8 @@ qt_add_executable(blogi-editor main.cpp documentmanager.cpp documentmanager.h edit.cpp edit.h publishclient.cpp publishclient.h localapi.cpp Loading
src/CMakeLists.txt +0 −1 Changes for src/CMakeLists.txt: 0 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ add_library(blogidev STATIC theme.cpp cookie.cpp mail.cpp edit.cpp ) target_include_directories(blogidev PRIVATE ${SMTPCLIENT_INCLUDE_DIR}) Loading
src/blogi.cpp +32 −28 Changes for src/blogi.cpp: 32 added lines, 28 removed lines. Original line number Diff line number Diff line Loading @@ -67,8 +67,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "blogi.h" #include "compress.h" #include "edit.h" #define cookieid "2d1b0348-1491-11f0-8c81-3cecefce9ac2" #define MAX_RETRIES 5 Loading Loading @@ -99,10 +97,6 @@ static std::string cookieDomain(libhttppp::HttpRequest &req) { std::unique_ptr<blogi::Config> blogi::Blogi::Cfg; namespace blogi { std::unique_ptr<webedit::WebEditor> testedit; }; blogi::Blogi::Blogi(std::vector<netplus::socket*> serversocket,bool debug) : HttpEvent(serversocket){ PlgArgs = std::make_unique<PluginArgs>(); PlgArgs->debug=debug; Loading @@ -110,8 +104,6 @@ blogi::Blogi::Blogi(std::vector<netplus::socket*> serversocket,bool debug) : Htt std::cerr << "Initializing Blogi with DB Driver: " << Blogi::Cfg->getdbdriver() << " on " << Blogi::Cfg->getdbopts() << std::endl; testedit=std::make_unique<webedit::WebEditor>(*PlgArgs); try{ for (int i = 0; i < threads; i++) { PlgArgs->database.emplace_back( Loading Loading @@ -155,15 +147,6 @@ blogi::Blogi::Blogi(std::vector<netplus::socket*> serversocket,bool debug) : Htt return; } try{ testedit->initTables(*initdb); }catch(std::runtime_error &e){ std::cerr << "WebEditor table init failed: " << e.what() << std::endl; return; } testedit->registerEditorGPOs(); PlgArgs->smtp=std::make_unique<SmtpSettings>(); try{ Loading Loading @@ -349,7 +332,6 @@ void blogi::Blogi::api(libhttppp::HttpRequest& curreq, const int tid){ // 4. Process commands in external modules/plugins (Only if authentication succeeded) if(asuccess){ testedit->JsonApi(tid,jrequest,jresponse,BlogiPlg.get()); } // 5. Send JSON Response Loading Loading @@ -2035,15 +2017,6 @@ RETRY_REQUEST: }else if(curreq.getRequestURL().compare(0,PlgArgs->config->buildurl("sitemap.xml").length(),PlgArgs->config->buildurl("sitemap.xml"))==0){ sitemapXML(curreq,tid,sessid); return; }else if(curreq.getRequestURL().compare(0,PlgArgs->config->buildurl("editor").length(),PlgArgs->config->buildurl("editor"))==0){ std::string sessionid; if(!PlgArgs->auth->isLoggedIn(tid,curreq,sessionid)){ libhttppp::HTTPException err; err[libhttppp::HTTPException::Error] << "you are not logged in permission denied"; throw err; } testedit->Editor(curreq,tid,sessid); return; }else if(curreq.getRequestURL().compare(0,PlgArgs->config->buildurl("render").length(),PlgArgs->config->buildurl("render"))==0){ libhttppp::HttpForm renderopts; Loading Loading @@ -2101,7 +2074,38 @@ RETRY_REQUEST: curplg->getInstace()->Rendering(tid,curreq,&index,RenderingType::Desktop); } testedit->Renderer(curreq,tid,sessid,index,BlogiPlg.get(),publishTarget,publishParams,html); { libhtmlpp::HtmlString out; libhtmlpp::HtmlElement *root = index.getElementbyID("main"); if(root && !html.empty()){ libhtmlpp::HtmlString htmlStr; htmlStr << html.c_str(); root->appendChild(htmlStr.parse()); } // If publish preview requested, wrap through the target plugin if (!publishTarget.empty() && BlogiPlg && root) { libhtmlpp::HtmlString rootHtml; libhtmlpp::print(*root, rootHtml); std::string renderedHtml = rootHtml.str(); for (const Plugin::PluginData *curplg = BlogiPlg->getFirstPlugin(); curplg; curplg = curplg->getNextPlg()) { PluginApi *api = curplg->getInstace(); if (api && api->canPublish() && api->getName() == publishTarget) { api->RenderPublished(tid, renderedHtml, publishParams, index); break; } } } PlgArgs->theme->printSite(tid,out,&index,curreq.getRequestURL(),false); libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setContentType("text/html"); curres.send(curreq,out.data(),out.length()); } if(publishParams) json_object_put(publishParams); return; Loading