Compare commits

...

1 Commits

Author SHA1 Message Date
Hunter Senft-Grupp
d29ca1f6ee feat: route /customers/* calls through cloud proxy in cloud mode
Add getCustomerApiBaseUrl() that returns /api/proxy/registry (same-origin)
in cloud mode, or getComfyApiBaseUrl() in non-cloud mode. Update all 4
consumer files to use it for /customers/* endpoints.
2026-02-13 13:57:21 -08:00
5 changed files with 25 additions and 9 deletions

View File

@@ -30,6 +30,19 @@ export function getComfyApiBaseUrl(): string {
)
}
/**
* Base URL for /customers/* API calls.
* In cloud mode, routes through the cloud proxy (same-origin).
* In non-cloud mode, calls api.comfy.org directly.
*/
export function getCustomerApiBaseUrl(): string {
if (isCloud) {
return '/api/proxy/registry'
}
return getComfyApiBaseUrl()
}
export function getComfyPlatformBaseUrl(): string {
if (!isCloud) {
return BUILD_TIME_PLATFORM_BASE_URL

View File

@@ -4,7 +4,10 @@ import { createSharedComposable } from '@vueuse/core'
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions'
import { useErrorHandling } from '@/composables/useErrorHandling'
import { getComfyApiBaseUrl, getComfyPlatformBaseUrl } from '@/config/comfyApi'
import {
getComfyPlatformBaseUrl,
getCustomerApiBaseUrl
} from '@/config/comfyApi'
import { t } from '@/i18n'
import { isCloud } from '@/platform/distribution/types'
import { useTelemetry } from '@/platform/telemetry'
@@ -96,7 +99,7 @@ function useSubscriptionInternal() {
})
function buildApiUrl(path: string): string {
return `${getComfyApiBaseUrl()}${path}`
return `${getCustomerApiBaseUrl()}${path}`
}
const getCheckoutAttributionForCloud =

View File

@@ -1,6 +1,6 @@
import { storeToRefs } from 'pinia'
import { getComfyApiBaseUrl } from '@/config/comfyApi'
import { getCustomerApiBaseUrl } from '@/config/comfyApi'
import { t } from '@/i18n'
import { isCloud } from '@/platform/distribution/types'
import { useTelemetry } from '@/platform/telemetry'
@@ -73,7 +73,7 @@ export async function performSubscriptionCheckout(
const checkoutPayload = { ...checkoutAttribution }
const response = await fetch(
`${getComfyApiBaseUrl()}/customers/cloud-subscription-checkout/${checkoutTier}`,
`${getCustomerApiBaseUrl()}/customers/cloud-subscription-checkout/${checkoutTier}`,
{
method: 'POST',
headers: { ...authHeader, 'Content-Type': 'application/json' },

View File

@@ -2,7 +2,7 @@ import type { AxiosError, AxiosResponse } from 'axios'
import axios from 'axios'
import { ref, watch } from 'vue'
import { getComfyApiBaseUrl } from '@/config/comfyApi'
import { getCustomerApiBaseUrl } from '@/config/comfyApi'
import { d } from '@/i18n'
import { useFirebaseAuthStore } from '@/stores/firebaseAuthStore'
import type { components, operations } from '@/types/comfyRegistryTypes'
@@ -24,7 +24,7 @@ type CustomerEventsResponseQuery =
export type AuditLog = components['schemas']['AuditLog']
const customerApiClient = axios.create({
baseURL: getComfyApiBaseUrl(),
baseURL: getCustomerApiBaseUrl(),
headers: {
'Content-Type': 'application/json'
}
@@ -35,7 +35,7 @@ export const useCustomerEventsService = () => {
const error = ref<string | null>(null)
watch(
() => getComfyApiBaseUrl(),
() => getCustomerApiBaseUrl(),
(url) => {
customerApiClient.defaults.baseURL = url
}

View File

@@ -20,7 +20,7 @@ import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import { useFirebaseAuth } from 'vuefire'
import { getComfyApiBaseUrl } from '@/config/comfyApi'
import { getCustomerApiBaseUrl } from '@/config/comfyApi'
import { t } from '@/i18n'
import { WORKSPACE_STORAGE_KEYS } from '@/platform/auth/workspace/workspaceConstants'
import { isCloud } from '@/platform/distribution/types'
@@ -78,7 +78,7 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
*/
const lastTokenUserId = ref<string | null>(null)
const buildApiUrl = (path: string) => `${getComfyApiBaseUrl()}${path}`
const buildApiUrl = (path: string) => `${getCustomerApiBaseUrl()}${path}`
// Providers
const googleProvider = new GoogleAuthProvider()