mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 11:01:45 +00:00
fix: innerHTML trusted-types
This commit is contained in:
20
src/utils/trusted-types.ts
Normal file
20
src/utils/trusted-types.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import type { TrustedTypePolicy } from 'trusted-types/lib';
|
||||
|
||||
export let defaultTrustedTypePolicy: Pick<
|
||||
TrustedTypePolicy<{
|
||||
createHTML: (input: string) => string;
|
||||
createScriptURL: (input: string) => string;
|
||||
createScript: (input: string) => string;
|
||||
}>,
|
||||
'name' | 'createHTML' | 'createScript' | 'createScriptURL'
|
||||
>;
|
||||
|
||||
export const registerWindowDefaultTrustedTypePolicy = () => {
|
||||
if (window.trustedTypes && window.trustedTypes.createPolicy) {
|
||||
defaultTrustedTypePolicy = window.trustedTypes.createPolicy('default', {
|
||||
createHTML: (input) => input,
|
||||
createScriptURL: (input) => input,
|
||||
createScript: (input) => input,
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user