Loading editor/src/webedit_api.cpp +42 −35 Original line number Diff line number Diff line Loading @@ -2057,8 +2057,10 @@ void webedit::Api::handlePasteElement(libhttppp::HttpRequest &curreq, void webedit::Api::handleSaveDocument(libhttppp::HttpRequest &curreq, const std::string &sessionid) { json_object *req = nullptr; try { std::string body = getRequestBody(curreq); json_object *req = json_tokener_parse(body.c_str()); req = json_tokener_parse(body.c_str()); json_object *nameObj = nullptr, *groupObj = nullptr; if (req) { Loading Loading @@ -2099,6 +2101,11 @@ void webedit::Api::handleSaveDocument(libhttppp::HttpRequest &curreq, sendJson(curreq, resp); json_object_put(resp); if (req) json_object_put(req); } catch (const std::exception &e) { std::cerr << "[webedit] handleSaveDocument failed: " << e.what() << std::endl; if (req) json_object_put(req); sendJsonError(curreq, 500, std::string("Save failed: ") + e.what()); } } void webedit::Api::handleTemplateBulkGenerate(libhttppp::HttpRequest &curreq, Loading editor/src/webedit_db.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,22 @@ void webedit::Database::initTables() { << ");"; _db->exec(sql, res); // Schema migrations — add columns introduced after initial release. // ALTER TABLE ADD COLUMN fails if the column already exists; swallow those errors. auto tryAlter = [&](const std::string &stmt) { try { sql.clear(); res.clear(); sql << stmt; _db->exec(sql, res); } catch (...) {} }; tryAlter("ALTER TABLE documents ADD COLUMN group_name varchar(255) NOT NULL DEFAULT ''"); tryAlter("ALTER TABLE documents ADD COLUMN domain varchar(255) NOT NULL DEFAULT ''"); tryAlter("ALTER TABLE connections ADD COLUMN group_name varchar(255) DEFAULT ''"); tryAlter("ALTER TABLE connections ADD COLUMN ignore_ssl integer DEFAULT 0"); tryAlter("ALTER TABLE document_revisions ADD COLUMN author varchar(255) DEFAULT ''"); } std::string webedit::Database::getOption(const std::string &key, Loading Loading
editor/src/webedit_api.cpp +42 −35 Original line number Diff line number Diff line Loading @@ -2057,8 +2057,10 @@ void webedit::Api::handlePasteElement(libhttppp::HttpRequest &curreq, void webedit::Api::handleSaveDocument(libhttppp::HttpRequest &curreq, const std::string &sessionid) { json_object *req = nullptr; try { std::string body = getRequestBody(curreq); json_object *req = json_tokener_parse(body.c_str()); req = json_tokener_parse(body.c_str()); json_object *nameObj = nullptr, *groupObj = nullptr; if (req) { Loading Loading @@ -2099,6 +2101,11 @@ void webedit::Api::handleSaveDocument(libhttppp::HttpRequest &curreq, sendJson(curreq, resp); json_object_put(resp); if (req) json_object_put(req); } catch (const std::exception &e) { std::cerr << "[webedit] handleSaveDocument failed: " << e.what() << std::endl; if (req) json_object_put(req); sendJsonError(curreq, 500, std::string("Save failed: ") + e.what()); } } void webedit::Api::handleTemplateBulkGenerate(libhttppp::HttpRequest &curreq, Loading
editor/src/webedit_db.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,22 @@ void webedit::Database::initTables() { << ");"; _db->exec(sql, res); // Schema migrations — add columns introduced after initial release. // ALTER TABLE ADD COLUMN fails if the column already exists; swallow those errors. auto tryAlter = [&](const std::string &stmt) { try { sql.clear(); res.clear(); sql << stmt; _db->exec(sql, res); } catch (...) {} }; tryAlter("ALTER TABLE documents ADD COLUMN group_name varchar(255) NOT NULL DEFAULT ''"); tryAlter("ALTER TABLE documents ADD COLUMN domain varchar(255) NOT NULL DEFAULT ''"); tryAlter("ALTER TABLE connections ADD COLUMN group_name varchar(255) DEFAULT ''"); tryAlter("ALTER TABLE connections ADD COLUMN ignore_ssl integer DEFAULT 0"); tryAlter("ALTER TABLE document_revisions ADD COLUMN author varchar(255) DEFAULT ''"); } std::string webedit::Database::getOption(const std::string &key, Loading