mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 22:37:32 +00:00
## Summary
- Fixes remote config polling to use authenticated API
- Consolidates `loadRemoteConfig` into `refreshRemoteConfig` with auth
control
- Adds unit tests for both auth modes
## Problem
The cloud extension's polling interval was using unauthenticated
`fetch`, causing it to receive only default feature flags instead of
user-specific configurations.
**Root cause:**
1. Bootstrap called `loadRemoteConfig()` (raw `fetch`, no auth) -
correct, auth not initialized yet
2. Extension watch called `refreshRemoteConfig()` (`api.fetchApi`, with
auth) - correct
3. Extension interval called `loadRemoteConfig()` (raw `fetch`, no auth)
- **bug**
## Solution
- Consolidate into single `refreshRemoteConfig()` with optional
`useAuth` parameter (defaults to `true`)
- Bootstrap: `refreshRemoteConfig({ useAuth: false })`
- Polling: `refreshRemoteConfig()` (authenticated by default)
## Test Plan
- Unit tests verify both auth modes
- `pnpm typecheck`, `pnpm lint`, `pnpm test:unit` all pass
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8266-fix-use-authenticated-API-for-remote-config-polling-2f16d73d3650817ea7b0e3a7e3ccf12a)
by [Unito](https://www.unito.io)
92 lines
2.5 KiB
TypeScript
92 lines
2.5 KiB
TypeScript
import { definePreset } from '@primevue/themes'
|
|
import Aura from '@primevue/themes/aura'
|
|
import * as Sentry from '@sentry/vue'
|
|
import { initializeApp } from 'firebase/app'
|
|
import { createPinia } from 'pinia'
|
|
import 'primeicons/primeicons.css'
|
|
import PrimeVue from 'primevue/config'
|
|
import ConfirmationService from 'primevue/confirmationservice'
|
|
import ToastService from 'primevue/toastservice'
|
|
import Tooltip from 'primevue/tooltip'
|
|
import { createApp } from 'vue'
|
|
import { VueFire, VueFireAuth } from 'vuefire'
|
|
|
|
import { getFirebaseConfig } from '@/config/firebase'
|
|
import '@/lib/litegraph/public/css/litegraph.css'
|
|
import router from '@/router'
|
|
|
|
import App from './App.vue'
|
|
// Intentionally relative import to ensure the CSS is loaded in the right order (after litegraph.css)
|
|
import './assets/css/style.css'
|
|
import { i18n } from './i18n'
|
|
|
|
/**
|
|
* CRITICAL: Load remote config FIRST for cloud builds to ensure
|
|
* window.__CONFIG__is available for all modules during initialization
|
|
*/
|
|
import { isCloud } from '@/platform/distribution/types'
|
|
|
|
if (isCloud) {
|
|
const { refreshRemoteConfig } =
|
|
await import('@/platform/remoteConfig/refreshRemoteConfig')
|
|
await refreshRemoteConfig({ useAuth: false })
|
|
}
|
|
|
|
const ComfyUIPreset = definePreset(Aura, {
|
|
semantic: {
|
|
// @ts-expect-error fixme ts strict error
|
|
primary: Aura['primitive'].blue
|
|
}
|
|
})
|
|
|
|
const firebaseApp = initializeApp(getFirebaseConfig())
|
|
|
|
const app = createApp(App)
|
|
const pinia = createPinia()
|
|
Sentry.init({
|
|
app,
|
|
dsn: __SENTRY_DSN__,
|
|
enabled: __SENTRY_ENABLED__,
|
|
release: __COMFYUI_FRONTEND_VERSION__,
|
|
normalizeDepth: 8,
|
|
tracesSampleRate: isCloud ? 1.0 : 0,
|
|
replaysSessionSampleRate: 0,
|
|
replaysOnErrorSampleRate: 0,
|
|
// Only set these for non-cloud builds
|
|
...(isCloud
|
|
? {}
|
|
: {
|
|
integrations: [],
|
|
autoSessionTracking: false,
|
|
defaultIntegrations: false
|
|
})
|
|
})
|
|
app.directive('tooltip', Tooltip)
|
|
app
|
|
.use(router)
|
|
.use(PrimeVue, {
|
|
theme: {
|
|
preset: ComfyUIPreset,
|
|
options: {
|
|
prefix: 'p',
|
|
cssLayer: {
|
|
name: 'primevue',
|
|
order: 'theme, base, primevue'
|
|
},
|
|
// This is a workaround for the issue with the dark mode selector
|
|
// https://github.com/primefaces/primevue/issues/5515
|
|
darkModeSelector: '.dark-theme, :root:has(.dark-theme)'
|
|
}
|
|
}
|
|
})
|
|
.use(ConfirmationService)
|
|
.use(ToastService)
|
|
.use(pinia)
|
|
.use(i18n)
|
|
.use(VueFire, {
|
|
firebaseApp,
|
|
modules: [VueFireAuth()]
|
|
})
|
|
|
|
app.mount('#vue-app')
|