Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ own.
- **A page change that cannot reach PasarGuard or Rebecca changes nothing.**
Regenerating the page (a rebrand, a design switch, an update) replaced
`sub.html` before copying it into the panel; if that copy failed, `sub.html`
was left newer than the page the panel serves. It is now put back.
was left newer than the page the panel serves. It is now put back, and on a
first activation, where there was no `sub.html` before, none is left behind.
- **A valid page is never refused under load.** The structural check before
every install, update and design switch read the page through
`head | grep -q`. On a busy server `grep -q` could stop reading before `head`
Expand Down Expand Up @@ -125,6 +126,12 @@ own.
minimum-supported and detected versions.
- `row-template uninstall` returns each panel to the page it had before
Row-Template, and leaves a page you chose afterwards alone.
- **A scripted fresh install on a server with more than one supported panel
needs `RT_PANEL`.** 1.2 installed for 3X-UI there because it was the only
panel it supported; 1.3.0 does not guess which panel you meant, and stops
with a message naming `RT_PANEL=3xui|pasarguard|rebecca`. An interactive
install asks instead. Re-running the installer on an existing install, and
`row-template update`, keep the install's own panel and are unaffected.
- The `on_hold` state on PasarGuard and Rebecca is shown as active: with its
"starts on first connection" duration on PasarGuard, and with an unknown
expiry on Rebecca, which does not give the page that duration
Expand Down
5 changes: 4 additions & 1 deletion installer/lib/row-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2201,8 +2201,9 @@ rt_activate() {
# fails puts the previous sub.html back before returning: the contract above
# holds for every panel, and a caller that reports "nothing was changed" is
# telling the truth.
local staged dir panel prev="" rc=0
local staged dir panel prev="" had_live=0 rc=0
dir="$(dirname "$RT_LIVE")"
[ -f "$RT_LIVE" ] && had_live=1
panel="$(rt_panel_current)"
if [ "$panel" != "3xui" ]; then
rt_installer_complete || { rt_err "the installer's panel components are missing; run 'row-template update'."; return 1; }
Expand All @@ -2223,6 +2224,8 @@ rt_activate() {
if [ -n "$prev" ]; then
rt_atomic_install "$prev" "$RT_LIVE" 644 \
|| rt_err "could not put the previous page back at $RT_LIVE."
elif [ "$had_live" -eq 0 ]; then
rm -f -- "$RT_LIVE" # there was none before: leave none behind
fi
rm -f "$prev"
rt_err "could not update the page in $(rt_panel_label "$panel")'s template directory."
Expand Down
11 changes: 11 additions & 0 deletions tests/installer-panel-rebecca.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,17 @@ test('a failed panel refresh leaves sub.html and the placed page exactly as they
assert.match(r.out, /^0$/m, 'no temporary copy is left behind');
assert.ok(readFileSync(placed).equals(beforePlaced), 'the page Rebecca serves never changed');
});
/* ...and when there was no sub.html before, none is left behind (raised in
the second review of PR #6). */
withHost({}, ({ run }) => {
const r = run([SETUP,
'rm -f "$RT_LIVE"',
'rt_panel_refresh_page() { return 1; }',
'rc=0; rt_activate 2>/dev/null || rc=$?; echo "rc=$rc"',
'[ -e "$RT_LIVE" ] && echo "live-left-behind" || echo "live-absent"']);
assert.match(r.out, /rc=1/);
assert.match(r.out, /live-absent/, 'a failed first activation leaves no sub.html');
});
});

/* --- manual activation --------------------------------------------------------- */
Expand Down