chore: improve readability

This commit is contained in:
Su-Yong
2025-10-12 14:28:29 +09:00
parent 4f716d8e0b
commit ffa61687bf
137 changed files with 2625 additions and 2626 deletions

View File

@ -21,7 +21,7 @@ import settingHTML from './templates/setting.html?raw';
import style from './style.css?inline';
import type { DataConnection } from 'peerjs';
import type { YoutubePlayer } from '@/types/youtube-player';
import type { MusicPlayer } from '@/types/music-player';
import type { RendererContext } from '@/types/contexts';
import type { VideoDataChanged } from '@/types/video-data-changed';
import type { AppElement } from '@/types/queue';
@ -49,7 +49,7 @@ export default createPlugin<
ipc?: RendererContext<never>['ipc'];
api: AppElement | null;
queue?: Queue;
playerApi?: YoutubePlayer;
playerApi?: MusicPlayer;
showPrompt: (title: string, label: string) => Promise<string>;
popups: {
host: ReturnType<typeof createHostPopup>;

View File

@ -7,13 +7,13 @@ export const extractToken = (cookie = document.cookie) =>
export const getHash = async (
papisid: string,
millis = Date.now(),
origin: string = 'https://music.youtube.com',
origin: string = 'https://music.\u0079\u006f\u0075\u0074\u0075\u0062\u0065.com',
) => (await SHA1Hash(`${millis} ${papisid} ${origin}`)).toLowerCase();
export const getAuthorizationHeader = async (
papisid: string,
millis = Date.now(),
origin: string = 'https://music.youtube.com',
origin: string = 'https://music.\u0079\u006f\u0075\u0074\u0075\u0062\u0065.com',
) => {
return `SAPISIDHASH ${millis}_${await getHash(papisid, millis, origin)}`;
};

View File

@ -1,4 +1,4 @@
import type { YouTubeMusicAppElement } from '@/types/youtube-music-app-element';
import type { MusicPlayerAppElement } from '@/types/music-player-app-element';
import type { QueueElement } from '@/types/queue';
type QueueRendererResponse = {
@ -13,7 +13,7 @@ export const getMusicQueueRenderer = async (
videoIds: string[],
): Promise<QueueRendererResponse | null> => {
const queue = document.querySelector<QueueElement>('#queue');
const app = document.querySelector<YouTubeMusicAppElement>('ytmusic-app');
const app = document.querySelector<MusicPlayerAppElement>('ytmusic-app');
if (!app) return null;
const store = queue?.queue.store.store;