feat(marketplace): introduce IS_MARKETPLACE flag and update X-Dify-Version header logic

This commit is contained in:
WTW0313
2025-11-04 16:09:50 +08:00
parent 7df6d9f1aa
commit 79c70d09c9
3 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import type {
} from '@/app/components/plugins/marketplace/types'
import {
APP_VERSION,
IS_MARKETPLACE,
MARKETPLACE_API_PREFIX,
} from '@/config'
import { getMarketplaceUrl } from '@/utils/var'
@ -51,7 +52,7 @@ export const getMarketplacePluginsByCollectionId = async (collectionId: string,
try {
const url = `${MARKETPLACE_API_PREFIX}/collections/${collectionId}/plugins`
const headers = new Headers({
'X-Dify-Version': APP_VERSION,
'X-Dify-Version': !IS_MARKETPLACE ? APP_VERSION : '999.0.0',
})
const marketplaceCollectionPluginsData = await globalThis.fetch(
url,
@ -89,7 +90,7 @@ export const getMarketplaceCollectionsAndPlugins = async (query?: CollectionsAnd
if (query?.type)
marketplaceUrl += `&type=${query.type}`
const headers = new Headers({
'X-Dify-Version': APP_VERSION,
'X-Dify-Version': !IS_MARKETPLACE ? APP_VERSION : '999.0.0',
})
const marketplaceCollectionsData = await globalThis.fetch(marketplaceUrl, { headers, cache: 'no-store' })
const marketplaceCollectionsDataJson = await marketplaceCollectionsData.json()