chore: incidental working-tree changes (not from the versioning work)

Changes already present in the working tree at the time of the versioning
commit, committed here so nothing is left dangling:

- index.js: template PUT preserves the untouched field (?? existing) and the
  preview handler tolerates a null/empty test_object
- update-deployed.sh: detect and restart a pm2-managed app process, and don't
  hard-fail when no bare Node process is found

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-08-03 00:27:31 -04:00
parent 42f4aacf7c
commit 5bf756833d
2 changed files with 44 additions and 27 deletions

View file

@ -606,14 +606,13 @@ app.post("/workshop/:structure_id/template", (req, res) => {
});
app.put("/workshop/:structure_id/template/:template_id", (req, res) => {
let id = req.params.template_id;
let content = req.body.content;
let test_object = req.body.test_object;
const id = req.params.template_id;
const template = model.getTemplate(id);
model.updateTemplate({
...model.getTemplate(id),
content,
test_object,
...template,
content: req.body.content ?? template.content,
test_object: req.body.test_object ?? template.test_object,
});
return res.send("good");
@ -632,9 +631,12 @@ app.get("/workshop/:structure_id/template/:template_id/preview", (req, res) => {
const template = model.getTemplate(req.params.template_id);
const struct = model.getStructure(req.params.structure_id);
const context = vm.createContext({ it: null });
vm.runInContext(template.test_object, context);
const context = vm.createContext({ it: {} });
if (template.test_object) {
vm.runInContext(template.test_object, context);
}
context.it ??= {};
context.it.route = makeRoute(struct);
return res.send(