Fix: Force pull images in deploy workflow
All checks were successful
Build and Push / build-all (push) Successful in 7m30s
All checks were successful
Build and Push / build-all (push) Successful in 7m30s
This commit is contained in:
parent
7f56f19e94
commit
0bb461498e
7 changed files with 104 additions and 23 deletions
|
|
@ -24,6 +24,21 @@
|
|||
|
||||
$: realmName = $page.params.realm;
|
||||
|
||||
// Helper to get auth token for WebSocket connections
|
||||
async function getAuthToken() {
|
||||
if (!browser) return null;
|
||||
try {
|
||||
const response = await fetch('/api/user/token', { credentials: 'include' });
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
return data.token || null;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to get auth token:', e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Re-check ownership and reconnect WebSocket when auth state changes (login/logout)
|
||||
let lastAuthUserId = undefined; // undefined = not yet initialized
|
||||
$: {
|
||||
|
|
@ -37,11 +52,10 @@
|
|||
// Auth changed - reconnect WebSocket to get updated permissions
|
||||
lastAuthUserId = currentUserId;
|
||||
checkOwnership();
|
||||
const token = browser ? localStorage.getItem('token') : null;
|
||||
watchSync.disconnect();
|
||||
setTimeout(() => {
|
||||
getAuthToken().then(token => {
|
||||
watchSync.connect(realm.id, token);
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -62,7 +76,7 @@
|
|||
}
|
||||
|
||||
// Connect to watch sync WebSocket
|
||||
const token = localStorage.getItem('token');
|
||||
const token = await getAuthToken();
|
||||
watchSync.connect(realm.id, token);
|
||||
|
||||
// Load playlist
|
||||
|
|
@ -129,16 +143,14 @@
|
|||
// 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(() => {
|
||||
setTimeout(async () => {
|
||||
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);
|
||||
}
|
||||
const token = await getAuthToken();
|
||||
watchSync.disconnect();
|
||||
setTimeout(() => {
|
||||
watchSync.connect(realm.id, token);
|
||||
}, 100);
|
||||
}
|
||||
permissionCheckDone = true;
|
||||
}, 1500);
|
||||
|
|
|
|||
|
|
@ -907,8 +907,20 @@
|
|||
});
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
message = 'Sticker approved and added';
|
||||
await Promise.all([loadStickers(), loadStickerSubmissions()]);
|
||||
|
||||
// Optimistically add the new sticker to the list using response data
|
||||
if (data.sticker) {
|
||||
stickers = [...stickers, {
|
||||
id: data.sticker.id,
|
||||
name: data.sticker.name,
|
||||
filePath: data.sticker.filePath
|
||||
}].sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
// Remove from pending submissions
|
||||
await loadStickerSubmissions();
|
||||
} else {
|
||||
const data = await response.json();
|
||||
error = data.error || 'Failed to approve sticker';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue