Skip to content

Commit c2adaaf

Browse files
DAdjadjclaude
andcommitted
Check for updates before triggering Watchtower
The update button was calling /update/run directly, which triggered Watchtower to recreate the container even when already up to date. Now checks /update/check first and only runs the update if one exists. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 70b73d3 commit c2adaaf

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

app/web/templates/status.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,20 @@
176176
status.style.display = 'block';
177177
status.textContent = 'Checking for updates...';
178178
try {
179-
const resp = await fetch('/update/run', { method: 'POST' });
180-
const data = await resp.json();
181-
if (data.up_to_date) {
179+
const check = await fetch('/update/check');
180+
const checkData = await check.json();
181+
if (!checkData.available) {
182182
status.textContent = 'Already up to date.';
183183
btn.textContent = 'Check for updates';
184184
btn.disabled = false;
185185
setTimeout(function() { status.style.display = 'none'; }, 3000);
186-
} else if (data.updating) {
187-
status.textContent = 'Update found. Restarting...';
186+
return;
187+
}
188+
status.textContent = 'Update found. Installing...';
189+
const resp = await fetch('/update/run', { method: 'POST' });
190+
const data = await resp.json();
191+
if (data.updating) {
192+
status.textContent = 'Restarting...';
188193
setTimeout(function pollServer() {
189194
fetch('/health').then(function(r) { if (r.ok) location.reload(); else setTimeout(pollServer, 2000); }).catch(function() { setTimeout(pollServer, 2000); });
190195
}, 5000);

0 commit comments

Comments
 (0)