mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-10 01:50:08 +00:00
## Summary - Fix auth related race conditions with a new WorkspaceAuthGate in App.vue - De dup initialization calls - Add state machine to track state of refreshRemoteConfig - Fix websocket not using new workspace jwt - Misc improvments ## Changes - **What**: Mainly WorkspaceAuthGate.vue - **Breaking**: <!-- Any breaking changes (if none, remove this line) --> - **Dependencies**: <!-- New dependencies (if none, remove this line) --> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8350-Feat-workspaces-5-auth-gate-check-2f66d73d365081b1a49afcd418fab3e7) by [Unito](https://www.unito.io)
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { watchDebounced } from '@vueuse/core'
|
|
|
|
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
|
|
import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription'
|
|
import { refreshRemoteConfig } from '@/platform/remoteConfig/refreshRemoteConfig'
|
|
import { useExtensionService } from '@/services/extensionService'
|
|
|
|
/**
|
|
* Cloud-only extension that polls for remote config updates
|
|
* Initial config load happens in main.ts before any other imports
|
|
*/
|
|
useExtensionService().registerExtension({
|
|
name: 'Comfy.Cloud.RemoteConfig',
|
|
|
|
setup: async () => {
|
|
const { isLoggedIn } = useCurrentUser()
|
|
const { isActiveSubscription } = useSubscription()
|
|
|
|
// Refresh config when subscription status changes
|
|
// Initial auth-aware refresh happens in WorkspaceAuthGate before app renders
|
|
watchDebounced(
|
|
[isLoggedIn, isActiveSubscription],
|
|
() => {
|
|
if (!isLoggedIn.value) return
|
|
void refreshRemoteConfig()
|
|
},
|
|
{ debounce: 256 }
|
|
)
|
|
|
|
// Poll for config updates every 10 minutes (with auth)
|
|
setInterval(() => void refreshRemoteConfig(), 600_000)
|
|
}
|
|
})
|