Feature: Your spotify widget (#5813)

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Yevhen Kuzmovych
2025-09-25 06:08:15 +02:00
committed by GitHub
parent 4028194830
commit 02089a35ee
8 changed files with 148 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { asJson } from "utils/proxy/api-helpers";
import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/spotify/{endpoint}?token={key}",
proxyHandler: genericProxyHandler,
mappings: {
songs: {
endpoint: "songs_per",
params: ["start", "timeSplit"],
map: (data) => asJson(data)[0]?.count || 0,
},
time: {
endpoint: "time_per",
params: ["start", "timeSplit"],
map: (data) => asJson(data)[0]?.count || 0,
},
artists: {
endpoint: "different_artists_per",
params: ["start", "timeSplit"],
map: (data) => asJson(data)[0]?.artists?.length || 0,
},
},
};
export default widget;