Commit 466d7b7f authored by jan.koester's avatar jan.koester
Browse files

test

parent ae0ac298
Loading
Loading
Loading
Loading
+2 −0
Changes for config.yaml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ BLOGI:
      CLIENTNAME: "blogiclient"
      CLIENTSECRET: "clientsecret"
      DOMAIN: "example.com"
  MEDIADB:
    URL: "https://127.0.0.1:8442"
  NGINXFILER:
    HOST: "nginx.example.com"
    PORT: 80
+2 −0
Changes for docker-config.yaml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ BLOGI:
  DATABASE:
    DRIVER: "%DBDRIVER%"
    CONNECTION: "%DBOPTIONS%"
  MEDIADB:
    URL: "%MEDIADBURL%"
  TMPDIR: "%TMPDIR%"
  COOKIE:
    DOMAIN: "%COOKIEDOMAIN%"
+9 −19
Changes for plugins/media/media.cpp: 9 added lines, 19 removed lines.
Original line number Diff line number Diff line
@@ -423,10 +423,7 @@ namespace blogi {
            form.parse(req);

            for(const auto &cur : form.urlData()){
                if(cur.key=="mediadb_url"){
                    setConfig(*Args->database[tid],"MEDIADB_URL",cur.value);
                    saved = true;
                }else if(cur.key=="action"){
                if(cur.key=="action"){
                    action = cur.value;
                }else if(cur.key=="store_name"){
                    newStoreName = cur.value;
@@ -442,9 +439,7 @@ namespace blogi {
            }

            if(saved){
                try { getConfig(*Args->database[tid],"MEDIADB_URL",_mdbUrl); } catch(...) {}
                _mdbStoreIds.clear();
                _mdbHttpUrl = std::make_unique<libhttppp::HttpUrl>(_mdbUrl);
                for(auto &c : _mdb) c.reset();
            }

@@ -491,7 +486,13 @@ namespace blogi {
            json_object_object_add(jtable, "rows", jrows);
            json_object_object_add(jroot, "table", jtable);

            // Combined form: URL config + add store
            // Display MediaDB URL (read-only, from node config)
            json_object *jinfo = json_object_new_object();
            json_object_object_add(jinfo, "label", json_object_new_string(tr(_lang,"MediaDB URL").c_str()));
            json_object_object_add(jinfo, "value", json_object_new_string(_mdbUrl.c_str()));
            json_object_object_add(jroot, "info", jinfo);

            // Combined form: add store
            json_object *jform = json_object_new_object();
            json_object_object_add(jform, "method", json_object_new_string("POST"));
            json_object_object_add(jform, "action", json_object_new_string(
@@ -499,13 +500,6 @@ namespace blogi {

            json_object *jfields = json_object_new_array();

            json_object *jfUrl = json_object_new_object();
            json_object_object_add(jfUrl, "name", json_object_new_string("mediadb_url"));
            json_object_object_add(jfUrl, "label", json_object_new_string(tr(_lang,"MediaDB URL").c_str()));
            json_object_object_add(jfUrl, "type", json_object_new_string("text"));
            json_object_object_add(jfUrl, "value", json_object_new_string(_mdbUrl.c_str()));
            json_object_array_add(jfields, jfUrl);

            json_object *jfAction = json_object_new_object();
            json_object_object_add(jfAction, "name", json_object_new_string("action"));
            json_object_object_add(jfAction, "type", json_object_new_string("hidden"));
@@ -842,11 +836,7 @@ namespace blogi {
        }

        void initPlugin(){
            std::string mdbUrl;
            try { getConfig(*Args->database[0],"MEDIADB_URL",mdbUrl); } catch(...) {}
            if(mdbUrl.empty())
                mdbUrl = "https://127.0.0.1:8442";
            _mdbUrl = mdbUrl;
            _mdbUrl = Args->config->getMediaDBUrl();

            _loadStores(0);

+15 −0
Changes for src/blogi.cpp: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -604,6 +604,21 @@ static void renderSettingsJson(json_object *jroot, libhtmlpp::HtmlString &out, c
        out << "</table>";
    }

    // Info display (read-only key/value)
    json_object *jinfo = nullptr;
    if(json_object_object_get_ex(jroot, "info", &jinfo)){
        json_object *jilabel=nullptr, *jivalue=nullptr;
        json_object_object_get_ex(jinfo, "label", &jilabel);
        json_object_object_get_ex(jinfo, "value", &jivalue);
        out << "<div class=\"set-field\">";
        if(jilabel)
            out << "<label class=\"set-label\">" << json_object_get_string(jilabel) << "</label>";
        if(jivalue)
            out << "<span class=\"set-input\" style=\"background:transparent;border:1px solid var(--blogi-border,#3a3f44);padding:6px 10px;border-radius:4px;color:var(--blogi-text-muted,#aaa);\">"
                << json_object_get_string(jivalue) << "</span>";
        out << "</div>";
    }

    // Confirm dialog
    json_object *jconfirm = nullptr;
    if(json_object_object_get_ex(jroot, "confirm", &jconfirm)){
+10 −0
Changes for src/conf.cpp: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -106,6 +106,12 @@ blogi::Config::Config(const std::string &path) : confplus::Config(path){
    }catch(...){
        _TmpDir="/tmp/blogi";
    }

    try{
        _MediaDBUrl=getValue(getKey("/BLOGI/MEDIADB/URL"),0);
    }catch(...){
        _MediaDBUrl="https://127.0.0.1:8442";
    }
}

blogi::Config::~Config(){
@@ -198,6 +204,10 @@ const std::string & blogi::Config::getTmpDir() const{
    return _TmpDir;
}

const std::string & blogi::Config::getMediaDBUrl() const{
    return _MediaDBUrl;
}

size_t blogi::Config::getAuthSourceCount() const {
    return _AuthSources.size();
}
Loading