diff --git a/index.js b/index.js index 9549e26..fa42e9c 100644 --- a/index.js +++ b/index.js @@ -59,6 +59,7 @@ app.get("/indexes/:project(\\w+)", (req, res) => { } }); app.use(express.urlencoded({ extended: false })); +app.use(express.text()); function diff(current, checked) { let lines_current = current.split('\n').map(l => l.trim()).filter(l => l != ""); @@ -113,7 +114,7 @@ function diff(current, checked) { app.post("/updates/:project(\\w+)", (req, res) => { let project_id = req.params['project']; - const body = String(Object.keys(req.body)[0]); + const body = typeof req.body == "string" ? req.body : (req.body.content || ""); // console.log(req.body); // console.log(`${req.body}, ${typeof req.body}`); // console.log(`${body}`); diff --git a/projects/updater/update.lua b/projects/updater/update.lua index fdafeca..5a31b0b 100644 --- a/projects/updater/update.lua +++ b/projects/updater/update.lua @@ -69,9 +69,11 @@ local function getAllFiles(program) print("#DEBUG currentFiles " .. currentFiles) - local updateResult = http.post(updateUrl, currentFiles, { - ["Content-Type"] = "text/plain", - ["Content-Length"] = #currentFiles + local updateResult = http.post(updateUrl, { + content = currentFiles + }, { + ["Content-Type"] = "text/plain", + ["Content-Length"] = #currentFiles }) if updateResult == nil then print("error! getting updates for " .. program)