mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
move csp for marketplace to separate file
This commit is contained in:
@@ -10,6 +10,7 @@ function generateCspPolicy() {
|
||||
descriptors.googleFonts(),
|
||||
descriptors.googleReCaptcha(),
|
||||
descriptors.growthBook(),
|
||||
descriptors.marketplace(),
|
||||
descriptors.mixpanel(),
|
||||
descriptors.monaco(),
|
||||
descriptors.safe(),
|
||||
|
||||
@@ -31,8 +31,6 @@ const getCspReportUrl = () => {
|
||||
};
|
||||
|
||||
export function app(): CspDev.DirectiveDescriptor {
|
||||
const marketplaceFeaturePayload = getFeaturePayload(config.features.marketplace);
|
||||
|
||||
return {
|
||||
'default-src': [
|
||||
// KEY_WORDS.NONE,
|
||||
@@ -57,7 +55,6 @@ export function app(): CspDev.DirectiveDescriptor {
|
||||
getFeaturePayload(config.features.addressVerification)?.api.endpoint,
|
||||
getFeaturePayload(config.features.nameService)?.api.endpoint,
|
||||
getFeaturePayload(config.features.addressMetadata)?.api.endpoint,
|
||||
marketplaceFeaturePayload && 'api' in marketplaceFeaturePayload ? marketplaceFeaturePayload.api.endpoint : '',
|
||||
|
||||
// chain RPC server
|
||||
config.chain.rpcUrl,
|
||||
@@ -65,9 +62,6 @@ export function app(): CspDev.DirectiveDescriptor {
|
||||
|
||||
// github (spec for api-docs page)
|
||||
'raw.githubusercontent.com',
|
||||
|
||||
// airtable (for dapps ratings)
|
||||
'api.airtable.com',
|
||||
].filter(Boolean),
|
||||
|
||||
'script-src': [
|
||||
|
||||
@@ -5,6 +5,7 @@ export { googleAnalytics } from './googleAnalytics';
|
||||
export { googleFonts } from './googleFonts';
|
||||
export { googleReCaptcha } from './googleReCaptcha';
|
||||
export { growthBook } from './growthBook';
|
||||
export { marketplace } from './marketplace';
|
||||
export { mixpanel } from './mixpanel';
|
||||
export { monaco } from './monaco';
|
||||
export { safe } from './safe';
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import type CspDev from 'csp-dev';
|
||||
|
||||
import config from 'configs/app';
|
||||
|
||||
const feature = config.features.marketplace;
|
||||
|
||||
export function marketplace(): CspDev.DirectiveDescriptor {
|
||||
if (!feature.isEnabled) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
'connect-src': [
|
||||
'api' in feature ? feature.api.endpoint : '',
|
||||
feature.rating ? 'https://api.airtable.com' : '',
|
||||
],
|
||||
|
||||
'frame-src': [
|
||||
'*',
|
||||
],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user