diff --git a/lib/routes.js b/lib/routes.js index 8322809..6372370 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -71,54 +71,60 @@ const csrfField = (req) => { }; -const layout = (title, body, flash) => ` -
- -${escape(PLUGIN_NAME)} v${escape(PLUGIN_VERSION)}
`; const flashMsg = (req) => { const m = req.query.msg; const e = req.query.err; - if (m) return `| Env ID | ${escape(env ? env.env_id : "?")} |
|---|---|
| Label | ${env && env.env_label ? escape(env.env_label) : '(unset)'} |
| Destructive-op policy | ${escape(env ? env.on_destructive_op : "?")} |
| Pending conflicts | ${conflictCount > 0 ? `${escape(conflictCount)}` : "0"} |
| op_type | count |
|---|
| op_type | count |
|---|
| kind | count |
|---|
| kind | count |
|---|
Showing up to ${escape(limit)} ops${since ? `, since op ${escape(since.slice(0, 8))}` : ""}, offset ${escape(offset)}. Newest first. Revert appends a compensating op rather than rewriting history.
| op | op_type | entity | parent | status | created | actions | payload |
|---|
${prevLink} ${nextLink}
`; - res.type("text/html").send(layout("dev-deploy journal", body, flashMsg(req))); + res.sendWrap("dev-deploy journal", layout(req, body, flashMsg(req))); }; @@ -276,7 +282,7 @@ const peersView = async (req, res) => { const body = `This instance's env_id is ${escape(env ? env.env_id : "?")}. Paste this into the other instance's peer form.
| id | label | env_id | base_url | last seen | actions |
|---|
If this is a brand-new pairing, give the peer this side's env_id too.
`; - res.type("text/html").send(layout("Peer paired", body)); + res.sendWrap("Peer paired", layout(req, body)); } catch (err) { res.redirect("/admin/dev-deploy/peers?err=" + encodeURIComponent(err.message)); } @@ -346,7 +352,7 @@ const peersRotate = async (req, res) => {Paste this on the other side via Rotate or by re-pairing.
`; - res.type("text/html").send(layout("Secret rotated", body)); + res.sendWrap("Secret rotated", layout(req, body)); } catch (err) { res.redirect("/admin/dev-deploy/peers?err=" + encodeURIComponent(err.message)); } @@ -382,7 +388,7 @@ const planView = async (req, res) => { `; - res.type("text/html").send(layout("dev-deploy plan", body, flashMsg(req))); + res.sendWrap("dev-deploy plan", layout(req, body, flashMsg(req))); return; } const peerId = parseInt(peerIdRaw, 10); @@ -421,7 +427,7 @@ const planView = async (req, res) => {Anchor: ${anchor ? `${escape(anchor.last_op_id.slice(0, 8))}` : '(none — will send from epoch)'}
Ops that would be sent: ${escape(planRows.length)}
-| op | op_type | entity | status | created |
|---|
rejected. The local state stands. The peer may re-send the op on future syncs; subsequent pulls will skip it via idempotency.| Theirs | Mine | Action |
|---|
Entity: ${escape(diff.kind)} ${escape(diff.instance.name || diff.instance.role || diff.instance.id)} (local id ${escape(diff.instance.id)})
${escape(diff.reason || "no entity diff available")}
`; + : `${escape(diff.reason || "no entity diff available")}
`; let formBody; if (diffs.length === 0) { @@ -705,7 +711,7 @@ const conflictsMergeView = async (req, res) => { `).join(""); formBody = ` -| field | current (mine) | incoming (theirs) | resolution |
|---|
The Saltcorn users table is locked to user and cannot be changed.
| table | uuid | local id | data_mode | updated_at |
|---|