feat: expose playlist imports over HTTP

This commit is contained in:
DiheChen committed 2026-11-11 00:01:47 +08:00
1 parent 9256f64e24
commit 649916ab9d
11 files changed
+866 -6

No files matched your search

@@ -19,6 +19,14 @@ location ^~ /api/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://$serve;
}
# 取值必须不小于 serve 对导入文件接口的请求体上限 maxImportBodyBytes(1 MiB),原因同上。
location = /api/me/playlists/imports {
client_max_body_size 1m;
client_body_buffer_size 1m;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://$serve;
}
}
location ^~ /media/ {
proxy_pass http://$serve;
+34 -1
View File
@@ -1,6 +1,6 @@
// Code generated by protocolgen from protocol/idl.json; DO NOT EDIT.
import type { APIKey, Account, AdminAccount, ErrorInfo, Member, MyPlaylist, MyPlaylistItem, QQLoginType, QRLogin, QRLoginResult, RoomListing, SourceAccount, StoredMedia, Track } from '../realtime/protocol.gen'
import type { APIKey, Account, AdminAccount, ErrorInfo, ImportedTrack, Member, MyPlaylist, MyPlaylistItem, QQLoginType, QRLogin, QRLoginResult, RoomListing, Source, SourceAccount, StoredMedia, Track } from '../realtime/protocol.gen'
export interface AddMyPlaylistItemRequest {
track: Track
@@ -157,6 +157,27 @@ export interface GetSiteResponse {
registrationOpen: boolean
}
export interface ImportMyPlatformPlaylistRequest {
name: string
playlistId: string
source: Source
}
export interface ImportMyPlatformPlaylistResponse {
imported: number
playlist: MyPlaylist
}
export interface ImportMyPlaylistRequest {
name: string
tracks: ImportedTrack[]
}
export interface ImportMyPlaylistResponse {
imported: number
playlist: MyPlaylist
}
export interface ListMyPlaylistItemsResponse {
items: MyPlaylistItem[]
}
@@ -212,6 +233,15 @@ export interface RenameMyPlaylistRequest {
name: string
}
export interface ResolveMyPlaylistLinkRequest {
link: string
}
export interface ResolveMyPlaylistLinkResponse {
playlistId: string
source: Source
}
export interface UpdateMeRequest {
email?: string
name?: string
@@ -255,6 +285,9 @@ export function httpClient(send: HttpSend) {
copyMyPlaylistItems: (id: string, body: CopyMyPlaylistItemsRequest) => send<CopyMyPlaylistItemsResponse>({ method: 'POST', path: `/api/me/playlists/${encodeURIComponent(id)}/copies`, auth: 'member', body }),
moveMyPlaylistItems: (id: string, body: MoveMyPlaylistItemsRequest) => send<void>({ method: 'POST', path: `/api/me/playlists/${encodeURIComponent(id)}/moves`, auth: 'member', body }),
listMyTrackPlaylists: (body: ListMyTrackPlaylistsRequest) => send<ListMyTrackPlaylistsResponse>({ method: 'POST', path: '/api/me/playlist-memberships', auth: 'member', body }),
importMyPlaylist: (body: ImportMyPlaylistRequest) => send<ImportMyPlaylistResponse>({ method: 'POST', path: '/api/me/playlists/imports', auth: 'member', body }),
resolveMyPlaylistLink: (body: ResolveMyPlaylistLinkRequest) => send<ResolveMyPlaylistLinkResponse>({ method: 'POST', path: '/api/me/playlist-links', auth: 'member', body }),
importMyPlatformPlaylist: (body: ImportMyPlatformPlaylistRequest) => send<ImportMyPlatformPlaylistResponse>({ method: 'POST', path: '/api/me/playlists/platform-imports', auth: 'member', body }),
listRooms: () => send<ListRoomsResponse>({ method: 'GET', path: '/api/rooms', auth: 'none' }),
getRoom: (ref: string) => send<RoomListing>({ method: 'GET', path: `/api/rooms/${encodeURIComponent(ref)}`, auth: 'none' }),
createRoom: (body: CreateRoomRequest) => send<CreateRoomResponse>({ method: 'POST', path: '/api/rooms', auth: 'none', body }),
+11 -1
View File
@@ -1,6 +1,6 @@
// Code generated by protocolgen from protocol/idl.json; DO NOT EDIT.
export const PROTOCOL_VERSION = 'cdc97c61b16da452'
export const PROTOCOL_VERSION = 'ed36759d403f9894'
export interface APIKey {
key: string
@@ -61,6 +61,16 @@ export interface HelloResponse {
serverTimeMs: number
}
export interface ImportedTrack {
album?: string
artist?: string
coverUrl?: string
durationMs: number
pageUrl?: string
title: string
track: Track
}
export interface Member {
avatarHash: string
id: string