chore: improve readability

This commit is contained in:
Su-Yong
2025-10-12 14:28:29 +09:00
parent 4f716d8e0b
commit ffa61687bf
137 changed files with 2625 additions and 2626 deletions

View File

@ -29,22 +29,22 @@ export const backend = createBackend<BackendType, APIServerConfig>({
this.songInfo = songInfo;
});
ctx.ipc.on('ytmd:player-api-loaded', () => {
ctx.ipc.send('ytmd:setup-seeked-listener');
ctx.ipc.send('ytmd:setup-time-changed-listener');
ctx.ipc.send('ytmd:setup-repeat-changed-listener');
ctx.ipc.send('ytmd:setup-like-changed-listener');
ctx.ipc.send('ytmd:setup-volume-changed-listener');
ctx.ipc.send('ytmd:setup-shuffle-changed-listener');
ctx.ipc.on('peard:player-api-loaded', () => {
ctx.ipc.send('peard:setup-seeked-listener');
ctx.ipc.send('peard:setup-time-changed-listener');
ctx.ipc.send('peard:setup-repeat-changed-listener');
ctx.ipc.send('peard:setup-like-changed-listener');
ctx.ipc.send('peard:setup-volume-changed-listener');
ctx.ipc.send('peard:setup-shuffle-changed-listener');
});
ctx.ipc.on(
'ytmd:repeat-changed',
'peard:repeat-changed',
(mode: RepeatMode) => (this.currentRepeatMode = mode),
);
ctx.ipc.on(
'ytmd:volume-changed',
'peard:volume-changed',
(newVolumeState: VolumeState) => (this.volumeState = newVolumeState),
);
@ -138,7 +138,7 @@ export const backend = createBackend<BackendType, APIServerConfig>({
openapi: '3.1.0',
info: {
version: '1.0.0',
title: 'Youtube Music API Server',
title: 'Pear Desktop API Server',
description:
'Note: You need to get an access token using the `/auth/{id}` endpoint first to call any API endpoints under `/api`.',
},

View File

@ -29,7 +29,7 @@ import type { SongInfo } from '@/providers/song-info';
import type { BackendContext } from '@/types/contexts';
import type { APIServerConfig } from '../../config';
import type { HonoApp } from '../types';
import type { QueueResponse } from '@/types/youtube-music-desktop-internal';
import type { QueueResponse } from '@/types/music-player-desktop-internal';
import type { Context } from 'hono';
const routes = {
@ -630,7 +630,7 @@ export const register = (
app.openapi(routes.getShuffleState, async (ctx) => {
const stateResponsePromise = new Promise<boolean>((resolve) => {
ipcMain.once(
'ytmd:get-shuffle-response',
'peard:get-shuffle-response',
(_, isShuffled: boolean | undefined) => {
return resolve(!!isShuffled);
},
@ -693,7 +693,7 @@ export const register = (
app.openapi(routes.getFullscreenState, async (ctx) => {
const stateResponsePromise = new Promise<boolean>((resolve) => {
ipcMain.once(
'ytmd:set-fullscreen',
'peard:set-fullscreen',
(_, isFullscreen: boolean | undefined) => {
return resolve(!!isFullscreen);
},
@ -728,7 +728,7 @@ export const register = (
// Queue
const queueInfo = async (ctx: Context) => {
const queueResponsePromise = new Promise<QueueResponse>((resolve) => {
ipcMain.once('ytmd:get-queue-response', (_, queue: QueueResponse) => {
ipcMain.once('peard:get-queue-response', (_, queue: QueueResponse) => {
return resolve(queue);
});

View File

@ -94,7 +94,7 @@ export const register = (
lastSongInfo = { ...songInfo };
});
ipc.on('ytmd:volume-changed', (newVolumeState: VolumeState) => {
ipc.on('peard:volume-changed', (newVolumeState: VolumeState) => {
volumeState = newVolumeState;
send(DataTypes.VolumeChanged, {
volume: volumeState.state,
@ -102,16 +102,16 @@ export const register = (
});
});
ipc.on('ytmd:repeat-changed', (mode: RepeatMode) => {
ipc.on('peard:repeat-changed', (mode: RepeatMode) => {
repeat = mode;
send(DataTypes.RepeatChanged, { repeat });
});
ipc.on('ytmd:seeked', (t: number) => {
ipc.on('peard:seeked', (t: number) => {
send(DataTypes.PositionChanged, { position: t });
});
ipc.on('ytmd:shuffle-changed', (newShuffle: boolean) => {
ipc.on('peard:shuffle-changed', (newShuffle: boolean) => {
shuffle = newShuffle;
send(DataTypes.ShuffleChanged, { shuffle });
});