fix(api-server): repeat event listener

This commit is contained in:
JellyBrick
2024-12-25 13:08:02 +09:00
parent 1cc153084d
commit 3ea13a2a22

View File

@ -24,9 +24,10 @@ export const backend = createBackend<BackendType, APIServerConfig>({
this.songInfo = songInfo; this.songInfo = songInfo;
}); });
ctx.ipc.on('ytmd:player-api-loaded', () => ctx.ipc.on('ytmd:player-api-loaded', () => {
ctx.ipc.send('ytmd:setup-time-changed-listener'), ctx.ipc.send('ytmd:setup-time-changed-listener');
); ctx.ipc.send('ytmd:setup-repeat-changed-listener');
});
ctx.ipc.on( ctx.ipc.on(
'ytmd:repeat-changed', 'ytmd:repeat-changed',
@ -59,6 +60,12 @@ export const backend = createBackend<BackendType, APIServerConfig>({
this.app.use('*', cors()); this.app.use('*', cors());
// for web remote control
this.app.use('*', async (ctx, next) => {
ctx.header('Access-Control-Request-Private-Network', 'true');
await next();
});
// middlewares // middlewares
this.app.use('/api/*', async (ctx, next) => { this.app.use('/api/*', async (ctx, next) => {
if (config.authStrategy !== AuthStrategy.NONE) { if (config.authStrategy !== AuthStrategy.NONE) {