mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 03:11:46 +00:00
feat(api-server): remote control api (#1909)
Co-authored-by: JellyBrick <shlee1503@naver.com> Co-authored-by: Angelos Bouklis <angelbouklis.official@gmail.com> Co-authored-by: Angelos Bouklis <me@arjix.dev> Co-authored-by: Angelos Bouklis <53124886+ArjixWasTaken@users.noreply.github.com>
This commit is contained in:
13
src/plugins/api-server/backend/scheme/auth.ts
Normal file
13
src/plugins/api-server/backend/scheme/auth.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { z } from '@hono/zod-openapi';
|
||||
|
||||
export const AuthHeadersSchema = z.object({
|
||||
authorization: z.string().openapi({
|
||||
example: 'Bearer token',
|
||||
}),
|
||||
});
|
||||
|
||||
export type JWTPayload = z.infer<typeof JWTPayloadSchema>;
|
||||
export const JWTPayloadSchema = z.object({
|
||||
id: z.string(),
|
||||
iat: z.number(),
|
||||
});
|
||||
5
src/plugins/api-server/backend/scheme/go-back.ts
Normal file
5
src/plugins/api-server/backend/scheme/go-back.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { z } from '@hono/zod-openapi';
|
||||
|
||||
export const GoBackSchema = z.object({
|
||||
seconds: z.number(),
|
||||
});
|
||||
5
src/plugins/api-server/backend/scheme/go-forward.ts
Normal file
5
src/plugins/api-server/backend/scheme/go-forward.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { z } from '@hono/zod-openapi';
|
||||
|
||||
export const GoForwardScheme = z.object({
|
||||
seconds: z.number(),
|
||||
});
|
||||
8
src/plugins/api-server/backend/scheme/index.ts
Normal file
8
src/plugins/api-server/backend/scheme/index.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export * from './auth';
|
||||
export * from './song-info';
|
||||
export * from './go-back';
|
||||
export * from './go-forward';
|
||||
export * from './switch-repeat';
|
||||
export * from './set-volume';
|
||||
export * from './set-fullscreen';
|
||||
|
||||
5
src/plugins/api-server/backend/scheme/set-fullscreen.ts
Normal file
5
src/plugins/api-server/backend/scheme/set-fullscreen.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { z } from '@hono/zod-openapi';
|
||||
|
||||
export const SetFullscreenSchema = z.object({
|
||||
state: z.boolean(),
|
||||
});
|
||||
5
src/plugins/api-server/backend/scheme/set-volume.ts
Normal file
5
src/plugins/api-server/backend/scheme/set-volume.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { z } from '@hono/zod-openapi';
|
||||
|
||||
export const SetVolumeSchema = z.object({
|
||||
volume: z.number(),
|
||||
});
|
||||
26
src/plugins/api-server/backend/scheme/song-info.ts
Normal file
26
src/plugins/api-server/backend/scheme/song-info.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { z } from '@hono/zod-openapi';
|
||||
|
||||
import { MediaType } from '@/providers/song-info';
|
||||
|
||||
export type ResponseSongInfo = z.infer<typeof SongInfoSchema>;
|
||||
export const SongInfoSchema = z.object({
|
||||
title: z.string(),
|
||||
artist: z.string(),
|
||||
views: z.number(),
|
||||
uploadDate: z.string().optional(),
|
||||
imageSrc: z.string().nullable().optional(),
|
||||
isPaused: z.boolean().optional(),
|
||||
songDuration: z.number(),
|
||||
elapsedSeconds: z.number().optional(),
|
||||
url: z.string().optional(),
|
||||
album: z.string().nullable().optional(),
|
||||
videoId: z.string(),
|
||||
playlistId: z.string().optional(),
|
||||
mediaType: z.enum([
|
||||
MediaType.Audio,
|
||||
MediaType.OriginalMusicVideo,
|
||||
MediaType.UserGeneratedContent,
|
||||
MediaType.PodcastEpisode,
|
||||
MediaType.OtherVideo,
|
||||
]),
|
||||
});
|
||||
5
src/plugins/api-server/backend/scheme/switch-repeat.ts
Normal file
5
src/plugins/api-server/backend/scheme/switch-repeat.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { z } from '@hono/zod-openapi';
|
||||
|
||||
export const SwitchRepeatSchema = z.object({
|
||||
iteration: z.number(),
|
||||
});
|
||||
Reference in New Issue
Block a user