fix: apply fix from eslint

This commit is contained in:
JellyBrick
2024-10-13 22:45:11 +09:00
parent f42f20f770
commit cb1381bbb3
85 changed files with 1858 additions and 1042 deletions

View File

@ -2,9 +2,10 @@ import { createRoute, z } from '@hono/zod-openapi';
import { dialog } from 'electron';
import { sign } from 'hono/jwt';
import { t } from '@/i18n';
import { getConnInfo } from '@hono/node-server/conninfo';
import { t } from '@/i18n';
import { APIServerConfig } from '../../config';
import { JWTPayload } from '../scheme';
@ -20,7 +21,7 @@ const routes = {
request: {
params: z.object({
id: z.string(),
})
}),
},
responses: {
200: {
@ -40,7 +41,10 @@ const routes = {
}),
};
export const register = (app: HonoApp, { getConfig, setConfig }: BackendContext<APIServerConfig>) => {
export const register = (
app: HonoApp,
{ getConfig, setConfig }: BackendContext<APIServerConfig>,
) => {
app.openapi(routes.request, async (ctx) => {
const config = await getConfig();
const { id } = ctx.req.param();
@ -54,7 +58,10 @@ export const register = (app: HonoApp, { getConfig, setConfig }: BackendContext<
origin: getConnInfo(ctx).remote.address,
id,
}),
buttons: [t('plugins.api-server.dialog.request.buttons.allow'), t('plugins.api-server.dialog.request.deny')],
buttons: [
t('plugins.api-server.dialog.request.buttons.allow'),
t('plugins.api-server.dialog.request.deny'),
],
defaultId: 1,
cancelId: 1,
});
@ -68,10 +75,7 @@ export const register = (app: HonoApp, { getConfig, setConfig }: BackendContext<
}
setConfig({
authorizedClients: [
...config.authorizedClients,
id,
],
authorizedClients: [...config.authorizedClients, id],
});
const token = await sign(

View File

@ -84,7 +84,8 @@ const routes = {
method: 'post',
path: `/api/${API_VERSION}/toggle-play`,
summary: 'Toggle play/pause',
description: 'Change the state of the player to play if paused, or pause if playing',
description:
'Change the state of the player to play if paused, or pause if playing',
request: {
headers: AuthHeadersSchema,
},
@ -280,7 +281,7 @@ const routes = {
schema: z.object({
state: z.boolean(),
}),
}
},
},
},
},
@ -299,7 +300,7 @@ const routes = {
content: {
'application/json': {
schema: z.object({}),
}
},
},
},
204: {
@ -321,7 +322,7 @@ const routes = {
content: {
'application/json': {
schema: SongInfoSchema,
}
},
},
},
204: {
@ -331,7 +332,11 @@ const routes = {
}),
};
export const register = (app: HonoApp, { window }: BackendContext<APIServerConfig>, songInfoGetter: () => SongInfo | undefined) => {
export const register = (
app: HonoApp,
{ window }: BackendContext<APIServerConfig>,
songInfoGetter: () => SongInfo | undefined,
) => {
const controller = getSongControls(window);
app.openapi(routes.previous, (ctx) => {
@ -426,9 +431,12 @@ export const register = (app: HonoApp, { window }: BackendContext<APIServerConfi
app.openapi(routes.getFullscreenState, async (ctx) => {
const stateResponsePromise = new Promise<boolean>((resolve) => {
ipcMain.once('ytmd:set-fullscreen', (_, isFullscreen: boolean | undefined) => {
return resolve(!!isFullscreen);
});
ipcMain.once(
'ytmd:set-fullscreen',
(_, isFullscreen: boolean | undefined) => {
return resolve(!!isFullscreen);
},
);
controller.requestFullscreenInformation();
});