mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 11:01:45 +00:00
feat(api-server): Add repeat mode and seek time API (#2630)
Co-authored-by: sent44 <sent44@root533.premium-rootserver.net> Co-authored-by: JellyBrick <shlee1503@naver.com>
This commit is contained in:
committed by
GitHub
parent
9163b6f04b
commit
109e9f8166
@ -13,6 +13,7 @@ import { registerAuth, registerControl } from './routes';
|
||||
import { type APIServerConfig, AuthStrategy } from '../config';
|
||||
|
||||
import type { BackendType } from './types';
|
||||
import type { RepeatMode } from '@/types/datahost-get-state';
|
||||
|
||||
export const backend = createBackend<BackendType, APIServerConfig>({
|
||||
async start(ctx) {
|
||||
@ -23,7 +24,14 @@ export const backend = createBackend<BackendType, APIServerConfig>({
|
||||
this.songInfo = songInfo;
|
||||
});
|
||||
|
||||
ctx.ipc.on('ytmd:player-api-loaded', () => ctx.ipc.send('ytmd:setup-time-changed-listener'));
|
||||
ctx.ipc.on('ytmd:player-api-loaded', () =>
|
||||
ctx.ipc.send('ytmd:setup-time-changed-listener'),
|
||||
);
|
||||
|
||||
ctx.ipc.on(
|
||||
'ytmd:repeat-changed',
|
||||
(mode: RepeatMode) => (this.currentRepeatMode = mode),
|
||||
);
|
||||
|
||||
this.run(config.hostname, config.port);
|
||||
},
|
||||
@ -75,7 +83,12 @@ export const backend = createBackend<BackendType, APIServerConfig>({
|
||||
});
|
||||
|
||||
// routes
|
||||
registerControl(this.app, ctx, () => this.songInfo);
|
||||
registerControl(
|
||||
this.app,
|
||||
ctx,
|
||||
() => this.songInfo,
|
||||
() => this.currentRepeatMode,
|
||||
);
|
||||
registerAuth(this.app, ctx);
|
||||
|
||||
// swagger
|
||||
|
||||
Reference in New Issue
Block a user