mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-21 23:09:39 +00:00
[backport rh-test] make 'require subscription' toggleable (#6147)
## Summary Backport of PR #6144 to the `rh-test` branch. This adds build time feature flags system starting with a flag that indicates whether subscription is required to use the app. This is only used on cloud. ## Changes - Added build feature flags system via `__BUILD_FLAGS__` global - Added `REQUIRE_SUBSCRIPTION` flag that can be set via environment variable - Conditionally load subscription-related components based on the flag - Updated run button logic to respect the subscription requirement flag - Updated settings UI to show subscription panel only when required ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6147-Backport-make-require-subscription-toggleable-in-build-to-rh-test-2916d73d365081e89bcfc4502315a812) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -26,7 +26,7 @@ interface CloudSubscriptionStatusResponse {
|
||||
const subscriptionStatus = ref<CloudSubscriptionStatusResponse | null>(null)
|
||||
|
||||
const isActiveSubscription = computed(() => {
|
||||
if (!isCloud) return true
|
||||
if (!isCloud || !__BUILD_FLAGS__.REQUIRE_SUBSCRIPTION) return true
|
||||
|
||||
return subscriptionStatus.value?.is_active ?? false
|
||||
})
|
||||
|
||||
@@ -80,21 +80,22 @@ export function useSettingUI(
|
||||
)
|
||||
}
|
||||
|
||||
const subscriptionPanel: SettingPanelItem | null = !isCloud
|
||||
? null
|
||||
: {
|
||||
node: {
|
||||
key: 'subscription',
|
||||
label: 'PlanCredits',
|
||||
children: []
|
||||
},
|
||||
component: defineAsyncComponent(
|
||||
() =>
|
||||
import(
|
||||
'@/platform/cloud/subscription/components/SubscriptionPanel.vue'
|
||||
)
|
||||
)
|
||||
}
|
||||
const subscriptionPanel: SettingPanelItem | null =
|
||||
!isCloud || !__BUILD_FLAGS__.REQUIRE_SUBSCRIPTION
|
||||
? null
|
||||
: {
|
||||
node: {
|
||||
key: 'subscription',
|
||||
label: 'PlanCredits',
|
||||
children: []
|
||||
},
|
||||
component: defineAsyncComponent(
|
||||
() =>
|
||||
import(
|
||||
'@/platform/cloud/subscription/components/SubscriptionPanel.vue'
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
const userPanel: SettingPanelItem = {
|
||||
node: {
|
||||
@@ -148,7 +149,9 @@ export function useSettingUI(
|
||||
keybindingPanel,
|
||||
extensionPanel,
|
||||
...(isElectron() ? [serverConfigPanel] : []),
|
||||
...(isCloud && subscriptionPanel ? [subscriptionPanel] : [])
|
||||
...(isCloud && __BUILD_FLAGS__.REQUIRE_SUBSCRIPTION && subscriptionPanel
|
||||
? [subscriptionPanel]
|
||||
: [])
|
||||
].filter((panel) => panel.component)
|
||||
)
|
||||
|
||||
@@ -180,10 +183,16 @@ export function useSettingUI(
|
||||
label: 'Account',
|
||||
children: [
|
||||
userPanel.node,
|
||||
...(isLoggedIn.value && isCloud && subscriptionPanel
|
||||
...(isLoggedIn.value &&
|
||||
isCloud &&
|
||||
__BUILD_FLAGS__.REQUIRE_SUBSCRIPTION &&
|
||||
subscriptionPanel
|
||||
? [subscriptionPanel.node]
|
||||
: []),
|
||||
...(isLoggedIn.value && !isCloud ? [creditsPanel.node] : [])
|
||||
...(isLoggedIn.value &&
|
||||
!(isCloud && __BUILD_FLAGS__.REQUIRE_SUBSCRIPTION)
|
||||
? [creditsPanel.node]
|
||||
: [])
|
||||
].map(translateCategory)
|
||||
},
|
||||
// Normal settings stored in the settingStore
|
||||
|
||||
Reference in New Issue
Block a user