Commit afb00233 authored by jan.koester's avatar jan.koester
Browse files

test

parent 9261a912
Loading
Loading
Loading
Loading
+10 −1
Changes for plugins/staticpage/static.cpp: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -453,6 +453,8 @@ json_object* blogi::StaticPage::editPage(const int tid, libhttppp::HttpRequest&
                put_update("meta", enc.c_str());
            } else if (key == "text") {
                put_update("text", val.c_str());
            } else if (key == "llms_txt") {
                put_update("llms_txt", val.c_str());
            }
        }

@@ -472,7 +474,7 @@ json_object* blogi::StaticPage::editPage(const int tid, libhttppp::HttpRequest&
    }

    // --- 3) Re-load and Output JSON Form ---
    sql << "SELECT id,url,meta,text FROM static_content WHERE id='" << id.c_str() << "' LIMIT 1";
    sql << "SELECT id,url,meta,text,llms_txt FROM static_content WHERE id='" << id.c_str() << "' LIMIT 1";
    if (Args->database[tid]->exec(sql, res) < 1) return nullptr;

    json_object *jroot = json_object_new_object();
@@ -523,6 +525,13 @@ json_object* blogi::StaticPage::editPage(const int tid, libhttppp::HttpRequest&
    json_object_object_add(jfText, "value", json_object_new_string(res[0][3]));
    json_object_array_add(jfields, jfText);

    json_object *jfLlms = json_object_new_object();
    json_object_object_add(jfLlms, "name", json_object_new_string("llms_txt"));
    json_object_object_add(jfLlms, "label", json_object_new_string(tr(_lang,"llms.txt (plain text for AI crawlers)").c_str()));
    json_object_object_add(jfLlms, "type", json_object_new_string("textarea"));
    json_object_object_add(jfLlms, "value", json_object_new_string(res[0][4] ? res[0][4] : ""));
    json_object_array_add(jfields, jfLlms);

    json_object_object_add(jform, "fields", jfields);
    json_object_object_add(jform, "submit", json_object_new_string(tr(_lang,"Save").c_str()));
    json_object_object_add(jroot, "form", jform);