Spaces:
Sleeping
Sleeping
Download web/src/refiner.js from brianbellx/codehygiene: direct link, hf CLI and curl.
- Browser
- Download file 670 Bytes
-
https://huggingface.co/spaces/brianbellx/codehygiene/resolve/main/web/src/refiner.js
- Command line
-
hf download hf://spaces/brianbellx/codehygiene/web/src/refiner.js
-
curl -L -o refiner.js https://huggingface.co/spaces/brianbellx/codehygiene/resolve/main/web/src/refiner.js
670 Bytes
| // Pages below the site root (the leaderboard) set data-root="../" so API calls still reach /api. | |
| const SITE_ROOT = new URL(document.documentElement.dataset.root ?? "./", document.baseURI); | |
| export function apiUrl(path) { | |
| return new URL(`api/${path}`, SITE_ROOT).href; | |
| } | |
| async function getJson(path, label) { | |
| const response = await fetch(apiUrl(path), { cache: "no-store" }); | |
| if (!response.ok) { | |
| throw new Error(`${label} failed (${response.status})`); | |
| } | |
| return response.json(); | |
| } | |
| export function fetchStats() { | |
| return getJson("stats", "Stats request"); | |
| } | |
| export function fetchLeaderboard() { | |
| return getJson("leaderboard", "Leaderboard request"); | |
| } | |