feat: add ability to manually scrobble track (#91)

* feat: add button to manually scrobble from ui

* fix: ensure timestamp is in the past, log fix

* test: add integration test
This commit is contained in:
Gabe Farrell 2025-11-18 19:02:28 -05:00 committed by GitHub
parent 1be573e720
commit 300bac0e19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 185 additions and 1 deletions

View file

@ -103,6 +103,19 @@ function logout(): Promise<Response> {
function getCfg(): Promise<Config> {
return fetch(`/apis/web/v1/config`).then(r => r.json() as Promise<Config>)
}
function submitListen(id: string, ts: Date): Promise<Response> {
const form = new URLSearchParams
form.append("track_id", id)
const ms = new Date(ts).getTime()
const unix= Math.floor(ms / 1000);
form.append("unix", unix.toString())
return fetch(`/apis/web/v1/listen`, {
method: "POST",
body: form,
})
}
function getApiKeys(): Promise<ApiKey[]> {
@ -232,6 +245,7 @@ export {
deleteListen,
getAlbum,
getExport,
submitListen,
}
type Track = {
id: number