Spaces:
Sleeping
Sleeping
Download dashboard/features/clips/api.js from JuanCS-Dev/twitch-byte-bot: direct link, hf CLI and curl.
- Browser
- Download file 884 Bytes
-
https://huggingface.co/spaces/JuanCS-Dev/twitch-byte-bot/resolve/main/dashboard/features/clips/api.js
- Command line
-
hf download hf://spaces/JuanCS-Dev/twitch-byte-bot/dashboard/features/clips/api.js
-
curl -L -o api.js https://huggingface.co/spaces/JuanCS-Dev/twitch-byte-bot/resolve/main/dashboard/features/clips/api.js
884 Bytes
| import { fetchWithTimeout } from "../shared/api.js"; | |
| import { getStorageItem } from "../shared/dom.js"; | |
| const TOKEN_KEY = "byte_dashboard_admin_token"; | |
| function authHeaders() { | |
| const headers = {}; | |
| const token = getStorageItem(TOKEN_KEY); | |
| if (token) { | |
| headers["X-Byte-Admin-Token"] = token; | |
| } | |
| return headers; | |
| } | |
| export async function fetchClipJobs() { | |
| const res = await fetchWithTimeout("./api/clip-jobs", { method: "GET" }); | |
| return res; | |
| } | |
| export async function fetchVisionStatus() { | |
| return await fetchWithTimeout("./api/vision/status", { method: "GET" }); | |
| } | |
| export async function postVisionIngest(fileOrBlob) { | |
| const headers = authHeaders(); | |
| headers["Content-Type"] = fileOrBlob.type || "image/jpeg"; | |
| return await fetchWithTimeout("./api/vision/ingest", { | |
| method: "POST", | |
| headers: headers, | |
| body: fileOrBlob | |
| }); | |
| } | |