fix: fixed an issue that caused infinite loops when using Music Together

fix #1752
This commit is contained in:
JellyBrick
2024-02-20 12:57:26 +09:00
parent 62a86e9267
commit 6f70d179c7
3 changed files with 40 additions and 27 deletions

View File

@ -6,9 +6,9 @@ import { t } from '@/i18n';
import { createPlugin } from '@/utils';
import promptOptions from '@/providers/prompt-options';
import { AppAPI, getDefaultProfile, Permission, Profile, VideoData } from './types';
import { type AppElement, getDefaultProfile, type Permission, type Profile, type VideoData } from './types';
import { Queue } from './queue';
import { Connection, ConnectionEventUnion } from './connection';
import { Connection, type ConnectionEventUnion } from './connection';
import { createHostPopup } from './ui/host';
import { createGuestPopup } from './ui/guest';
import { createSettingPopup } from './ui/setting';
@ -41,7 +41,7 @@ export default createPlugin<
{
connection?: Connection;
ipc?: RendererContext<never>['ipc'];
api: HTMLElement & AppAPI | null;
api: AppElement | null;
queue?: Queue;
playerApi?: YoutubePlayer;
showPrompt: (title: string, label: string) => Promise<string>;
@ -557,7 +557,7 @@ export default createPlugin<
start({ ipc }) {
this.ipc = ipc;
this.showPrompt = async (title: string, label: string) => ipc.invoke('music-together:prompt', title, label) as Promise<string>;
this.api = document.querySelector<HTMLElement & AppAPI>('ytmusic-app');
this.api = document.querySelector<AppElement>('ytmusic-app');
/* setup */
document.querySelector('#right-content > ytmusic-settings-button')?.insertAdjacentHTML('beforebegin', settingHTML);