mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 02:51:46 +00:00
feat(api-server): add endpoint to get volume state (#2813)
* add volume getter * format * add volume route
This commit is contained in:
@ -27,6 +27,7 @@ export const backend = createBackend<BackendType, APIServerConfig>({
|
||||
ctx.ipc.on('ytmd:player-api-loaded', () => {
|
||||
ctx.ipc.send('ytmd:setup-time-changed-listener');
|
||||
ctx.ipc.send('ytmd:setup-repeat-changed-listener');
|
||||
ctx.ipc.send('ytmd:setup-volume-changed-listener');
|
||||
});
|
||||
|
||||
ctx.ipc.on(
|
||||
@ -34,6 +35,11 @@ export const backend = createBackend<BackendType, APIServerConfig>({
|
||||
(mode: RepeatMode) => (this.currentRepeatMode = mode),
|
||||
);
|
||||
|
||||
ctx.ipc.on(
|
||||
'ytmd:volume-changed',
|
||||
(newVolume: number) => (this.volume = newVolume),
|
||||
);
|
||||
|
||||
this.run(config.hostname, config.port);
|
||||
},
|
||||
stop() {
|
||||
@ -95,6 +101,7 @@ export const backend = createBackend<BackendType, APIServerConfig>({
|
||||
ctx,
|
||||
() => this.songInfo,
|
||||
() => this.currentRepeatMode,
|
||||
() => this.volume,
|
||||
);
|
||||
registerAuth(this.app, ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user