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

@ -1,5 +1,6 @@
// This is used for to control the songs
import { type BrowserWindow, ipcMain } from 'electron';
import { LikeType } from '@/types/datahost-get-state';
// see protocol-handler.ts
type ArgsType<T> = T | string[] | undefined;
@ -42,8 +43,8 @@ export default (win: BrowserWindow) => {
play: () => win.webContents.send('ytmd:play'),
pause: () => win.webContents.send('ytmd:pause'),
playPause: () => win.webContents.send('ytmd:toggle-play'),
like: () => win.webContents.send('ytmd:update-like', 'LIKE'),
dislike: () => win.webContents.send('ytmd:update-like', 'DISLIKE'),
like: () => win.webContents.send('ytmd:update-like', LikeType.Like),
dislike: () => win.webContents.send('ytmd:update-like', LikeType.Dislike),
seekTo: (seconds: ArgsType<number>) => {
const secondsNumber = parseNumberFromArgsType(seconds);
if (secondsNumber !== null) {