diff --git a/src/plugins/downloader/front.ts b/src/plugins/downloader/front.ts index 1519366b..06d6cfbb 100644 --- a/src/plugins/downloader/front.ts +++ b/src/plugins/downloader/front.ts @@ -40,11 +40,7 @@ const menuObserver = new MutationObserver(() => { setTimeout(() => doneFirstLoad ||= true, 500); }); -// TODO: re-enable once contextIsolation is set to true -// contextBridge.exposeInMainWorld("downloader", { -// download: () => { -// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access -(global as any).download = () => { +window.download = () => { let videoUrl = getSongMenu() // Selector of first button which is always "Start Radio" ?.querySelector('ytmusic-menu-navigation-item-renderer[tabindex="-1"] #navigation-endpoint') diff --git a/src/plugins/picture-in-picture/front.ts b/src/plugins/picture-in-picture/front.ts index 96236eba..28dd2df0 100644 --- a/src/plugins/picture-in-picture/front.ts +++ b/src/plugins/picture-in-picture/front.ts @@ -89,8 +89,7 @@ const togglePictureInPicture = async () => { return false; }; // For UI (HTML) -// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access -(global as any).togglePictureInPicture = togglePictureInPicture; +window.togglePictureInPicture = togglePictureInPicture; const listenForToggle = () => { const originalExitButton = $('.exit-fullscreen-button'); diff --git a/src/preload.ts b/src/preload.ts index bfa1d467..8cd32504 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -111,8 +111,7 @@ document.addEventListener('DOMContentLoaded', () => { setupSongControls(); // Add action for reloading - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any - (global as any).reload = () => ipcRenderer.send('reload'); + window.reload = () => ipcRenderer.send('reload'); // Blocks the "Are You Still There?" popup by setting the last active time to Date.now every 15min setInterval(() => window._lact = Date.now(), 900_000); diff --git a/src/reset.d.ts b/src/reset.d.ts index b3b3d290..718c3de9 100644 --- a/src/reset.d.ts +++ b/src/reset.d.ts @@ -18,6 +18,9 @@ declare global { */ _lact: number; navigation: Navigation; + download: () => void; + togglePictureInPicture: () => void; + reload: () => void; } }