feat(api-server): Improved api-server volume and like/dislike state (#3592)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: rewhex <gitea@cluser.local>
Co-authored-by: JellyBrick <shlee1503@naver.com>
This commit is contained in:
REWHEX
2025-09-05 18:59:39 +04:00
committed by GitHub
parent 96ea114335
commit 8b10872e83
7 changed files with 117 additions and 23 deletions

View File

@ -22,7 +22,7 @@ import getSongControls from '@/providers/song-controls';
import config from '@/config';
import { LoggerPrefix } from '@/utils';
import type { RepeatMode } from '@/types/datahost-get-state';
import type { RepeatMode, VolumeState } from '@/types/datahost-get-state';
import type { QueueResponse } from '@/types/youtube-music-desktop-internal';
class YTPlayer extends MprisPlayer {
@ -305,8 +305,10 @@ function registerMPRIS(win: BrowserWindow) {
console.trace(error);
});
ipcMain.on('ytmd:volume-changed', (_, newVol) => {
player.volume = Number.parseFloat((newVol / 100).toFixed(2));
ipcMain.on('ytmd:volume-changed', (_, newVolumeState: VolumeState) => {
player.volume = newVolumeState.isMuted
? 0
: Number.parseFloat((newVolumeState.state / 100).toFixed(2));
});
player.on('volume', async (newVolume: number) => {