Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 182x 182x 182x | /**
* Policy for the `?customization=` URL query parameter.
*
* The effective policy comes from the **app config** property
* `customizationUrlPrefixes` (NOT a customization — a customization must never
* be able to widen its own allowlist). When that property is absent the policy
* has no prefixes, so the feature is **off by default**: any `?customization=`
* value is rejected because its prefix is not configured.
*
* Shape:
* - prefixes: map of prefix -> base URL used to resolve a customization value
* to a fetched `.jsonc` data file. The `default` prefix (no slashes) is used
* for values with no leading slash; every other prefix must start and end
* with a slash (e.g. `/remote/`) and is matched against the leading
* `/segment/` of the value.
*
* Example app config:
* window.config = {
* customizationUrlPrefixes: {
* default: './customizations/',
* '/remote/': 'https://cdn.example.com/ohif-customizations/',
* },
* };
*/
export interface CustomizationUrlPolicy {
prefixes: Record<string, string>;
}
/**
* App config property name holding the prefix allowlist. Read directly off
* `appConfig` — deliberately not a customization key.
*/
export const CUSTOMIZATION_URL_PREFIXES_KEY = 'customizationUrlPrefixes';
export const DEFAULT_PREFIX = 'default';
/** Off by default: no prefixes are allowed until the app config configures them. */
export const customizationUrlDefaults: CustomizationUrlPolicy = {
prefixes: {},
};
export default customizationUrlDefaults;
|