Skip the key step when SSH already works, and read the install path live on both sides

This commit is contained in:
Gmer4Lfe
2026-08-17 07:04:46 -04:00
parent 7e7d845f61
commit d8e3c09b57
4 changed files with 60 additions and 33 deletions
+13 -32
View File
@@ -72,6 +72,18 @@ if ($vvMasterRaw !== '' && $detectedHostname !== '') {
if ($vvDetected['role'] === 'partner') $vvDetected['primary'] = $vvSlots['host1'] ?? '';
}
// ── How far this host's own onboarding has got ───────────────────────────────────────────────
// Lets the inline join panel show the SSH step or the join button rather than both. Same flags
// api/checklist.php reads, and the same two spellings, because the state file has been written
// by both bash and PHP over its life.
if ($vvDetected['slot'] !== '') {
$vvSt = vv_setup_state_read();
$vvSlUp = strtoupper($vvDetected['slot']);
$vvDetected['phase'] =
(!empty($vvSt[$vvSlUp . '_PHASE2_DONE']) || !empty($vvSt[$vvDetected['slot'] . '_phase2_done'])) ? 2
: ((!empty($vvSt[$vvSlUp . '_PHASE1_DONE']) || !empty($vvSt[$vvDetected['slot'] . '_phase1_done'])) ? 1 : 0);
}
// ── Custom docker networks, adopted from the owner ───────────────────────────────────────────
// master.conf names the hosts; it does not name the networks, which live in each host's own
// host*.conf. The owner's copy is available here anyway: onboard Phase 1 caches it into
@@ -84,17 +96,6 @@ if ($vvMasterRaw !== '' && $detectedHostname !== '') {
//
// Adopting the owner's list also means docker_network_connect.sh will recreate the network here
// after an Unraid update wipes it, which is the whole reason that script exists.
// How far this host's own onboarding has got, so the inline join panel can show the SSH step or
// the join button rather than both. Same flags api/checklist.php reads, and the same two
// spellings, because the state file has been written by both bash and PHP over its life.
if ($vvDetected['slot'] !== '') {
$vvSt = vv_setup_state_read();
$vvSlUp = strtoupper($vvDetected['slot']);
$vvDetected['phase'] =
(!empty($vvSt[$vvSlUp . '_PHASE2_DONE']) || !empty($vvSt[$vvDetected['slot'] . '_phase2_done'])) ? 2
: ((!empty($vvSt[$vvSlUp . '_PHASE1_DONE']) || !empty($vvSt[$vvDetected['slot'] . '_phase1_done'])) ? 1 : 0);
}
if ($vvDetected['role'] === 'partner' && $vvDetected['slot'] !== '') {
$vvOwnerConf = VV_CONF_RAM_CACHE_DIR . '/host1.conf';
if (is_readable($vvOwnerConf)) {
@@ -506,26 +507,6 @@ function vvDeferItem(btn, id, defer) {
//
// Only while it is still outstanding: once the mirror has joined, the partnership row in the
// checklist above says so and a second copy of the panel is noise.
// SCRIPTS_DIR is read live rather than baked into the page, because the wizard can MOVE it.
//
// Choosing appdata storage in step 1 triggers a migration, and step 2 renders in the same page
// load — so anything PHP substituted at render time still names the pre-migration location. A
// host that migrated was handed "bash /boot/config/plugins/varaverk/…" to paste, which does not
// exist there. The command is the one thing on this panel that must be right: it is pasted into
// a root terminal.
//
// api/setup.php?action=detect re-reads varaverk.cfg, so it reports wherever the install actually
// ended up. Cached after the first call — the checklist re-renders on every action.
let _vvScriptsDir = null;
function vvScriptsDir() {
if (_vvScriptsDir) return Promise.resolve(_vvScriptsDir);
return fetch('/plugins/varaverk/api/setup.php?action=detect&_=' + Date.now())
.then(r => r.json())
.then(d => (_vvScriptsDir = (d && d.scripts_dir) || <?= json_encode(SCRIPTS_DIR) ?>))
// Falling back to the render-time value is still better than no command at all; it is only
// wrong in the case this function exists to handle, and the panel shows the path either way.
.catch(() => (_vvScriptsDir = <?= json_encode(SCRIPTS_DIR) ?>));
}
function vvRenderOnboardPanel(d) {
const el = document.getElementById('vv-onboard-panel');
@@ -534,7 +515,7 @@ function vvRenderOnboardPanel(d) {
const pt = (d.items || []).find(i => i.id === 'partnership');
if (!partner || !pt || pt.ok) { el.innerHTML = ''; return; }
vvScriptsDir().then(dir => {
vvScriptsDir(<?= json_encode(SCRIPTS_DIR) ?>).then(dir => {
el.innerHTML = '<hr class="vv-hr">'
+ '<div class="vv-cl-title">Join the partnership</div>'
+ vvRenderMirrorOnboard({