mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 19:31:46 +00:00
chore: improve readability
This commit is contained in:
@ -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>;
|
||||
|
||||
@ -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)}`;
|
||||
};
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user