mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix: fix trustedHTML issue
- (Maybe) fix #2339, caused by YouTube's A/B testing
This commit is contained in:
@ -23,6 +23,14 @@ let isPluginLoaded = false;
|
||||
let isApiLoaded = false;
|
||||
let firstDataLoaded = false;
|
||||
|
||||
if (window.trustedTypes && window.trustedTypes.createPolicy && !window.trustedTypes.defaultPolicy) {
|
||||
window.trustedTypes.createPolicy('default', {
|
||||
createHTML: (input) => input,
|
||||
createScriptURL: (input) => input,
|
||||
createScript: (input) => input,
|
||||
});
|
||||
}
|
||||
|
||||
async function listenForApiLoad() {
|
||||
if (!isApiLoaded) {
|
||||
api = document.querySelector('#movie_player');
|
||||
|
||||
2
src/reset.d.ts
vendored
2
src/reset.d.ts
vendored
@ -6,6 +6,7 @@ import type is from 'electron-is';
|
||||
import type config from './config';
|
||||
import type { VideoDataChanged } from '@/types/video-data-changed';
|
||||
import type { t } from '@/i18n';
|
||||
import type { trustedTypes } from 'trusted-types';
|
||||
|
||||
declare global {
|
||||
interface Compressor {
|
||||
@ -19,6 +20,7 @@ declare global {
|
||||
}
|
||||
|
||||
interface Window {
|
||||
trustedTypes?: typeof trustedTypes;
|
||||
ipcRenderer: typeof electronIpcRenderer;
|
||||
mainConfig: typeof config;
|
||||
electronIs: typeof is;
|
||||
|
||||
Reference in New Issue
Block a user