i fucking hate old computercraft

This commit is contained in:
jane 2021-06-06 02:18:34 -04:00
parent 7aaeb91add
commit aed5b034a9
2 changed files with 7 additions and 4 deletions

View file

@ -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}`);

View file

@ -69,7 +69,9 @@ local function getAllFiles(program)
print("#DEBUG currentFiles " .. currentFiles)
local updateResult = http.post(updateUrl, currentFiles, {
local updateResult = http.post(updateUrl, {
content = currentFiles
}, {
["Content-Type"] = "text/plain",
["Content-Length"] = #currentFiles
})