mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-02-02 12:43:44 +00:00
Compare commits
6 Commits
7027b027e2
...
8d9a819346
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d9a819346 | |||
| 127f56905c | |||
| 8d448c667f | |||
| e00f33eb2d | |||
| 8100804ced | |||
| 4fba3ffd92 |
@ -45,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"vite": "npm:rolldown-vite@7.1.8",
|
"vite": "npm:rolldown-vite@7.2.9",
|
||||||
"node-gyp": "11.4.2",
|
"node-gyp": "11.4.2",
|
||||||
"xml2js": "0.6.2",
|
"xml2js": "0.6.2",
|
||||||
"node-fetch": "3.3.2",
|
"node-fetch": "3.3.2",
|
||||||
@ -134,7 +134,7 @@
|
|||||||
"virtua": "0.42.3",
|
"virtua": "0.42.3",
|
||||||
"vudio": "2.1.1",
|
"vudio": "2.1.1",
|
||||||
"x11": "2.3.0",
|
"x11": "2.3.0",
|
||||||
"youtubei.js": "15.0.1",
|
"youtubei.js": "^16.0.1",
|
||||||
"zod": "4.1.5"
|
"zod": "4.1.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -173,7 +173,7 @@
|
|||||||
"typescript": "5.9.2",
|
"typescript": "5.9.2",
|
||||||
"typescript-eslint": "8.43.0",
|
"typescript-eslint": "8.43.0",
|
||||||
"utf-8-validate": "6.0.5",
|
"utf-8-validate": "6.0.5",
|
||||||
"vite": "npm:rolldown-vite@7.1.8",
|
"vite": "npm:rolldown-vite@7.2.9",
|
||||||
"vite-plugin-inspect": "11.3.3",
|
"vite-plugin-inspect": "11.3.3",
|
||||||
"vite-plugin-resolve": "2.5.2",
|
"vite-plugin-resolve": "2.5.2",
|
||||||
"vite-plugin-solid": "2.11.8",
|
"vite-plugin-solid": "2.11.8",
|
||||||
|
|||||||
491
pnpm-lock.yaml
generated
491
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -237,7 +237,8 @@
|
|||||||
"submenu": {
|
"submenu": {
|
||||||
"percent": "{{ratio}}%"
|
"percent": "{{ratio}}%"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"enable-seekbar": "Enable seekbar theming"
|
||||||
},
|
},
|
||||||
"name": "Album Color Theme"
|
"name": "Album Color Theme"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -150,6 +150,11 @@
|
|||||||
"visual-tweaks": {
|
"visual-tweaks": {
|
||||||
"label": "תיקונים חזותיים",
|
"label": "תיקונים חזותיים",
|
||||||
"submenu": {
|
"submenu": {
|
||||||
|
"custom-window-title": {
|
||||||
|
"prompt": {
|
||||||
|
"placeholder": "לדוגמה: שולחן כתיבה אגסי"
|
||||||
|
}
|
||||||
|
},
|
||||||
"like-buttons": {
|
"like-buttons": {
|
||||||
"default": "ברירת מחדל",
|
"default": "ברירת מחדל",
|
||||||
"force-show": "הפעל בכוח",
|
"force-show": "הפעל בכוח",
|
||||||
@ -201,8 +206,8 @@
|
|||||||
"restart": "הפעל מחדש",
|
"restart": "הפעל מחדש",
|
||||||
"show": "הראה חלון",
|
"show": "הראה חלון",
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
"default": "יוטיוב מיוזיק",
|
"default": "שולחן כתיבה אגסי",
|
||||||
"with-song-info": "יוטיוב מיוזיק: {{artist}} - {{title}}"
|
"with-song-info": "שולחן כתיב אגסי: {{יוצר}} - {{כותרת}}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -212,7 +217,7 @@
|
|||||||
"name": "הגבר מהירות פרסומת"
|
"name": "הגבר מהירות פרסומת"
|
||||||
},
|
},
|
||||||
"adblocker": {
|
"adblocker": {
|
||||||
"description": "חסום את כל המודעות והמעקב מחוץ לקופסה",
|
"description": "חסום את כל המודעות והמעקבים",
|
||||||
"menu": {
|
"menu": {
|
||||||
"blocker": "חוסם"
|
"blocker": "חוסם"
|
||||||
},
|
},
|
||||||
@ -244,6 +249,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"buffer": {
|
"buffer": {
|
||||||
|
"label": "חוצץ",
|
||||||
"submenu": {
|
"submenu": {
|
||||||
"buffer": "{{buffer}}"
|
"buffer": "{{buffer}}"
|
||||||
}
|
}
|
||||||
@ -380,6 +386,11 @@
|
|||||||
},
|
},
|
||||||
"templates": {
|
"templates": {
|
||||||
"title": "פתח בחירת כתוביות"
|
"title": "פתח בחירת כתוביות"
|
||||||
|
},
|
||||||
|
"toast": {
|
||||||
|
"caption-changed": "תרגום שונה ל {{שפה}}",
|
||||||
|
"caption-disabled": "תרגום בוטל",
|
||||||
|
"no-captions": "אין תרגום זמין לשיר הזה"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"compact-sidebar": {
|
"compact-sidebar": {
|
||||||
@ -391,9 +402,11 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"advanced": "מתקדם"
|
"advanced": "מתקדם"
|
||||||
},
|
},
|
||||||
|
"name": "התפיידות צלב[בית]",
|
||||||
"prompt": {
|
"prompt": {
|
||||||
"options": {
|
"options": {
|
||||||
"multi-input": {
|
"multi-input": {
|
||||||
|
"fade-in-duration": "תתפייד בזמן[מילישניות]",
|
||||||
"fade-scaling": {
|
"fade-scaling": {
|
||||||
"linear": "לינארי",
|
"linear": "לינארי",
|
||||||
"logarithmic": "לוגריתמי"
|
"logarithmic": "לוגריתמי"
|
||||||
|
|||||||
@ -237,7 +237,8 @@
|
|||||||
"submenu": {
|
"submenu": {
|
||||||
"percent": "{{ratio}}%"
|
"percent": "{{ratio}}%"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"enable-seekbar": "재생바 색조 변경 활성화"
|
||||||
},
|
},
|
||||||
"name": "앨범 컬러 기반 테마"
|
"name": "앨범 컬러 기반 테마"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -462,7 +462,7 @@
|
|||||||
"label": "Text stavu",
|
"label": "Text stavu",
|
||||||
"submenu": {
|
"submenu": {
|
||||||
"artist": "Aktuálne si prehráva {artist}",
|
"artist": "Aktuálne si prehráva {artist}",
|
||||||
"pear-desktop": "Aktuálne prehráva Pear Desktop",
|
"pear-desktop": "Počúva Pear Desktop",
|
||||||
"title": "Aktuálne si prehráva {song title}"
|
"title": "Aktuálne si prehráva {song title}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,9 @@
|
|||||||
"label": "بصری تبدیلیاں",
|
"label": "بصری تبدیلیاں",
|
||||||
"submenu": {
|
"submenu": {
|
||||||
"custom-window-title": {
|
"custom-window-title": {
|
||||||
|
"label": "اپنی مرضی کا ونڈو عنوان",
|
||||||
"prompt": {
|
"prompt": {
|
||||||
|
"label": "اپنی مرضی کا ونڈو عنوان درج کریں: (بند کرنے کے لیے خالی چھوڑ دیں)",
|
||||||
"placeholder": "مثال: پیئر ڈیسک ٹاپ"
|
"placeholder": "مثال: پیئر ڈیسک ٹاپ"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -219,7 +221,8 @@
|
|||||||
"description": "شروغ سے تمام اشتہارات اور ٹریکنگ بلاک کردیں",
|
"description": "شروغ سے تمام اشتہارات اور ٹریکنگ بلاک کردیں",
|
||||||
"menu": {
|
"menu": {
|
||||||
"blocker": "بلاکر"
|
"blocker": "بلاکر"
|
||||||
}
|
},
|
||||||
|
"name": "ایڈ بلاکر"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,41 +10,32 @@ const COLOR_KEY = '--ytmusic-album-color';
|
|||||||
const DARK_COLOR_KEY = '--ytmusic-album-color-dark';
|
const DARK_COLOR_KEY = '--ytmusic-album-color-dark';
|
||||||
const RATIO_KEY = '--ytmusic-album-color-ratio';
|
const RATIO_KEY = '--ytmusic-album-color-ratio';
|
||||||
|
|
||||||
export default createPlugin<
|
type Config = {
|
||||||
unknown,
|
enabled: boolean;
|
||||||
unknown,
|
ratio: number;
|
||||||
{
|
enableSeekbar: boolean;
|
||||||
color?: ColorInstance;
|
};
|
||||||
darkColor?: ColorInstance;
|
|
||||||
|
|
||||||
playerPage: HTMLElement | null;
|
type Renderer = {
|
||||||
navBarBackground: HTMLElement | null;
|
getMixedColor(
|
||||||
ytmusicPlayerBar: HTMLElement | null;
|
color: string,
|
||||||
playerBarBackground: HTMLElement | null;
|
key: string,
|
||||||
sidebarBig: HTMLElement | null;
|
alpha?: number,
|
||||||
sidebarSmall: HTMLElement | null;
|
ratioMultiply?: number,
|
||||||
ytmusicAppLayout: HTMLElement | null;
|
): string;
|
||||||
|
updateColor(alpha: number): void;
|
||||||
|
onConfigChange(newConfig: Config): void;
|
||||||
|
};
|
||||||
|
|
||||||
getMixedColor(
|
export default createPlugin({
|
||||||
color: string,
|
|
||||||
key: string,
|
|
||||||
alpha?: number,
|
|
||||||
ratioMultiply?: number,
|
|
||||||
): string;
|
|
||||||
updateColor(alpha: number): void;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
enabled: boolean;
|
|
||||||
ratio: number;
|
|
||||||
}
|
|
||||||
>({
|
|
||||||
name: () => t('plugins.album-color-theme.name'),
|
name: () => t('plugins.album-color-theme.name'),
|
||||||
description: () => t('plugins.album-color-theme.description'),
|
description: () => t('plugins.album-color-theme.description'),
|
||||||
restartNeeded: false,
|
restartNeeded: false,
|
||||||
config: {
|
config: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
ratio: 0.5,
|
ratio: 0.5,
|
||||||
},
|
enableSeekbar: true,
|
||||||
|
} satisfies Config as Config,
|
||||||
stylesheets: [style],
|
stylesheets: [style],
|
||||||
menu: async ({ getConfig, setConfig }) => {
|
menu: async ({ getConfig, setConfig }) => {
|
||||||
const ratioList = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
|
const ratioList = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
|
||||||
@ -68,18 +59,28 @@ export default createPlugin<
|
|||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: t('plugins.album-color-theme.menu.enable-seekbar'),
|
||||||
|
type: 'checkbox',
|
||||||
|
checked: config.enableSeekbar,
|
||||||
|
click(item) {
|
||||||
|
setConfig({ enableSeekbar: item.checked });
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
renderer: {
|
renderer: {
|
||||||
playerPage: null,
|
playerPage: null as HTMLElement | null,
|
||||||
navBarBackground: null,
|
navBarBackground: null as HTMLElement | null,
|
||||||
ytmusicPlayerBar: null,
|
ytmusicPlayerBar: null as HTMLElement | null,
|
||||||
playerBarBackground: null,
|
playerBarBackground: null as HTMLElement | null,
|
||||||
sidebarBig: null,
|
sidebarBig: null as HTMLElement | null,
|
||||||
sidebarSmall: null,
|
sidebarSmall: null as HTMLElement | null,
|
||||||
ytmusicAppLayout: null,
|
ytmusicAppLayout: null as HTMLElement | null,
|
||||||
|
color: null as ColorInstance | null,
|
||||||
|
darkColor: null as ColorInstance | null,
|
||||||
|
|
||||||
async start({ getConfig }) {
|
start() {
|
||||||
this.playerPage = document.querySelector<HTMLElement>('#player-page');
|
this.playerPage = document.querySelector<HTMLElement>('#player-page');
|
||||||
this.navBarBackground = document.querySelector<HTMLElement>(
|
this.navBarBackground = document.querySelector<HTMLElement>(
|
||||||
'#nav-bar-background',
|
'#nav-bar-background',
|
||||||
@ -94,14 +95,11 @@ export default createPlugin<
|
|||||||
'#mini-guide-background',
|
'#mini-guide-background',
|
||||||
);
|
);
|
||||||
this.ytmusicAppLayout = document.querySelector<HTMLElement>('#layout');
|
this.ytmusicAppLayout = document.querySelector<HTMLElement>('#layout');
|
||||||
|
|
||||||
const config = await getConfig();
|
|
||||||
document.documentElement.style.setProperty(
|
|
||||||
RATIO_KEY,
|
|
||||||
`${~~(config.ratio * 100)}%`,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
onPlayerApiReady(playerApi) {
|
async onPlayerApiReady(playerApi, { getConfig }) {
|
||||||
|
const config = await getConfig();
|
||||||
|
(this as Renderer).onConfigChange(config);
|
||||||
|
|
||||||
const fastAverageColor = new FastAverageColor();
|
const fastAverageColor = new FastAverageColor();
|
||||||
|
|
||||||
document.addEventListener('videodatachange', async (event) => {
|
document.addEventListener('videodatachange', async (event) => {
|
||||||
@ -152,7 +150,7 @@ export default createPlugin<
|
|||||||
alpha = value;
|
alpha = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.updateColor(alpha ?? 1);
|
(this as Renderer).updateColor(alpha ?? 1);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onConfigChange(config) {
|
onConfigChange(config) {
|
||||||
@ -160,8 +158,15 @@ export default createPlugin<
|
|||||||
RATIO_KEY,
|
RATIO_KEY,
|
||||||
`${~~(config.ratio * 100)}%`,
|
`${~~(config.ratio * 100)}%`,
|
||||||
);
|
);
|
||||||
|
if (config.enableSeekbar) document.body.classList.add('seekbar-theme');
|
||||||
|
else document.body.classList.remove('seekbar-theme');
|
||||||
},
|
},
|
||||||
getMixedColor(color: string, key: string, alpha = 1, ratioMultiply) {
|
getMixedColor(
|
||||||
|
color: string,
|
||||||
|
key: string,
|
||||||
|
alpha = 1,
|
||||||
|
ratioMultiply?: number,
|
||||||
|
) {
|
||||||
const keyColor = `rgba(var(${key}), ${alpha})`;
|
const keyColor = `rgba(var(${key}), ${alpha})`;
|
||||||
|
|
||||||
let colorRatio = `var(${RATIO_KEY}, 50%)`;
|
let colorRatio = `var(${RATIO_KEY}, 50%)`;
|
||||||
@ -207,26 +212,39 @@ export default createPlugin<
|
|||||||
'--yt-spec-black-pure-alpha-80': 'rgba(0,0,0,0.8)',
|
'--yt-spec-black-pure-alpha-80': 'rgba(0,0,0,0.8)',
|
||||||
'--yt-spec-black-1-alpha-98': 'rgba(40,40,40,0.98)',
|
'--yt-spec-black-1-alpha-98': 'rgba(40,40,40,0.98)',
|
||||||
'--yt-spec-black-1-alpha-95': 'rgba(40,40,40,0.95)',
|
'--yt-spec-black-1-alpha-95': 'rgba(40,40,40,0.95)',
|
||||||
|
'--paper-toast-background-color': '#323232',
|
||||||
|
'--ytmusic-search-background': '#030303',
|
||||||
|
'--paper-slider-knob-color': '#f03',
|
||||||
|
'--paper-dialog-background-color': '#212121',
|
||||||
|
'--paper-progress-active-color-1': '#f03',
|
||||||
|
'--paper-progress-active-color-2': '#ff2791',
|
||||||
|
'--yt-spec-inverted-background': '#f3f3f3',
|
||||||
|
'background': 'rgba(3, 3, 3)',
|
||||||
|
'--ytmusic-background': 'rgba(3, 3, 3)',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const colorKeyMap: Record<string, string> = {
|
||||||
|
'background': DARK_COLOR_KEY,
|
||||||
|
'--ytmusic-background': DARK_COLOR_KEY,
|
||||||
|
};
|
||||||
|
|
||||||
|
const ratioMap: Record<string, number> = {
|
||||||
|
'--paper-progress-active-color-1': 1.75,
|
||||||
|
'--paper-progress-active-color-2': 1.75,
|
||||||
|
'--yt-spec-inverted-background': 1.75,
|
||||||
|
};
|
||||||
|
|
||||||
|
const getMixedColor = (this as Renderer).getMixedColor.bind(this);
|
||||||
Object.entries(variableMap).map(([variable, color]) => {
|
Object.entries(variableMap).map(([variable, color]) => {
|
||||||
|
const key = colorKeyMap[variable] ?? COLOR_KEY;
|
||||||
|
const ratio = ratioMap[variable] ?? undefined;
|
||||||
|
|
||||||
document.documentElement.style.setProperty(
|
document.documentElement.style.setProperty(
|
||||||
variable,
|
variable,
|
||||||
this.getMixedColor(color, COLOR_KEY, alpha),
|
getMixedColor(color, key, alpha, ratio),
|
||||||
'important',
|
'important',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.style.setProperty(
|
|
||||||
'background',
|
|
||||||
this.getMixedColor('rgba(3, 3, 3)', DARK_COLOR_KEY, alpha),
|
|
||||||
'important',
|
|
||||||
);
|
|
||||||
document.documentElement.style.setProperty(
|
|
||||||
'--ytmusic-background',
|
|
||||||
// #030303
|
|
||||||
this.getMixedColor('rgba(3, 3, 3)', DARK_COLOR_KEY, alpha),
|
|
||||||
'important',
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -81,3 +81,14 @@ ytmusic-browse-response[has-background]:not([disable-gradient]) .background-grad
|
|||||||
#background.immersive-background.style-scope.ytmusic-browse-response {
|
#background.immersive-background.style-scope.ytmusic-browse-response {
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ytmusic-search-box[is-bauhaus-sidenav-enabled] {
|
||||||
|
--ytmusic-search-background: var(--ytmusic-color-black3) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seekbar-theme #progress-bar.ytmusic-player-bar {
|
||||||
|
--paper-slider-active-color: linear-gradient(to right, var(--paper-progress-active-color-1) 80%, var(--paper-progress-active-color-2) 100%) !important;
|
||||||
|
--paper-slider-knob-color: var(--paper-progress-active-color-1) !important;
|
||||||
|
--paper-slider-knob-start-color: var(--paper-progress-active-color-2) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import {
|
|||||||
UniversalCache,
|
UniversalCache,
|
||||||
Utils,
|
Utils,
|
||||||
YTNodes,
|
YTNodes,
|
||||||
|
Platform,
|
||||||
} from '\u0079\u006f\u0075\u0074\u0075\u0062\u0065i.js';
|
} from '\u0079\u006f\u0075\u0074\u0075\u0062\u0065i.js';
|
||||||
import is from 'electron-is';
|
import is from 'electron-is';
|
||||||
import filenamify from 'filenamify';
|
import filenamify from 'filenamify';
|
||||||
@ -57,6 +58,22 @@ const ffmpeg = lazy(async () =>
|
|||||||
);
|
);
|
||||||
const ffmpegMutex = new Mutex();
|
const ffmpegMutex = new Mutex();
|
||||||
|
|
||||||
|
Platform.shim.eval = async (data: Types.BuildScriptResult, env: Record<string, Types.VMPrimative>) => {
|
||||||
|
const properties = [];
|
||||||
|
|
||||||
|
if(env.n) {
|
||||||
|
properties.push(`n: exportedVars.nFunction("${env.n}")`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (env.sig) {
|
||||||
|
properties.push(`sig: exportedVars.sigFunction("${env.sig}")`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const code = `${data.output}\nreturn { ${properties.join(', ')} }`;
|
||||||
|
|
||||||
|
return new Function(code)();
|
||||||
|
}
|
||||||
|
|
||||||
let yt: Innertube;
|
let yt: Innertube;
|
||||||
let win: BrowserWindow;
|
let win: BrowserWindow;
|
||||||
let playingUrl: string;
|
let playingUrl: string;
|
||||||
@ -131,7 +148,6 @@ export const onMainLoad = async ({
|
|||||||
|
|
||||||
yt = await Innertube.create({
|
yt = await Innertube.create({
|
||||||
cache: new UniversalCache(false),
|
cache: new UniversalCache(false),
|
||||||
player_id: '0004de42',
|
|
||||||
cookie: await getCookieFromWindow(win),
|
cookie: await getCookieFromWindow(win),
|
||||||
generate_session_locally: true,
|
generate_session_locally: true,
|
||||||
fetch: getNetFetchAsFetch(),
|
fetch: getNetFetchAsFetch(),
|
||||||
|
|||||||
Reference in New Issue
Block a user