feat: read, remove and clear listening history and switch recording over HTTP

This commit is contained in:
DiheChen committed 2026-11-10 12:24:22 +08:00
1 parent c6f53953b4
commit fe05ac5486
14 files changed
+722 -18

No files matched your search

+17 -1
View File
@@ -1,6 +1,6 @@
// Code generated by protocolgen from protocol/idl.json; DO NOT EDIT.
import type { APIKey, Account, AdminAccount, ErrorInfo, ImportedTrack, Member, MyPlaylist, MyPlaylistItem, QQLoginType, QRLogin, QRLoginResult, RoomListing, Source, SourceAccount, StoredMedia, Track } from '../realtime/protocol.gen'
import type { APIKey, Account, AdminAccount, ErrorInfo, ImportedTrack, Member, MyListen, MyPlaylist, MyPlaylistItem, QQLoginType, QRLogin, QRLoginResult, RoomListing, Source, SourceAccount, StoredMedia, Track } from '../realtime/protocol.gen'
export interface AddMyPlaylistItemRequest {
track: Track
@@ -147,9 +147,12 @@ export interface CreateTicketResponse {
ticket: string
}
export type EnableListenRecordingRequest = Record<string, never>
export interface GetMeResponse {
account?: Account
member: Member
recordListens: boolean
}
export interface GetSiteResponse {
@@ -178,6 +181,10 @@ export interface ImportMyPlaylistResponse {
playlist: MyPlaylist
}
export interface ListMyListensResponse {
items: MyListen[]
}
export interface ListMyPlaylistItemsResponse {
items: MyPlaylistItem[]
}
@@ -225,6 +232,10 @@ export interface RegisterResponse {
account: Account
}
export interface RemoveMyListenRequest {
track: Track
}
export interface RemoveMyPlaylistItemsRequest {
tracks: Track[]
}
@@ -318,5 +329,10 @@ export function httpClient(send: HttpSend) {
adminCloseRegistration: () => send<void>({ method: 'DELETE', path: '/api/admin/registration', auth: 'admin' }),
adminGetAccount: (username: string) => send<AdminAccount>({ method: 'GET', path: `/api/admin/accounts/${encodeURIComponent(username)}`, auth: 'admin' }),
adminResetAccountPassword: (username: string) => send<AdminResetAccountPasswordResponse>({ method: 'POST', path: `/api/admin/accounts/${encodeURIComponent(username)}/password`, auth: 'admin', body: {} }),
listMyListens: () => send<ListMyListensResponse>({ method: 'GET', path: '/api/me/listens', auth: 'member' }),
removeMyListen: (body: RemoveMyListenRequest) => send<void>({ method: 'POST', path: '/api/me/listens/removals', auth: 'member', body }),
clearMyListens: () => send<void>({ method: 'DELETE', path: '/api/me/listens', auth: 'member' }),
enableListenRecording: () => send<void>({ method: 'PUT', path: '/api/me/listen-recording', auth: 'member', body: {} }),
disableListenRecording: () => send<void>({ method: 'DELETE', path: '/api/me/listen-recording', auth: 'member' }),
}
}
+7 -1
View File
@@ -1,6 +1,6 @@
// Code generated by protocolgen from protocol/idl.json; DO NOT EDIT.
export const PROTOCOL_VERSION = 'ed36759d403f9894'
export const PROTOCOL_VERSION = 'ae9a632d648f3840'
export interface APIKey {
key: string
@@ -82,6 +82,12 @@ export interface Members {
sessions: Member[]
}
export interface MyListen {
heardAtMs: number
meta: TrackMeta
track: Track
}
export interface MyPlaylist {
coverUrl: string | null
createdAtMs: number