新增HTTP开放API服务

This commit is contained in:
lyswhut
2024-03-29 14:43:32 +08:00
parent 1e03791e82
commit 9c0ae12959
35 changed files with 681 additions and 340 deletions
+11
View File
@@ -619,6 +619,17 @@ declare global {
*/
'sync.client.host': string
/**
* 是否启用开放API服务
*/
'openAPI.enable': boolean
/**
* 同步服务端口号
*/
'openAPI.port': '23333' | string
/**
* 是否在离开搜索界面时自动清空搜索框
*/
+25
View File
@@ -0,0 +1,25 @@
declare namespace LX {
namespace OpenAPI {
interface Status {
status: boolean
message: string
address: string
}
interface EnableServer {
enable: boolean
port: string
}
interface ActionBase <A> {
action: A
}
interface ActionData<A, D> extends ActionBase<A> {
data: D
}
type Action<A, D = undefined> = D extends undefined ? ActionBase<A> : ActionData<A, D>
type Actions = Action<'status'>
| Action<'enable', EnableServer>
}
}
+13
View File
@@ -15,5 +15,18 @@ declare namespace LX {
interface LyricInfo extends LX.Music.LyricInfo {
rawlrcInfo: LX.Music.LyricInfo
}
interface Status {
status: 'playing' | 'paused' | 'error' | 'stoped'
name: string
singer: string
albumName: string
picUrl: string
progress: number
duration: number
lyricLineText: string
lyric: string
collect: boolean
}
}
}