Fix: Force pull images in deploy workflow
All checks were successful
Build and Push / build-all (push) Successful in 8m52s

This commit is contained in:
doomtube 2026-01-06 23:20:31 -05:00
parent 5430e434c3
commit 7f56f19e94
10 changed files with 164 additions and 30 deletions

View file

@ -24,11 +24,25 @@
$: realmName = $page.params.realm;
// Re-check ownership when auth state changes (login/logout)
// Re-check ownership and reconnect WebSocket when auth state changes (login/logout)
let lastAuthUserId = undefined; // undefined = not yet initialized
$: {
$auth; // Track auth store changes
if (realm) {
checkOwnership();
const currentUserId = $auth.user?.id || null;
if (realm && !loading) {
// Initialize on first run after loading completes
if (lastAuthUserId === undefined) {
lastAuthUserId = currentUserId;
checkOwnership();
} else if (currentUserId !== lastAuthUserId) {
// Auth changed - reconnect WebSocket to get updated permissions
lastAuthUserId = currentUserId;
checkOwnership();
const token = browser ? localStorage.getItem('token') : null;
watchSync.disconnect();
setTimeout(() => {
watchSync.connect(realm.id, token);
}, 100);
}
}
}
@ -108,6 +122,29 @@
isOwner = (user?.id === realm.ownerId) || user?.isAdmin;
}
// Detect permission mismatch: if user is owner but WebSocket doesn't have control
// This can happen if the WebSocket connected before auth was ready
let permissionCheckDone = false;
$: {
// Only run this check once after WebSocket is connected and we know we're the owner
if (!permissionCheckDone && isOwner && !loading && $auth.user) {
// Give the WebSocket a moment to receive welcome message
setTimeout(() => {
if (isOwner && !$canControl && realm) {
console.log('Permission mismatch detected: owner but no control. Reconnecting...');
const token = browser ? localStorage.getItem('token') : null;
if (token) {
watchSync.disconnect();
setTimeout(() => {
watchSync.connect(realm.id, token);
}, 100);
}
}
permissionCheckDone = true;
}, 1500);
}
}
function handleVideoAdded(event) {
loadPlaylist();
// Request sync to get updated current video state (video may have auto-started)
@ -118,10 +155,16 @@
function handleVideoRemoved(event) {
loadPlaylist();
// Request sync to get updated state (current video may have been cleared)
setTimeout(() => {
// If the backend advanced to next video, request sync immediately to update player
if (event.detail?.advancedToNext || event.detail?.currentVideo) {
// Request sync immediately to get the new video playing
watchSync.requestSync();
}, 500);
} else {
// Request sync after a short delay for other cases
setTimeout(() => {
watchSync.requestSync();
}, 500);
}
}
function handlePlayerReady() {