mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 04:41:47 +00:00
chore: improve readability
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Application ID registered by @th-ch/youtube-music dev team
|
||||
* Application ID registered by @th-ch/pear-desktop dev team
|
||||
*/
|
||||
export const clientId = '1177081335727267940';
|
||||
/**
|
||||
|
||||
@ -24,9 +24,9 @@ export type DiscordPluginConfig = {
|
||||
*/
|
||||
activityTimeoutTime: number;
|
||||
/**
|
||||
* Add a "Play on YouTube Music" button to rich presence
|
||||
* Add a "Play on Pear Desktop" button to rich presence
|
||||
*/
|
||||
playOnYouTubeMusic: boolean;
|
||||
playOnPearDesktop: boolean;
|
||||
/**
|
||||
* Hide the "View App On GitHub" button in the rich presence
|
||||
*/
|
||||
@ -50,7 +50,7 @@ export default createPlugin({
|
||||
autoReconnect: true,
|
||||
activityTimeoutEnabled: true,
|
||||
activityTimeoutTime: 10 * 60 * 1000,
|
||||
playOnYouTubeMusic: true,
|
||||
playOnPearDesktop: true,
|
||||
hideGitHubButton: false,
|
||||
hideDurationLeft: false,
|
||||
statusDisplayType: StatusDisplayType.Details,
|
||||
|
||||
@ -45,8 +45,8 @@ export const backend = createBackend<
|
||||
});
|
||||
}
|
||||
|
||||
ctx.ipc.on('ytmd:player-api-loaded', () => {
|
||||
ctx.ipc.send('ytmd:setup-time-changed-listener');
|
||||
ctx.ipc.on('peard:player-api-loaded', () => {
|
||||
ctx.ipc.send('peard:setup-time-changed-listener');
|
||||
});
|
||||
|
||||
app.on('before-quit', () => {
|
||||
|
||||
@ -18,7 +18,7 @@ const registerRefreshOnce = singleton((refreshMenu: () => void) => {
|
||||
|
||||
const DiscordStatusDisplayTypeLabels: Record<StatusDisplayType, string> = {
|
||||
[StatusDisplayType.Name]:
|
||||
'plugins.discord.menu.set-status-display-type.submenu.youtube-music',
|
||||
'plugins.discord.menu.set-status-display-type.submenu.pear-desktop',
|
||||
[StatusDisplayType.State]:
|
||||
'plugins.discord.menu.set-status-display-type.submenu.artist',
|
||||
[StatusDisplayType.Details]:
|
||||
@ -67,12 +67,12 @@ export const onMenu = async ({
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('plugins.discord.menu.play-on-youtube-music'),
|
||||
label: t('plugins.discord.menu.play-on-pear-desktop'),
|
||||
type: 'checkbox',
|
||||
checked: config.playOnYouTubeMusic,
|
||||
checked: config.playOnPearDesktop,
|
||||
click(item: Electron.MenuItem) {
|
||||
setConfig({
|
||||
playOnYouTubeMusic: item.checked,
|
||||
playOnPearDesktop: item.checked,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@ -28,16 +28,16 @@ export const buildDiscordButtons = (
|
||||
songInfo: SongInfo,
|
||||
): GatewayActivityButton[] | undefined => {
|
||||
const buttons: GatewayActivityButton[] = [];
|
||||
if (config.playOnYouTubeMusic && songInfo.url) {
|
||||
if (config.playOnPearDesktop && songInfo.url) {
|
||||
buttons.push({
|
||||
label: 'Play on YouTube Music',
|
||||
label: 'Play on Pear Desktop',
|
||||
url: songInfo.url,
|
||||
});
|
||||
}
|
||||
if (!config.hideGitHubButton) {
|
||||
buttons.push({
|
||||
label: 'View App On GitHub',
|
||||
url: 'https://github.com/th-ch/youtube-music',
|
||||
url: 'https://github.com/pear-devs/pear-desktop',
|
||||
});
|
||||
}
|
||||
return buttons.length ? buttons : undefined;
|
||||
|
||||
Reference in New Issue
Block a user