From d7869671b0a4de99304d5e9a5e731c63bae82c04 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 14:03:32 +0000 Subject: [PATCH 1/6] Migrate from Spotify to TIDAL with a faster, rebuilt app Replace the Spotify integration with TIDAL's v2 API and rebuild the site for speed, responsiveness and resilience. Server - Fetch all public playlists and their cover art in a few paginated requests (filter[owners.id] + include=coverArt) instead of one request per playlist. - Client-credentials auth by default, with a refresh-token fallback and a one-time PKCE sign-in helper (npm run tidal:login) in case TIDAL requires a user to read playlists. - Retries with backoff for network errors, 429 (Retry-After) and 5xx; a fresh token on 401; typed errors that carry TIDAL's own details. - Only public playlists are ever exposed, whichever credentials are used. - Catalogue served from memory with stale-while-revalidate, a last-known-good snapshot on disk, and back-off while TIDAL is failing. - Manifest + delta API with ETags, so browsers fetch only what changed. - Security headers with a per-request CSP nonce; CSP violation and browser error intake; structured logs with request ids; optional Sentry; health endpoint; graceful shutdown. - Content-hashed asset URLs served immutable, without a build step. Browser - Renders instantly from a localStorage copy, then syncs: usually a bodiless 304, otherwise only new or changed playlists are downloaded. - Artwork-first responsive grid: srcset/sizes, lazy loading, first-row priority hints and palette-colour placeholders. - Live search over titles, tags and descriptions; artist/genre tags parsed from titles; sorting; shareable URLs for every view. - Native modal dialog with TIDAL's embedded player, Open in TIDAL and Copy link; Back button and Esc close it; light dismiss. - Clear error, offline, empty and retry states; errors reported to the server. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YXBoVxYxPpig7Tkb6fDbc6 --- .env.example | 40 + .gitignore | 6 +- .nvmrc | 1 + app.js | 187 +- package-lock.json | 1999 +++++++++++++---- package.json | 37 +- public/css/app.css | 948 ++++++++ public/css/component.css | 227 -- public/css/global.css | 40 - public/css/layout.css | 185 -- public/css/reset.css | 0 public/css/tokens.css | 74 - public/css/typography.css | 57 - public/fonts/OFL.txt | 93 + .../fonts/outfit-latin-ext-wght-normal.woff2 | Bin 0 -> 14808 bytes public/fonts/outfit-latin-wght-normal.woff2 | Bin 0 -> 32292 bytes public/js/api.js | 73 + public/js/app.js | 256 --- public/js/constants.js | 20 + public/js/dialog.js | 198 ++ public/js/error-handlers.js | 4 + public/js/filter.js | 61 + public/js/format.js | 33 + public/js/grid.js | 145 ++ public/js/main.js | 347 +++ public/js/modules/DataFetcher.js | 61 - public/js/modules/EventHandlers.js | 82 - public/js/modules/UIManager.js | 55 - public/js/modules/Utils.js | 1 - public/js/report.js | 68 + public/js/store.js | 60 + public/js/sync.js | 100 + public/js/toast.js | 13 + scripts/check-syntax.js | 29 + scripts/tidal-login.js | 129 ++ src/catalogue.js | 158 ++ src/config.js | 94 + src/errors.js | 76 + src/http/app.js | 232 ++ src/http/assets.js | 39 + src/http/reports.js | 92 + src/logger.js | 37 + src/reporting.js | 79 + src/server.js | 92 + src/tidal/auth.js | 91 + src/tidal/client.js | 116 + src/tidal/mock.js | 95 + src/tidal/normalise.js | 116 + src/tidal/playlists.js | 61 + src/tidal/retry.js | 31 + views/error.ejs | 17 + views/index.ejs | 236 +- 52 files changed, 5536 insertions(+), 1755 deletions(-) create mode 100644 .env.example create mode 100644 .nvmrc create mode 100644 public/css/app.css delete mode 100644 public/css/component.css delete mode 100644 public/css/global.css delete mode 100644 public/css/layout.css delete mode 100644 public/css/reset.css delete mode 100644 public/css/tokens.css delete mode 100644 public/css/typography.css create mode 100644 public/fonts/OFL.txt create mode 100644 public/fonts/outfit-latin-ext-wght-normal.woff2 create mode 100644 public/fonts/outfit-latin-wght-normal.woff2 create mode 100644 public/js/api.js delete mode 100644 public/js/app.js create mode 100644 public/js/constants.js create mode 100644 public/js/dialog.js create mode 100644 public/js/error-handlers.js create mode 100644 public/js/filter.js create mode 100644 public/js/format.js create mode 100644 public/js/grid.js create mode 100644 public/js/main.js delete mode 100644 public/js/modules/DataFetcher.js delete mode 100644 public/js/modules/EventHandlers.js delete mode 100644 public/js/modules/UIManager.js delete mode 100644 public/js/modules/Utils.js create mode 100644 public/js/report.js create mode 100644 public/js/store.js create mode 100644 public/js/sync.js create mode 100644 public/js/toast.js create mode 100644 scripts/check-syntax.js create mode 100644 scripts/tidal-login.js create mode 100644 src/catalogue.js create mode 100644 src/config.js create mode 100644 src/errors.js create mode 100644 src/http/app.js create mode 100644 src/http/assets.js create mode 100644 src/http/reports.js create mode 100644 src/logger.js create mode 100644 src/reporting.js create mode 100644 src/server.js create mode 100644 src/tidal/auth.js create mode 100644 src/tidal/client.js create mode 100644 src/tidal/mock.js create mode 100644 src/tidal/normalise.js create mode 100644 src/tidal/playlists.js create mode 100644 src/tidal/retry.js create mode 100644 views/error.ejs diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..d00c898c --- /dev/null +++ b/.env.example @@ -0,0 +1,40 @@ +# Copy to `.env` and fill in. Never commit `.env`. + +# --- TIDAL (required) ------------------------------------------------------- +# From your app at https://developer.tidal.com/dashboard +TIDAL_CLIENT_ID= +TIDAL_CLIENT_SECRET= + +# Your TIDAL user ID — the playlists owned by this user are shown. +# `npm run tidal:login` prints it for you. +TIDAL_USER_ID= + +# Only needed if TIDAL rejects client-credentials access to your playlists. +# Run `npm run tidal:login` once to obtain it. Treat it like a password. +TIDAL_REFRESH_TOKEN= + +# Redirect URI registered in the TIDAL dashboard, used by `npm run tidal:login`. +# TIDAL_REDIRECT_URI=http://localhost:3000/callback + +# ISO 3166-1 country code sent to the TIDAL API. +# TIDAL_COUNTRY_CODE=GB + +# --- Site ------------------------------------------------------------------ +# Public URL of the site (used for social sharing tags). +SITE_URL=https://soundselections.onrender.com +# Link for the "View on TIDAL" button in the footer. Hidden if empty. +TIDAL_PROFILE_URL= + +# --- Behaviour ------------------------------------------------------------- +# How long the server trusts its copy of your playlists before re-checking TIDAL (ms). +CACHE_DURATION=600000 +# PORT=3000 +# LOG_LEVEL=info + +# --- Error reporting (optional) --------------------------------------------- +# Set to send server and browser errors to Sentry (https://sentry.io). +# SENTRY_DSN= + +# --- Local development ------------------------------------------------------ +# Serve generated demo playlists instead of calling TIDAL (`npm run dev:mock`). +# TIDAL_MOCK=1 diff --git a/.gitignore b/.gitignore index 1a76ad53..21e5e072 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ node_modules/ .env -**/.DS_Store \ No newline at end of file +.env.* +!.env.example +.cache/ +coverage/ +**/.DS_Store diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..2bd5a0a9 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22 diff --git a/app.js b/app.js index a4f4dd03..42f4d96e 100644 --- a/app.js +++ b/app.js @@ -1,185 +1,4 @@ -require('dotenv').config(); +// Entry point (kept at the project root so existing `node app.js` start commands keep working). +import { main } from './src/server.js'; -const express = require('express'); -const app = express(); -const axios = require('axios'); -const cache = require('memory-cache'); - -app.set('view engine', 'ejs'); -app.use(express.static('public')); - -const PORT = process.env.PORT || 3000; -app.listen(PORT, () => { - console.log(`Server listening on port ${PORT}`); -}); - -const client_id = process.env.CLIENT_ID; -const client_secret = process.env.CLIENT_SECRET; -const cache_duration = parseInt(process.env.CACHE_DURATION) || 10 * 60 * 1000; -let access_token; - -const getAccessToken = async () => { - try { - const response = await axios({ - url: 'https://accounts.spotify.com/api/token', - method: 'post', - params: { - grant_type: 'client_credentials', - }, - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - Authorization: `Basic ${Buffer.from(`${client_id}:${client_secret}`).toString('base64')}`, - }, - }); - access_token = response.data.access_token; - } catch (error) { - console.error(error); - } -}; - -const retry = async (fn, retries = 3, delay = 1000, backoffFactor = 2) => { - for (let i = 0; i < retries; i++) { - try { - return await fn(); - } catch (error) { - if (i === retries - 1) { - throw error; - } - - if (error.response && error.response.status === 429) { - // Use the 'Retry-After' header if available, otherwise, use the default delay - const retryAfter = error.response.headers['retry-after'] ? parseInt(error.response.headers['retry-after']) * 1000 : delay * Math.pow(backoffFactor, i); - console.log(`Rate limited. Retrying after ${retryAfter / 1000} seconds.`); - await new Promise((resolve) => setTimeout(resolve, retryAfter)); - } else { - await new Promise((resolve) => setTimeout(resolve, delay)); - } - } - } -}; - - - -getAccessToken(); - -app.get('/', (req, res) => { - res.render('index'); -}); - -app.get('/playlists/:userId', async (req, res) => { - try { - const search = req.query.search ? req.query.search.toLowerCase() : ''; - - const cacheKey = `playlists-${req.params.userId}-${search}`; - const cachedPlaylists = cache.get(cacheKey); - - if (cachedPlaylists) { - res.json({ items: cachedPlaylists }); - return; - } - - const limit = 50; - let offset = 0; - let allPlaylists = []; - - while (true) { - const response = await retry(async () => { - const res = await axios.get(`https://api.spotify.com/v1/users/${req.params.userId}/playlists`, { - headers: { - Authorization: `Bearer ${access_token}`, - }, - params: { - limit, - offset, - }, - }); - - if (res.status === 429) { - throw new Error('Rate limited'); - } - - return res; - }); - - console.log('Fetched playlists:', response.data.items); - - allPlaylists.push(...response.data.items); - - if (response.data.items.length < limit) { - break; - } - - offset += limit; - } - - const detailedPlaylistsPromises = allPlaylists.map(async (playlist) => { - const details = await retry(async () => { - const res = await axios.get(`https://api.spotify.com/v1/playlists/${playlist.id}`, { - headers: { - Authorization: `Bearer ${access_token}`, - }, - }); - - if (res.status === 429) { - throw new Error('Rate limited'); - } - - return res; - }); - - return { - ...playlist, - fullDescription: details.data.description || '', - followers: details.data.followers || { total: 0 }, - }; - }); - - const detailedPlaylists = await Promise.all(detailedPlaylistsPromises); - - const filteredPlaylists = detailedPlaylists.filter((playlist) => { - return ( - playlist.name.toLowerCase().includes(search) || - playlist.description.toLowerCase().includes(search) - ); - }); - - console.log('Returning all playlists:', detailedPlaylists); - cache.put(cacheKey, filteredPlaylists, cache_duration); // Cache for cache_duration - res.json({ items: filteredPlaylists }); - } catch (error) { - console.error(error); - res.status(500).json({ error: 'Error fetching playlists', details: error.message }); - } -}); - -app.get('/playlists/:userId/:playlistId', async (req, res) => { - try { - const cacheKey = `playlist-${req.params.playlistId}`; - const cachedPlaylist = cache.get(cacheKey); - - if (cachedPlaylist) { - res.json(cachedPlaylist); - return; - } - - const response = await retry(async () => { - const res = await axios.get(`https://api.spotify.com/v1/playlists/${req.params.playlistId}`, { - headers: { - Authorization: `Bearer ${access_token}`, - }, - }); - - if (res.status === 429) { - throw new Error('Rate limited'); - } - - return res; - }); - - cache.put(cacheKey, response.data, cache_duration); // Cache for cache_duration - res.json(response.data); - } catch (error) { - console.error(error); - res.status(500).send('Error fetching playlist details'); - } -}); +await main(); diff --git a/package-lock.json b/package-lock.json index 140df33d..f10519fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,228 +1,729 @@ { - "name": "my-spotify", - "version": "1.0.0", + "name": "selections", + "version": "2.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "my-spotify", - "version": "1.0.0", - "license": "ISC", + "name": "selections", + "version": "2.0.0", + "license": "MIT", "dependencies": { - "axios": "^1.3.4", - "dotenv": "^16.0.3", - "ejs": "^3.1.9", - "express": "^4.18.2", - "memory-cache": "^0.2.0" + "@sentry/node": "^11.9.0", + "compression": "^1.8.2", + "ejs": "^7.0.2", + "express": "^5.3.0", + "helmet": "^8.3.0", + "pino": "^10.4.0", + "pino-http": "^11.0.0" + }, + "devDependencies": { + "pino-pretty": "^13.2.0" + }, + "engines": { + "node": ">=22.12" } }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@opentelemetry/api": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.10.0.tgz", + "integrity": "sha512-lMkyes8iHrG+mk6WH7X70MdCLI2RS0FwNBY1PyQ8UemaijE2m5mv5A0Niy3HtbYTFrgkUEQjFMXmSAk2hQDuPQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@oxc-parser/binding-android-arm-eabi": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.152.0.tgz", + "integrity": "sha512-393VtirINkae4XHBTkq/yQxhOwEr4V+r0et37P2fp+sYZSdYgZTRDPo5Um8vBh0QjMZ+RmaMy4PP0qwr4cTMwA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-android-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.152.0.tgz", + "integrity": "sha512-iYFcExATJNZ0rZj0o02THbD1Nc9jAW0nVgIQPee6ejbSASpbZXlIMw8jxtpzaG14JQTWwGSZ6U5dEtRJXE6V3Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-arm64/-/binding-darwin-arm64-0.152.0.tgz", + "integrity": "sha512-fnU+DfUzi5/rFy0LzmipYRz06PAUUkOS8kCJQ3Eg6oqlunC1XZXoffFqxmdL51RmcbYtUG3P8DVG1U5fckoa2A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-x64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-x64/-/binding-darwin-x64-0.152.0.tgz", + "integrity": "sha512-Y3U2okryWTs7hDld6UhjJwLNf8/do+x4g4C+1U5SiGwrTLwbO83WJYJA8+l9iFSilWBgnfpd/+U76tfeNxUHzA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-freebsd-x64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-freebsd-x64/-/binding-freebsd-x64-0.152.0.tgz", + "integrity": "sha512-XkhkRrrPffEw+ZLv/d/5pEni0buxinm/E/N6fLbJCunD1DBbeCTtVP23ESV+4CWCWdSz397asks1ViGslpmWiQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-gnueabihf": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.152.0.tgz", + "integrity": "sha512-MLzsRRbdfmdzo6JEhbC1yKU9ItfvM8tEf18HM32jCiNYZEz6J3bRBRl3cTkKR0vBdrk9ZVlcARXtwHccs+epDA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-musleabihf": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.152.0.tgz", + "integrity": "sha512-HHerTEJz7Iy10Ji6BGsk4gqG6PU0UzFuBu91jIEOX89FnrI5ECWSEr7BLpkYQhp7U0QFtMnBhNfQKI0hYZK78w==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.152.0.tgz", + "integrity": "sha512-9Bb8GyzZ2uSLzRDZ27usaKokr07mxiBe2dDF5b6bd2janmaJTT1gL51UfP7AU30yFiXrJvcRyFKREAgKwZYs0w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.152.0.tgz", + "integrity": "sha512-om7iDMUroI74A/lfRRWY9/Ev3VWrVsrUZ4tyvyh8raBey/sdcfyAD7tYWc+iykAiotnmftyKTpUKFr1QnaBrAQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-ppc64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.152.0.tgz", + "integrity": "sha512-Lf1OL2lMTqwDMFC6jnRb30B+WYHKV0XT+bPHcFM6xHtNVwxpobiTzUIvKH6a0LWpvfwyru8Yu6zCGHqqFHH+gg==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-riscv64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.152.0.tgz", + "integrity": "sha512-BYWSMQK+YJ9ZILStPcmmiSVq8KEG9Qdq/c4BHPC3rUEq/fEDCVjUIwdj5ZzjgZ9P9is9PKu0tcAXzq1ZXg4urQ==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-riscv64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.152.0.tgz", + "integrity": "sha512-d2LqHNNNqdH185sRK5dPKWZu201JrNu9/CRFuVEuT+ht7n/QaVblEMWT9MALQPrDWYvhG10P+NSKJFquDWZ09w==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-s390x-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.152.0.tgz", + "integrity": "sha512-8gBeHt5rA/8+pKhHl+zLggfa3L/V/L2at96p7ty6pBE7id6lFO19nFUc15u2PcjC4OYeYK465MKy1fhhbpFIGw==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.152.0.tgz", + "integrity": "sha512-ltgrSF6L+yPTVsIdaAyqKq3zTqzj/1VlNbxWZuxAe8flR3sWdyNsKvdXukoO8/ucJbLickhmieRBge+o/e8Ugw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-musl/-/binding-linux-x64-musl-0.152.0.tgz", + "integrity": "sha512-LcMp6BvrBnewSfdkLHoSqidhoAq4syKOTBV5TYHWd+2VnGkfD/nPRRVIzTBt/Lkbt7pfOFDGtkiTntFS0p6sQQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-openharmony-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-openharmony-arm64/-/binding-openharmony-arm64-0.152.0.tgz", + "integrity": "sha512-jbhoMCslVxzRCRNQ8TSHxjYdSKRvk8O6ciLVDkahJvmyHDzBqba/bMQHM6ULKj/rgHNNbSzlIiakdx8SEfkJzA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-arm64-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.152.0.tgz", + "integrity": "sha512-JZYVlhv36mr/nertnRB7vchJECOBb1Lz6lltalILsB+o9M/is+H6BEDRLQKdqA4JKs6NjJszo46+iM5sfwj6jQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-ia32-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.152.0.tgz", + "integrity": "sha512-1X9oganvVsunRH0lH10UU05N+H9atpX6WsOybByUjwnfcd3h/0tYwvuv16XuHglrIUOnxV2TodbLVEwwafd64g==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-x64-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.152.0.tgz", + "integrity": "sha512-sw0M80/dn9rcpu+Rqqph/C+MjvDDce6MlXmFjsNQtPEymha0eJy3ml6+foSUTqFfpDIDyHZZ4eoJ43IoMe8bJw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.152.0.tgz", + "integrity": "sha512-oM/5rLBm2tPkg0iBgkH/FOeR3PCDpY19GTgAZjMFM8h9WI9VW7cLgzp6nwtarYKmovavIQZ+Fe/RKX/8C8O/Rw==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@pinojs/redact": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz", + "integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==", + "license": "MIT" + }, + "node_modules/@sentry/bundler-plugins": { + "version": "11.9.0", + "resolved": "https://registry.npmjs.org/@sentry/bundler-plugins/-/bundler-plugins-11.9.0.tgz", + "integrity": "sha512-wpz/gcM/6rld/wb4Mhf8kbDN9ngG5myKQSZC+45gzqR1w+GcdfVnYkp3sHL9AV4mrwL8skhTItdUghMwMTknKg==", + "license": "MIT", "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" + "@sentry/core": "11.9.0", + "dotenv": "^17.4.2", + "glob": "^13.0.6", + "magic-string": "~0.30.8 || ^1.0.0", + "oxc-parser": "^0.152.0", + "sentry": "^0.45.0", + "supports-color": "^8.1.1" }, "engines": { - "node": ">= 0.6" + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "rollup": ">=3.2.0", + "webpack": ">=5.1.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "webpack": { + "optional": true + } } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/@sentry/conventions": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@sentry/conventions/-/conventions-0.27.0.tgz", + "integrity": "sha512-Mrqd/o7n/z7qWSYfQQA7x4fFTA0IqOG6JNsbBpnC97khPwZk7n6DPtOO7YgaYplSl8R8QLRbBz9Xv2lVhToSAg==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@sentry/core": { + "version": "11.9.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-11.9.0.tgz", + "integrity": "sha512-t0dZyHILt2XVC4Fe9UmAty6YRfOuQv95cvWeNl+HlW4LphjF5/jkALV3cJCUMdhpblYELgIJC4U/S/GoYuI2bA==", + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "@sentry/conventions": "^0.27.0" }, "engines": { - "node": ">=8" + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/node": { + "version": "11.9.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-11.9.0.tgz", + "integrity": "sha512-cz219PzVaAPTlQ4bRBTRBCOvxbZkXK0KkqyqWPV6OmSn6vWn935CTfOs+MKUc1A+locvB8i9OfBIbO6v03BBuQ==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@sentry/bundler-plugins": "11.9.0", + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.9.0", + "@sentry/opentelemetry": "11.9.0", + "@sentry/server-runtime-injection": "11.9.0", + "@sentry/server-utils": "11.9.0" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" } }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + "node_modules/@sentry/opentelemetry": { + "version": "11.9.0", + "resolved": "https://registry.npmjs.org/@sentry/opentelemetry/-/opentelemetry-11.9.0.tgz", + "integrity": "sha512-FMCkAbEfBpFterrkR7k4P8LEabUAEHjZMbu+ycDjbnI1U4pT22tpwcFJOt06orFkacoWNsYT9+EdfmkvaCKtSA==", + "license": "MIT", + "dependencies": { + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.9.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0" + } }, - "node_modules/async": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", - "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + "node_modules/@sentry/server-runtime-injection": { + "version": "11.9.0", + "resolved": "https://registry.npmjs.org/@sentry/server-runtime-injection/-/server-runtime-injection-11.9.0.tgz", + "integrity": "sha512-Q2G5xaeoiYwGheCZyeqZ/v//SZYjRLlITlanTsZM/fox1qk7cmbDX7+o4q+JkApVV9VuXQZVxppaVCsBglfDKA==", + "license": "MIT", + "dependencies": { + "@sentry/core": "11.9.0", + "@sentry/server-utils": "11.9.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + "node_modules/@sentry/server-utils": { + "version": "11.9.0", + "resolved": "https://registry.npmjs.org/@sentry/server-utils/-/server-utils-11.9.0.tgz", + "integrity": "sha512-xHETix5jAjs/4tY+b9RCejEU7O49pNBiGgCWX0KFRMSpWbw9moqQ8i8N62bS7L+/BJnBcZ5SZ1nweXh7w787Qg==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.9.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } }, - "node_modules/axios": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz", - "integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==", + "node_modules/accepts/node_modules/negotiator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.1.0.tgz", + "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==", + "license": "MIT", "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" + "content-type": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" } }, "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz", + "integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==", + "license": "MIT", "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.1", - "type-is": "~1.6.18", - "unpipe": "1.0.0" + "bytes": "^3.1.2", + "content-type": "^2.1.0", + "debug": "^4.4.3", + "http-errors": "^2.0.1", + "iconv-lite": "^0.7.3", + "on-finished": "^2.4.1", + "qs": "^6.16.1", + "raw-body": "^3.0.2", + "type-is": "^2.1.0" }, "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, + "node_modules/body-parser/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" } }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, - "node_modules/call-bind": { + "node_modules/call-bind-apply-helpers": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 0.4" } }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "mime-db": ">= 1.43.0 < 2" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.6" } }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "node_modules/compression": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.2.tgz", + "integrity": "sha512-o8vI5RE5A6EVVOd9o41jKp41aJom+QTEO/Bx8MYNjexMo/Bv2WOjUfZr+aL0WnYSgymUy6zeguqLTsIhV0gMvQ==", + "license": "MIT", "dependencies": { - "delayed-stream": "~1.0.0" + "bytes": "3.1.2", + "compressible": "~2.0.18", + "debug": "2.6.9", + "destroy": "1.2.0", + "negotiator": "~0.6.4", + "on-headers": "~1.1.0", + "safe-buffer": "5.2.1", + "vary": "~1.1.2" }, "engines": { - "node": ">= 0.8" + "node": ">= 0.8.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "dependencies": { - "safe-buffer": "5.2.1" - }, + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-2.0.1.tgz", + "integrity": "sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==", + "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/dateformat": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", + "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -231,431 +732,853 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", "engines": { "node": ">= 0.8", "npm": "1.2.8000 || >= 1.4.16" } }, "node_modules/dotenv": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", - "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", + "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", + "license": "BSD-2-Clause", "engines": { "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" }, "node_modules/ejs": { - "version": "3.1.9", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz", - "integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==", - "dependencies": { - "jake": "^10.8.5" - }, + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-7.0.2.tgz", + "integrity": "sha512-LcDSEP6Oclb9sTiSyG0MpG0RuKvLDRxCOOt+2sIk+kdk1rMkFU8SRnT0qaNt5zvU0LOV1YXXOvIoZL/sKwabvw==", + "license": "Apache-2.0", "bin": { "ejs": "bin/cli.js" }, "engines": { - "node": ">=0.10.0" + "node": ">=0.12.18" } }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.5.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.3.0.tgz", + "integrity": "sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.3.0", + "content-disposition": "^2.0.1", + "content-type": "^2.0.0", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.8", + "qs": "^6.16.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.1.0", + "vary": "^1.1.2" }, "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/filelist": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", - "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", - "dependencies": { - "minimatch": "^5.0.1" - } - }, - "node_modules/filelist/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "^1.0.0" + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, - "node_modules/filelist/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "node_modules/express/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", "dependencies": { - "brace-expansion": "^2.0.1" + "ms": "^2.1.3" }, "engines": { - "node": ">=10" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, + "node_modules/express/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/fast-copy": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-4.3.0.tgz", + "integrity": "sha512-oWBZLHWpUYt2A471n+ayC4+bJSGDWpl2h3COgBxYX5xHFnr7KqOSrYJZX82ZmrtAfVK+SqsOuNMgsoL+lJquuQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true, + "license": "MIT" + }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" }, "engines": { - "node": ">= 0.8" + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, - "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], + "node_modules/finalhandler/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, "engines": { - "node": ">=4.0" + "node": ">=6.0" }, "peerDependenciesMeta": { - "debug": { + "supports-color": { "optional": true } } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } + "node_modules/finalhandler/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">= 0.8" } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } }, "node_modules/get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/glob": { + "version": "13.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", + "license": "BlueOak-1.0.0", "dependencies": { - "function-bind": "^1.1.1" + "minimatch": "^10.2.2", + "minipass": "^7.1.3", + "path-scurry": "^2.0.2" }, "engines": { - "node": ">= 0.4.0" + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, "engines": { "node": ">= 0.4" + } + }, + "node_modules/helmet": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-8.3.0.tgz", + "integrity": "sha512-Qgpiaws3Sm30Av8Eah6sjMCZZwjlBu+E68rhpCWBshY1lb09HtLwj5GviX0OyQIn+ulUS0iX0AxN5n3tLZzz1w==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/EvanHahn" } }, + "node_modules/help-me": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", + "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==", + "dev": true, + "license": "MIT" + }, "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" }, "engines": { "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", + "license": "MIT", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" + "safer-buffer": ">= 2.1.2 < 3.0.0" }, "engines": { "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", "engines": { "node": ">= 0.10" } }, - "node_modules/jake": { - "version": "10.8.5", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", - "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==", - "dependencies": { - "async": "^3.2.3", - "chalk": "^4.0.2", - "filelist": "^1.0.1", - "minimatch": "^3.0.4" - }, - "bin": { - "jake": "bin/cli.js" - }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", "engines": { "node": ">=10" } }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "license": "BlueOak-1.0.0", "engines": { - "node": ">= 0.6" + "node": "20 || >=22" } }, - "node_modules/memory-cache": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/memory-cache/-/memory-cache-0.2.0.tgz", - "integrity": "sha512-OcjA+jzjOYzKmKS6IQVALHLVz+rNTMPoJvCztFaZxwG14wtAW7VRZjwTQu06vKCYOxh4jVnik7ya0SXTB0W+xA==" - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "node_modules/magic-string": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", + "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">= 0.4" } }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" + "node_modules/media-typer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.1.tgz", + "integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", "dependencies": { - "mime-db": "1.52.0" + "mime-db": "^1.54.0" }, "engines": { - "node": ">= 0.6" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^5.0.8" }, "engines": { - "node": "*" + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" } }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" }, "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", + "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/on-exit-leak-free": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", + "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz", + "integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==", + "license": "MIT", "dependencies": { "ee-first": "1.1.1" }, "engines": { "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/on-headers": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz", + "integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/oxc-parser": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.152.0.tgz", + "integrity": "sha512-ZztsZgaCWmPeKYMdoTT5e0oV/oxD1NeLWNR3kAtr/G707cUPYaaozRlVDHLCGnszHJRszN9mJwmPNpqgwloC0A==", + "license": "MIT", + "dependencies": { + "@oxc-project/types": "^0.152.0" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxc-parser/binding-android-arm-eabi": "0.152.0", + "@oxc-parser/binding-android-arm64": "0.152.0", + "@oxc-parser/binding-darwin-arm64": "0.152.0", + "@oxc-parser/binding-darwin-x64": "0.152.0", + "@oxc-parser/binding-freebsd-x64": "0.152.0", + "@oxc-parser/binding-linux-arm-gnueabihf": "0.152.0", + "@oxc-parser/binding-linux-arm-musleabihf": "0.152.0", + "@oxc-parser/binding-linux-arm64-gnu": "0.152.0", + "@oxc-parser/binding-linux-arm64-musl": "0.152.0", + "@oxc-parser/binding-linux-ppc64-gnu": "0.152.0", + "@oxc-parser/binding-linux-riscv64-gnu": "0.152.0", + "@oxc-parser/binding-linux-riscv64-musl": "0.152.0", + "@oxc-parser/binding-linux-s390x-gnu": "0.152.0", + "@oxc-parser/binding-linux-x64-gnu": "0.152.0", + "@oxc-parser/binding-linux-x64-musl": "0.152.0", + "@oxc-parser/binding-openharmony-arm64": "0.152.0", + "@oxc-parser/binding-win32-arm64-msvc": "0.152.0", + "@oxc-parser/binding-win32-ia32-msvc": "0.152.0", + "@oxc-parser/binding-win32-x64-msvc": "0.152.0" } }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, + "node_modules/path-scurry": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz", + "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pino": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-10.4.0.tgz", + "integrity": "sha512-bk1ZMTwG/Vymx+zPoa28MhNzucFvXJWp3csrSuxuHPSMeUettaCoQ5Jvg07mtC4JGNpcfTwz41oVCnNgBK9+vA==", + "license": "MIT", + "dependencies": { + "@pinojs/redact": "^0.4.0", + "atomic-sleep": "^1.0.0", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^3.0.0", + "pino-std-serializers": "^7.0.0", + "process-warning": "^5.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^1.0.0", + "safe-stable-stringify": "^2.3.1", + "sonic-boom": "^4.0.1", + "thread-stream": "^4.0.0" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-abstract-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz", + "integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==", + "license": "MIT", + "dependencies": { + "split2": "^4.0.0" + } + }, + "node_modules/pino-http": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/pino-http/-/pino-http-11.0.0.tgz", + "integrity": "sha512-wqg5XIAGRRIWtTk8qPGxkbrfiwEWz1lgedVLvhLALudKXvg1/L2lTFgTGPJ4Z2e3qcRmxoFxDuSdMdMGNM6I1g==", + "license": "MIT", + "dependencies": { + "get-caller-file": "^2.0.5", + "pino": "^10.0.0", + "pino-std-serializers": "^7.0.0", + "process-warning": "^5.0.0" + } + }, + "node_modules/pino-pretty": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.2.0.tgz", + "integrity": "sha512-jjghD1ML+Di/WxjJDz6j6Y4FT7hIXOlb8h27AyJ+ohtAXJXH4PS/xkv7si+RCCIW59HMgZsMKTDgzdr0RhuRrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "colorette": "^2.0.7", + "dateformat": "^4.6.3", + "fast-copy": "^4.0.0", + "fast-safe-stringify": "^2.1.1", + "help-me": "^5.0.0", + "joycon": "^3.1.1", + "minimist": "^1.2.6", + "on-exit-leak-free": "^2.1.2", + "pino-abstract-transport": "^3.0.0", + "pump": "^3.0.3", + "secure-json-parse": "^4.1.0", + "sonic-boom": "^5.0.0", + "strip-json-comments": "^5.0.3" + }, + "bin": { + "pino-pretty": "bin.js" + } + }, + "node_modules/pino-pretty/node_modules/sonic-boom": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-5.0.2.tgz", + "integrity": "sha512-/JEruzo6yhNVhsLblTRchgTQHIt7SsdJP0YyrfWaNKjIOQDfrdZv9gwYraYCAsmKV39/LAdV31FLL5NCDpoL/A==", + "dev": true, + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/pino-std-serializers": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz", + "integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==", + "license": "MIT" + }, + "node_modules/process-warning": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.1.1.tgz", + "integrity": "sha512-oCkNVj4OKnKEcocVBcDfiIugN1/cE6rgfT3nCtzeqZPA8+rIxMaQ0xXzIkGP8Gj2qUaP1UR7uhJ1VD8lUCpzCg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" }, "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", + "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", + "license": "MIT", "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" }, "engines": { "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.1.tgz", + "integrity": "sha512-5Px6J7rfHBAGUhNQ3es4YzcOdBBw0SDcVtThJml4RdnKw4tKs2epA0kPZ+K8X+WiHktT93RHVcQ/3ym5aTCgtg==", + "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.4" + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" }, "engines": { "node": ">=0.6" @@ -664,28 +1587,85 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/quick-format-unescaped": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "license": "MIT" + }, "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz", + "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==", + "license": "MIT", "engines": { "node": ">= 0.6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" }, "engines": { - "node": ">= 0.8" + "node": ">= 0.10" + } + }, + "node_modules/real-require": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-1.0.0.tgz", + "integrity": "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g==", + "license": "MIT" + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" } }, + "node_modules/router/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/router/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -703,135 +1683,316 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" + }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/secure-json-parse": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-4.1.1.tgz", + "integrity": "sha512-lnd81MQEZKjhW/Gd2TQqdd4XP6QYNdDW/EP+I7nTrFHP9y2LmaGPIHk9xsnzcOiEr1c39c/e84xFgGviQKBTRw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/send/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/sentry": { + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/sentry/-/sentry-0.45.0.tgz", + "integrity": "sha512-kgmEbLlC22lL7uneeUm9Sjz65rp5cvwYOMTxXbZCmBum4sbVre/lLT3zTV3kwXHJ9/BM8ZS0/GhZe9Cl1t6WyA==", + "license": "FSL-1.1-Apache-2.0", + "bin": { + "sentry": "dist/bin.cjs" + }, + "engines": { + "node": ">=20.0" + } }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/sonic-boom": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.1.tgz", + "integrity": "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==", + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, + "node_modules/strip-json-comments": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.3.tgz", + "integrity": "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/thread-stream": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-4.2.0.tgz", + "integrity": "sha512-e2zZ96wSChazBsbENf/Pcm/4swHt2cEKQ92rhUjkL9GCKiTDJIaTBenjE/m9DXi0QBmTMDkFDdOomUy20A1tDQ==", + "license": "MIT", + "dependencies": { + "real-require": "^1.0.0" + }, + "engines": { + "node": ">=20" } }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", "engines": { "node": ">=0.6" } }, "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", + "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==", + "license": "MIT", "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" + "content-type": "^2.0.0", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" }, "engines": { - "node": ">= 0.6" + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", "engines": { "node": ">= 0.8" } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" } } } diff --git a/package.json b/package.json index 3b2ef36f..a70d57ec 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,34 @@ { - "name": "my-spotify", - "version": "1.0.0", + "name": "selections", + "version": "2.0.0", + "description": "SoundSelections — a fast, responsive browser for Beere's curated TIDAL playlists.", + "private": true, + "type": "module", "main": "app.js", + "engines": { + "node": ">=22.12" + }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "start": "node app.js", + "dev": "node --watch-path=src --watch-path=views app.js", + "dev:mock": "TIDAL_MOCK=1 node --watch-path=src --watch-path=views app.js", + "tidal:login": "node scripts/tidal-login.js", + "check": "node scripts/check-syntax.js", + "test": "node --test --test-reporter=spec \"test/**/*.test.js\"" }, "keywords": [], - "author": "", - "license": "ISC", + "author": "Beere", + "license": "MIT", "dependencies": { - "axios": "^1.3.4", - "dotenv": "^16.0.3", - "ejs": "^3.1.9", - "express": "^4.18.2", - "memory-cache": "^0.2.0" + "@sentry/node": "^11.9.0", + "compression": "^1.8.2", + "ejs": "^7.0.2", + "express": "^5.3.0", + "helmet": "^8.3.0", + "pino": "^10.4.0", + "pino-http": "^11.0.0" }, - "description": "" + "devDependencies": { + "pino-pretty": "^13.2.0" + } } diff --git a/public/css/app.css b/public/css/app.css new file mode 100644 index 00000000..d8a16929 --- /dev/null +++ b/public/css/app.css @@ -0,0 +1,948 @@ +/* SoundSelections — one stylesheet, organised top-down: + fonts → tokens → base → layout → masthead/toolbar → filters → grid/cards + → states → dialog → toast → footer → utilities → motion preferences. */ + +/* Fonts ---------------------------------------------------------------- */ + +@font-face { + font-family: 'Outfit'; + font-style: normal; + font-weight: 100 900; + font-display: swap; + src: url('../fonts/outfit-latin-wght-normal.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} + +@font-face { + font-family: 'Outfit'; + font-style: normal; + font-weight: 100 900; + font-display: swap; + src: url('../fonts/outfit-latin-ext-wght-normal.woff2') format('woff2'); + unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; +} + +/* Tokens --------------------------------------------------------------- */ + +:root { + color-scheme: dark; + + --black: #000; + --grey-900: #141414; + --grey-800: #1c1c1c; + --grey-700: #2a2a2a; + --grey-500: #9a9a9a; + --grey-300: #cbcbcb; + --white: #fff; + --blue-light: #8a8aff; + --blue: #0000bf; + --blue-dark: #000034; + --yellow: hsl(39 87% 50%); + --line: rgb(255 255 255 / 0.1); + + --gradient-blue: linear-gradient(0deg, #000 0%, #000060 50%, #0000bf 100%); + + --font: 'Outfit', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; + + --radius-s: 0.25rem; + --radius-m: 0.5rem; + --radius-l: 0.875rem; + --radius-pill: 999px; + + --gutter: clamp(1rem, 4vw, 2.5rem); + --gap: clamp(0.75rem, 2vw, 1.5rem); + --max-width: 80rem; + --tap: 2.75rem; + + --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); + --fast: 120ms; + --base: 200ms; + --slow: 320ms; +} + +/* Base ----------------------------------------------------------------- */ + +*, +*::before, +*::after { + box-sizing: border-box; +} + +html { + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; + scroll-padding-top: 6rem; +} + +body { + margin: 0; + min-height: 100dvh; + display: flex; + flex-direction: column; + background: var(--black); + color: var(--white); + font-family: var(--font); + font-size: 1rem; + font-weight: 300; + line-height: 1.5; + letter-spacing: 0.01em; +} + +h1, +h2, +p { + margin: 0; +} + +/* `hidden` must win over component display rules (e.g. inline-flex chips). */ +[hidden] { + display: none !important; +} + +img { + display: block; + max-width: 100%; +} + +button, +input, +select { + font: inherit; + color: inherit; + letter-spacing: inherit; +} + +a { + color: var(--grey-300); + text-underline-offset: 0.2em; + transition: color var(--fast) ease-out; +} + +a:hover { + color: var(--white); +} + +:focus-visible { + outline: 3px solid var(--yellow); + outline-offset: 2px; +} + +/* Layout --------------------------------------------------------------- */ + +.container { + width: 100%; + max-width: var(--max-width); + margin-inline: auto; + padding-inline: var(--gutter); +} + +main { + flex: 1; + padding-block: 1.25rem 3rem; +} + +main:focus { + outline: none; +} + +/* Masthead & toolbar ------------------------------------------------------ */ + +.masthead { + background: var(--gradient-blue); + padding-block: clamp(1.75rem, 6vw, 3.5rem) clamp(1rem, 3vw, 1.75rem); +} + +.masthead-inner { + display: flex; + align-items: center; + gap: clamp(0.75rem, 2vw, 1.25rem); +} + +.avatar { + flex: none; + width: clamp(3rem, 8vw, 4rem); + height: auto; + aspect-ratio: 1; + border-radius: 50%; + border: 1px solid var(--white); + object-fit: cover; +} + +.site-name { + font-size: clamp(1.75rem, 5vw, 3rem); + font-weight: 600; + line-height: 1.05; + letter-spacing: -0.02em; +} + +.tagline { + margin-top: 0.375rem; + max-width: 42rem; + color: var(--grey-300); + font-size: clamp(0.9375rem, 2vw, 1.0625rem); + text-wrap: pretty; +} + +.toolbar { + position: sticky; + top: 0; + z-index: 10; + padding-block: 0.75rem; + background: rgb(0 0 0 / 0.82); + border-bottom: 1px solid var(--line); + backdrop-filter: blur(14px) saturate(1.4); + -webkit-backdrop-filter: blur(14px) saturate(1.4); +} + +.filters { + display: flex; + gap: 0.75rem; + align-items: center; +} + +.search-input { + flex: 1; + min-width: 0; + min-height: var(--tap); + padding: 0.625rem 1rem; + background: var(--blue-dark); + border: 1px solid var(--blue); + border-radius: var(--radius-s); + font-size: clamp(1rem, 2.4vw, 1.25rem); + font-weight: 300; + transition: border-color var(--fast) ease-out, background-color var(--fast) ease-out; +} + +.search-input::placeholder { + color: var(--grey-500); + opacity: 1; +} + +.search-input:hover { + border-color: var(--blue-light); +} + +.search-input:focus { + border-color: var(--white); + background: var(--black); +} + +.sort { + display: flex; + align-items: center; + gap: 0.5rem; + font-size: 0.875rem; + color: var(--grey-500); +} + +.sort select { + min-height: var(--tap); + padding: 0.5rem 0.75rem; + background: var(--grey-800); + border: 1px solid var(--grey-700); + border-radius: var(--radius-s); + color: var(--white); + cursor: pointer; +} + +@media (max-width: 30rem) { + .sort-label { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(50%); + } +} + +/* Results, tags & notices --------------------------------------------------- */ + +.results-bar { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 0.25rem 1rem; + min-height: 1.75rem; + color: var(--grey-500); + font-size: 0.9375rem; +} + +.text-button { + min-height: var(--tap); + padding: 0; + background: none; + border: 0; + color: var(--grey-300); + text-decoration: underline; + text-underline-offset: 0.2em; + cursor: pointer; +} + +.text-button:hover { + color: var(--white); +} + +.tags { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + margin-block: 0.75rem 1.5rem; +} + +@media (max-width: 40rem) { + /* One swipeable row on phones instead of a wall of chips. */ + .tags { + flex-wrap: nowrap; + overflow-x: auto; + margin-inline: calc(var(--gutter) * -1); + padding-inline: var(--gutter); + padding-block: 0.25rem; + scroll-padding-inline: var(--gutter); + scrollbar-width: none; + mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 2.5rem), transparent); + } + + .tags::-webkit-scrollbar { + display: none; + } +} + +.tag-chip { + flex: none; + display: inline-flex; + align-items: center; + gap: 0.375rem; + min-height: 2.25rem; + padding: 0.25rem 0.875rem; + background: transparent; + border: 1px solid rgb(255 255 255 / 0.22); + border-radius: var(--radius-pill); + font-size: 0.875rem; + font-weight: 400; + white-space: nowrap; + cursor: pointer; + transition: background-color var(--fast) ease-out, border-color var(--fast) ease-out, color var(--fast) ease-out; +} + +.tag-chip:hover { + border-color: var(--white); +} + +.tag-chip[aria-pressed='true'] { + background: var(--white); + border-color: var(--white); + color: var(--black); + font-weight: 500; +} + +.tag-count { + color: var(--grey-500); + font-size: 0.75rem; +} + +.tag-chip[aria-pressed='true'] .tag-count { + color: var(--grey-700); +} + +.notice { + display: grid; + justify-items: start; + gap: 1rem; + margin-block: 1rem 2rem; + padding: 1.25rem 1.5rem; + background: var(--grey-800); + border: 1px solid var(--line); + border-left: 3px solid var(--yellow); + border-radius: var(--radius-m); + color: var(--grey-300); +} + +/* Grid & cards ------------------------------------------------------------ */ + +.grid { + display: grid; + /* Never fewer than two columns, so phones still show off the artwork. + CARD_IMAGE_SIZES in js/constants.js mirrors these widths. */ + grid-template-columns: repeat(auto-fill, minmax(min(13.5rem, calc((100% - var(--gap)) / 2)), 1fr)); + gap: clamp(1.5rem, 3vw, 2.5rem) var(--gap); + margin: 0; + padding: 0; + list-style: none; +} + +.card { + position: relative; + display: flex; + flex-direction: column; + gap: 0.375rem; + min-width: 0; +} + +.card-art { + position: relative; + aspect-ratio: 1; + margin-bottom: 0.375rem; + overflow: hidden; + border-radius: var(--radius-m); + background: var(--art, var(--grey-800)); + box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06); + transition: transform var(--base) var(--ease-out), box-shadow var(--base) var(--ease-out); +} + +.card-art img, +.sheet-art img { + width: 100%; + height: 100%; + object-fit: cover; + transition: opacity var(--slow) ease-out; +} + +/* Artwork fades in over its palette colour once loaded. */ +:is(.card-art, .sheet-art) img.is-loading { + opacity: 0; +} + +:is(.card-art, .sheet-art) img:not([src]) { + visibility: hidden; +} + +/* Placeholder note for playlists without artwork (or whose artwork failed). */ +.card.no-art .card-art::after, +.sheet.no-art .sheet-art::after { + content: '♪'; + position: absolute; + inset: 0; + display: grid; + place-items: center; + color: rgb(255 255 255 / 0.4); + font-size: clamp(2.5rem, 8vw, 4rem); +} + +.card:hover .card-art { + transform: translateY(-4px); + box-shadow: 0 18px 36px -18px var(--art, var(--blue)), 0 0 0 1px rgb(255 255 255 / 0.12); +} + +.badge { + position: absolute; + top: 0.5rem; + left: 0.5rem; + padding: 0.125rem 0.5rem; + background: var(--yellow); + border-radius: var(--radius-pill); + color: var(--black); + font-size: 0.6875rem; + font-weight: 700; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +.card-title { + font-size: 1rem; + font-weight: 600; + line-height: 1.3; + letter-spacing: 0; + overflow-wrap: anywhere; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + line-clamp: 2; + overflow: hidden; +} + +.card-link { + color: inherit; + text-decoration: none; +} + +/* The whole card is clickable; the tag chip sits above this overlay. */ +.card-link::after { + content: ''; + position: absolute; + inset: -0.25rem; + border-radius: var(--radius-m); +} + +.card-link:focus-visible { + outline: none; +} + +.card-link:focus-visible::after { + outline: 3px solid var(--yellow); + outline-offset: 2px; +} + +.card-meta { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.375rem 0.625rem; + color: var(--grey-500); + font-size: 0.8125rem; +} + +.card-meta .tag-chip { + position: relative; + z-index: 1; + min-height: 1.75rem; + max-width: 100%; + padding-inline: 0.625rem; + overflow: hidden; + text-overflow: ellipsis; + color: var(--grey-300); + font-size: 0.8125rem; +} + +.card-description { + color: var(--grey-500); + font-size: 0.8125rem; + line-height: 1.45; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + line-clamp: 2; + overflow: hidden; +} + +.card-description:empty { + display: none; +} + +@media (max-width: 30rem) { + .card-description { + display: none; + } +} + +/* Loading skeleton ----------------------------------------------------------- */ + +.card.is-skeleton .card-art, +.skeleton-line { + background: linear-gradient(90deg, var(--grey-800) 25%, var(--grey-700) 50%, var(--grey-800) 75%); + background-size: 200% 100%; + animation: shimmer 1.4s linear infinite; + box-shadow: none; +} + +.skeleton-line { + height: 0.875rem; + border-radius: var(--radius-s); +} + +.skeleton-line.short { + width: 55%; +} + +@keyframes shimmer { + to { + background-position: -200% 0; + } +} + +/* Buttons -------------------------------------------------------------------- */ + +.button { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + min-height: var(--tap); + padding: 0.5rem 1.125rem; + background: transparent; + border: 1px solid var(--grey-300); + border-radius: var(--radius-s); + color: var(--grey-300); + font-size: 0.875rem; + font-weight: 500; + letter-spacing: 0.1em; + text-align: center; + text-decoration: none; + text-transform: uppercase; + cursor: pointer; + transition: color var(--fast) ease-out, border-color var(--fast) ease-out, background-color var(--fast) ease-out; +} + +.button:hover { + border-color: var(--white); + color: var(--white); +} + +.button-primary { + background: var(--white); + border-color: var(--white); + color: var(--black); +} + +.button-primary:hover { + background: var(--grey-300); + border-color: var(--grey-300); + color: var(--black); +} + +/* Playlist dialog -------------------------------------------------------------- */ + +.sheet { + width: min(100% - 2rem, 66rem); + max-width: none; + max-height: min(100% - 2rem, 50rem); + padding: 0; + overflow: auto; + overscroll-behavior: contain; + background: var(--grey-800); + border: 0; + border-radius: var(--radius-l); + box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.9), 0 0 0 1px var(--line); + color: var(--white); +} + +.sheet::backdrop { + background: rgb(0 0 0 / 0.65); + backdrop-filter: blur(6px); + -webkit-backdrop-filter: blur(6px); +} + +.sheet-layout { + position: relative; + display: grid; + grid-template-columns: minmax(0, 19rem) minmax(0, 1fr); + grid-template-rows: auto auto auto 1fr; + grid-template-areas: + 'art player' + 'head player' + 'desc player' + 'body player'; + gap: 1rem 2rem; + /* The top padding leaves room for the close button, clear of TIDAL's player. */ + padding: 3.5rem 2rem 2rem; +} + +.sheet-close { + position: absolute; + top: 0.5rem; + right: 0.5rem; + z-index: 2; + display: grid; + place-items: center; + width: var(--tap); + height: var(--tap); + padding: 0; + background: rgb(0 0 0 / 0.55); + border: 1px solid var(--line); + border-radius: 50%; + cursor: pointer; + transition: background-color var(--fast) ease-out; +} + +.sheet-close:hover { + background: var(--black); +} + +.sheet-art { + grid-area: art; + position: relative; + aspect-ratio: 1; + overflow: hidden; + border-radius: var(--radius-m); + background: var(--art, var(--grey-700)); + box-shadow: 0 24px 48px -24px var(--art, transparent); +} + +.sheet-head { + grid-area: head; + display: grid; + gap: 0.25rem; +} + +.sheet-tag { + color: var(--blue-light); + font-size: 0.8125rem; + font-weight: 500; + letter-spacing: 0.1em; + text-transform: uppercase; +} + +.sheet-title { + font-size: clamp(1.375rem, 3vw, 1.875rem); + font-weight: 600; + line-height: 1.15; + letter-spacing: -0.01em; + overflow-wrap: anywhere; + text-wrap: balance; +} + +.sheet-stats { + color: var(--grey-500); + font-size: 0.875rem; +} + +.sheet-body { + grid-area: body; + display: grid; + align-content: start; + gap: 1.25rem; +} + +.sheet-description { + grid-area: desc; + color: var(--grey-300); + white-space: pre-line; + text-wrap: pretty; +} + +.sheet-description:empty { + display: none; +} + +.sheet-actions { + display: flex; + flex-wrap: wrap; + gap: 0.75rem; +} + +.copy-status { + color: var(--grey-300); + font-size: 0.875rem; + overflow-wrap: anywhere; +} + +.copy-status:empty { + display: none; +} + +.sheet-player { + grid-area: player; + position: relative; + min-height: 30rem; + overflow: hidden; + border-radius: var(--radius-m); + background: var(--grey-900); +} + +.sheet-player iframe { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + border: 0; + opacity: 0; + transition: opacity var(--slow) ease-out; +} + +.sheet-player[data-state='loaded'] iframe { + opacity: 1; +} + +/* Spinner while the embed loads. */ +.sheet-player[data-state='loading']::before { + content: ''; + position: absolute; + top: 50%; + left: 50%; + width: 2rem; + height: 2rem; + margin: -1rem 0 0 -1rem; + border: 2px solid var(--grey-700); + border-top-color: var(--white); + border-radius: 50%; + animation: spin 0.8s linear infinite; +} + +.player-message { + position: absolute; + inset: auto 1rem 1rem; + padding: 0.75rem 1rem; + background: var(--black); + border-radius: var(--radius-s); + color: var(--grey-300); + font-size: 0.875rem; +} + +@keyframes spin { + to { + transform: rotate(1turn); + } +} + +@media (max-width: 52rem) { + /* Phones and small tablets: full-screen sheet, compact header, player up top. */ + .sheet { + width: 100%; + max-height: 100%; + height: 100%; + margin: 0; + border-radius: 0; + } + + /* Actions before the player: on a phone, "Open in TIDAL" is the main event. */ + .sheet-layout { + min-height: 100%; + grid-template-columns: 5.5rem minmax(0, 1fr); + grid-template-rows: auto auto auto auto; + grid-template-areas: + 'art head' + 'body body' + 'player player' + 'desc desc'; + align-items: center; + padding: 1rem var(--gutter) max(1.5rem, env(safe-area-inset-bottom)); + } + + .sheet-head { + padding-right: 3rem; + } + + .sheet-player { + min-height: 0; + height: min(62dvh, 32rem); + } +} + +/* Dialog motion (entry via @starting-style; exit needs overlay + discrete display). */ +.sheet, +.sheet::backdrop { + transition-property: opacity, transform, display, overlay; + transition-duration: var(--slow); + transition-timing-function: var(--ease-out); + transition-behavior: allow-discrete; +} + +.sheet { + opacity: 0; + transform: translateY(1.5rem) scale(0.98); +} + +.sheet::backdrop { + opacity: 0; +} + +:is(.sheet[open]):where(:not([data-closing])) { + opacity: 1; + transform: none; + + &::backdrop { + opacity: 1; + } + + @starting-style { + opacity: 0; + transform: translateY(1.5rem) scale(0.98); + + &::backdrop { + opacity: 0; + } + } +} + +/* Toast ------------------------------------------------------------------------ */ + +.toast { + position: fixed; + bottom: max(1rem, env(safe-area-inset-bottom)); + left: 50%; + z-index: 20; + max-width: calc(100% - 2rem); + padding: 0.75rem 1.25rem; + background: var(--white); + border-radius: var(--radius-pill); + box-shadow: 0 12px 32px -8px rgb(0 0 0 / 0.7); + color: var(--black); + font-size: 0.9375rem; + font-weight: 500; + transform: translateX(-50%); + transition: opacity var(--base) ease-out, translate var(--base) var(--ease-out); + + @starting-style { + opacity: 0; + translate: 0 1rem; + } +} + +/* Footer ------------------------------------------------------------------------ */ + +.site-footer { + padding-block: 1.5rem; + border-top: 1px solid var(--line); + color: var(--grey-500); + font-size: 0.875rem; +} + +.footer-inner { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 1rem 1.5rem; +} + +/* Error page ---------------------------------------------------------------------- */ + +.error-page { + display: grid; + gap: 1.25rem; + justify-items: start; + padding-block: 4rem; +} + +.error-reference { + color: var(--grey-500); + font-size: 0.875rem; +} + +/* Utilities ------------------------------------------------------------------------ */ + +.visually-hidden { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; + border: 0; +} + +.skip-link { + position: absolute; + top: 0.5rem; + left: 0.5rem; + z-index: 30; + padding: 0.75rem 1rem; + background: var(--white); + color: var(--black); + font-weight: 600; + transform: translateY(-200%); +} + +.skip-link:focus { + transform: none; +} + +/* Motion preferences ------------------------------------------------------------- */ + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + scroll-behavior: auto !important; + } + + .card:hover .card-art { + transform: none; + } + + .sheet, + .sheet::backdrop { + transition-duration: 0.1s; + } + + .sheet, + :is(.sheet[open]):where(:not([data-closing])) { + transform: none; + + @starting-style { + transform: none; + } + } +} diff --git a/public/css/component.css b/public/css/component.css deleted file mode 100644 index 7bf5c405..00000000 --- a/public/css/component.css +++ /dev/null @@ -1,227 +0,0 @@ -nav { - /* background-color: var(--swatch-blue); */ - background: linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 96, 1) 50%, rgba(0, 0, 191, 1) 100%); -} - -footer { - background-color: var(--swatch-black); - padding-top: var(--size-small); - padding-bottom: var(--size-small); -} - -/* Link */ - -a { - font-weight: var(--font-weight-regular); - color: var(--swatch-lightest-grey); - cursor: pointer; - border-color: transparent; - border-style: solid; - border-width: 0; - border-radius: var(--size-small-xx); - transition: all var(--transition-base) ease-in-out; -} - -a:hover, -a:focus { - color: var(--swatch-white); - transition: all var(--transition-fast) ease-in-out; -} - -/* button */ - -.button { - padding: var(--size-small-x) var(--size-base); - background-color: transparent; - border-color: var(--swatch-lightest-grey); - color: var(--swatch-lightest-grey); - border-style: solid; - border-width: 1px; - border-radius: var(--size-small-xx); - box-sizing: border-box; - font-size: var(--font-size-base); - line-height: var(--font-height-base); - font-weight: var(--font-weight-medium); - letter-spacing: .1em; - text-align: center; - text-transform: uppercase; - text-decoration: none; - transition: all var(--transition-base) ease-in-out; -} - -.button:hover, -.button:focus { - color: var(--swatch-white); - border-color: var(--swatch-white); - transition: all var(--transition-fast) ease-in-out; -} - -/* Close Button */ - -.close-overlay { - position: absolute; - top: var(--size-large-xx); - right: var(--size-large-xx); - font-size: var(--font-size-playlist); - line-height: var(--font-height-playlist); - font-weight: var(--font-weight-regular); - cursor: pointer; - border-radius: 50%; - width: var(--size-large-xxx); - height: var(--size-large-xxx); - display: flex; - align-content: center; - justify-content: center; - align-items: center; - transform: scale(1); - -moz-transform: scale(1); - -webkit-transform: scale(1); - -o-transform: scale(1); - -ms-transform: scale(1); - transition: transform var(--transition-fast) ease-in-out; -} - -.close-overlay:hover { - background-color: var(--swatch-black); - transform: scale(1.025); - -moz-transform: scale(1.025); - -webkit-transform: scale(1.025); - -o-transform: scale(1.025); - -ms-transform: scale(1.025); - transition: transform var(--transition-base) ease-in-out; -} - -/* Media */ - -.avatar { - border-radius: 50%; - width: 2rem; - height: auto; - border: 1px solid var(--swatch-white); - box-sizing: border-box; -} - -/* Search */ - -#search::after { - content: '⮑ ENTER'; - position: absolute; - right: 0; - transform: translatex(-7rem); - pointer-events: none; - font-size: var(--font-size-base); - font-weight: var(--font-weight-regular); - color: var(--swatch-lightest-grey); - display: flex; -} - -input::placeholder { - color: var(--swatch-light-grey); - font-family: var(--type-sans); -} - -#search { - display: flex; - flex-grow: 1; - padding: var(--size-base) var(--size-large-x); - background-color: var(--swatch-blue-dark); - color: var(--swatch-white); - border: 1px solid var(--swatch-blue); - font-size: var(--font-size-statement); - line-height: var(--font-height-statement); - font-weight: var(--font-weight-light); - border-radius: var(--size-small-xx); - transition: background-color var(--transition-fast) ease-in; -} - -#search:hover { - color: var(--swatch-white); - background-color: var(--swatch-black); - border: 1px solid var(--swatch-blue-light); -} - -#search:focus { - border: 1px solid var(--swatch-white); - /* background-color: var(--swatch-black); */ -} - -/* Counter */ - -#playlist-counter { - display: inline-block; -} - -/* Playlist Item */ - -.playlist { - cursor: pointer; - padding-bottom: var(--size-small); - border-radius: var(--size-small-x); - transform: scale(1); - -moz-transform: scale(1); - -webkit-transform: scale(1); - -o-transform: scale(1); - -ms-transform: scale(1); - transition: transform var(--transition-fast) ease-in-out; -} - -.playlist:hover { - /* cursor: pointer; */ - transform: scale(1.025); - -moz-transform: scale(1.025); - -webkit-transform: scale(1.025); - -o-transform: scale(1.025); - -ms-transform: scale(1.025); - transition: transform var(--transition-base) ease-in-out; -} - -.playlist:focus { - outline-offset: 0.5rem; -} - -.playlist-img { - width: 100%; - height: auto; - margin-bottom: var(--size-small); - border-radius: var(--size-small-x); -} - -/* Loading */ - -.loading-message { - display: none; - padding: var(--size-base) var(--size-large-x); - background-color: var(--swatch-dark-grey); - color: var(--swatch-white); - font-size: var(--font-size-base); - line-height: var(--font-height-base); - border-radius: var(--size-small-xx); -} - -/* Tooltip */ - -.tooltip { - position: relative; - display: inline-block; - cursor: pointer; -} - -.tooltip-container { - position: absolute; - font-size: var(--font-size-base); - line-height: var(--font-height-base); - background-color: var(--swatch-black); - color: var(--swatch-white); - padding: var(--size-small-x); - border-radius: var(--size-small-x); - white-space: nowrap; - z-index: 9999; - visibility: hidden; - opacity: 0; - transition: opacity 0.2s; -} - -.tooltip-container.visible { - visibility: visible; - opacity: 1; -} \ No newline at end of file diff --git a/public/css/global.css b/public/css/global.css deleted file mode 100644 index 9a392a1a..00000000 --- a/public/css/global.css +++ /dev/null @@ -1,40 +0,0 @@ -.hidden { - visibility: hidden; -} - -html { - font-size: 15px; -} - -body { - font-family: var(--type-sans); - background-color: var(--swatch-black); - color: var(--swatch-white); - font-size: var(--font-size-base); - line-height: var(--font-height-base); - font-weight: var(--font-weight-extralight); - letter-spacing: 0.5px; - margin: 0; - margin-block-start: 0; - margin-block-end: 0; - margin-inline-start: 0; - margin-inline-end: 0; - padding: 0; -} - -:focus { - outline: 2px solid var(--swatch-yellow); - outline-offset: 2px; -} - -.primary { - color: var(--swatch-white); -} - -.mid { - color: var(--swatch-lightest-grey); -} - -.secondary { - color: var(--swatch-light-grey); -} \ No newline at end of file diff --git a/public/css/layout.css b/public/css/layout.css deleted file mode 100644 index 2f3f5278..00000000 --- a/public/css/layout.css +++ /dev/null @@ -1,185 +0,0 @@ -/* Display */ - -.flex { - display: flex; -} - -.grid { - display: grid; -} - -/* Columns */ - -.lay--column { - flex-direction: column; -} - -.lay--row { - flex-direction: row; -} - -/* Gap */ - -.lay--gap-small-xx { - gap: var(--size-small-xx); -} - -.lay--gap-small-x { - gap: var(--size-small-x); -} - -.lay--gap-small { - gap: var(--size-small); -} - -.lay--gap { - gap: var(--size-base); -} - -.lay--gap-large { - gap: var(--size-large); -} - -.lay--gap-large-xx { - gap: var(--size-large-xx); -} - -/* Padding */ - -.lay--pad-small { - padding: var(--size-small); -} - -.lay--pad { - padding: var(--size-base); -} - -.lay--pad-large { - padding: var(--size-large); -} - -/* Justify */ - -.lay--justify-center { - justify-content: center; -} - -.lay--justify-left { - justify-content: left; -} - -.lay--justify-right { - justify-content: right; -} - -/* Align Items */ - -.lay--align-stretch { - align-items: stretch -} - -.lay--align-flex { - align-items: flex-start; -} - -.lay--align-center { - align-items: center; -} - -/* Width */ - -.width-control { - width: 100%; - max-width: 1280px; -} - -/* [!] Add responsive here! */ - -/* OLD ——————————————————————————————————— */ - - -nav { - position: sticky; - top: 0px; - padding-top: var(--size-base); - padding-bottom: var(--size-base); - z-index: 2500; -} - -footer { - position: sticky; - bottom: 0px; -} - -/* PLAYLISTS */ - -#playlists-container { - grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); -} - -@media (max-width: 991px) { - #playlists-container { - grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); - } -} - -@media (max-width: 768px) { - #playlists-container { - grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); - } -} - -@media (max-width: 478px) { - #playlists-container { - grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); - } -} - -/* Overlay */ - -.overlay { - background-color: rgba(0, 0, 0, 0.25); - box-sizing: border-box; - display: flex; - flex-direction: column; - height: 100vh; - left: 0; - /* padding: var(--size-large-x); */ - position: fixed; - top: 0; - width: 100vw; - z-index: 5000; -} - -.overlay-content { - flex: auto; - justify-content: flex-start; - background-color: var(--swatch-dark-grey); - border-radius: var(--size-small); - gap: var(--size-small-xx); - width: auto; - height: auto; - padding: var(--size-large-xxxxxx); - margin: var(--size-large-xxxxxx); - position: relative; -} - -/* Spotify Player */ - -.overlay-player-wrapper { - position: relative; - width: 100%; - height: 30rem; - margin-top: var(--size-base); - left: 0; - display: flex; -} - -#spotify-player { - position: absolute; - width: 100%; - height: 100%; - border: 0; - top: 0; - left: 0; -} \ No newline at end of file diff --git a/public/css/reset.css b/public/css/reset.css deleted file mode 100644 index e69de29b..00000000 diff --git a/public/css/tokens.css b/public/css/tokens.css deleted file mode 100644 index 70b5a01b..00000000 --- a/public/css/tokens.css +++ /dev/null @@ -1,74 +0,0 @@ -:root { - /* Color palette */ - --swatch-black: #000000; - --swatch-dark-grey: #1c1c1c; - --swatch-light-grey: #9a9a9a; - --swatch-lightest-grey: #cbcbcb; - --swatch-blue-light: #8a8aff; - --swatch-blue: #0000bf; - --swatch-blue-dark: #000034; - --swatch-cyan: #00d5ff; - --swatch-yellow: hsl(39, 87%, 50%); - --swatch-white: #FFFFFF; - - /* Gradients */ - --gradient-blue: linear-gradient (0deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 96, 1) 50%, rgba(0, 0, 191, 1) 100%); - - /* Typography */ - --type-sans: 'Outfit', 'Arial', sans-serif; - --font-weight-thin: 100; - --font-weight-extralight: 200; - --font-weight-light: 300; - --font-weight-regular: 400; - --font-weight-medium: 500; - --font-weight-semibold: 600; - --font-weight-bold: 700; - --font-weight-extrabold: 800; - --font-weight-black: 900; - - --size-small-1px: 1px; - --size-small-xxx: 0.125rem; - --size-small-xx: 0.25rem; - --size-small-x: 0.5rem; - --size-small: 0.75rem; - --size-base: 1rem; - --size-large: 1.25rem; - --size-large-x: 1.5rem; - --size-large-xx: 2rem; - --size-large-xxx: 2.5rem; - --size-large-xxxx: 3rem; - --size-large-xxxxx: 3.5rem; - --size-large-xxxxxx: 4rem; - --size-large-xxxxxxxx: 5.5rem; - --size-large-xxxxxxxxx: 6rem; - - --font-size-context: var(--size-small); - --font-size-button: var(--size-small); - --font-size-base: var(--size-base); - --font-size-statement: var(--size-large); - --font-size-brand: var(--size-large-x); - --font-size-playlist: var(--size-large-xx); - --font-size-app: var(--size-large-xxxxxxxxx); - - --font-height-context: var(--size-large); - --font-height-app: var(--size-large); - --font-height-base: var(--size-large); - --font-height-statement: var(--size-large-x); - --font-height-brand: var(--size-large-x); - --font-height-playlist: var(--size-large-xxx); - --font-height-app: var(--size-large-xxxxxxxxx); - - /* Transition */ - --transition-fast: 50ms; - --transition-base: 150ms; - --transition-slow: 300ms; - - - /* Breakpoints */ - @media (max-width: 991px) {} - - @media (max-width: 768px) {} - - @media (max-width: 478px) {} - -} \ No newline at end of file diff --git a/public/css/typography.css b/public/css/typography.css deleted file mode 100644 index 0af33935..00000000 --- a/public/css/typography.css +++ /dev/null @@ -1,57 +0,0 @@ -h1, -h2, -h3, -p { - display: block; - margin: 0; - padding: 0; - letter-spacing: 0; - margin-block-start: 0; - margin-block-end: 0; - margin-inline-start: 0; - margin-inline-end: 0; -} - -.text-name-site { - font-size: var(--font-size-brand); - line-height: var(--font-height-brand); - font-weight: var(--font-weight-medium); -} - -.text-name-playlist { - font-weight: var(--font-weight-semibold); - font-size: var(--font-size-base); - line-height: var(--font-height-base); -} - -.text-desc-playlist { - font-weight: var(--font-weight-extralight); - font-size: var(--font-size-base); - line-height: var(--font-height-base); - letter-spacing: 0.2px; -} - -.clamp-1 { - overflow: hidden; - display: -webkit-box; - -webkit-line-clamp: 1; - -webkit-box-orient: vertical; -} - -.clamp-2 { - overflow: hidden; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; -} - -.clamp-2 { - overflow: hidden; - display: -webkit-box; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; -} - -.uppercase { - text-transform: uppercase; -} \ No newline at end of file diff --git a/public/fonts/OFL.txt b/public/fonts/OFL.txt new file mode 100644 index 00000000..c8d1ebad --- /dev/null +++ b/public/fonts/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2021 The Outfit Project Authors (https://github.com/Outfitio/Outfit-Fonts) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/public/fonts/outfit-latin-ext-wght-normal.woff2 b/public/fonts/outfit-latin-ext-wght-normal.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..c54ceec800d486b63e4812d54f0d62d83eeacd4f GIT binary patch literal 14808 zcmV;}IVZ+sKS)+VQiLo&O;$ltPzGQ>Q&d4zfgS*a7%yxQ2nxp-xl0RzS^zNf zYyma`Bm;#o1Rw>4S_g_53DPn8$JcoF?c zqYr4#n%#t$5n@C(M2I*sLJ~p}G?)d7w1`&qnuhl4O652a>$T@?Y5(rO<*ahvmWpve z4gAMB@+A$lznmTs8hy_E90)fA&|^J4H~ydhd)hwt{h5SANn|8R0xAFqvGqZP$+9*( zV6;R!6w7{ljsW-pxAkwqfI-Vi-Wh$>`6FwGKcg-hqd7;;Qv_k7Mx?{$R&cvbS`t9u zBREs|Qad5O6y83fMtRL zJpnKT`9Il?t^3|@O(~_J)*V!;Qg%B5yFptTB1_={i1$j>Dg_Aig65A!LRu`|;|!~C zUiU!+?o;nwxPQ?H5d}&Bja^T24cAjru^uO`fk-(L;7Y#8JFmBnXZ@_lc}n}vM$QD` z8RN1y&ICdB=><{pDmG1$1GL-4HKQiC9>3dU`hH|H+MSeh98id2gfNa7CG*k#HC_b{ z$M(qmO-4hhAqWs86bKqR1QQ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)+H1PGo9Jym|CAVoME#p%+K$Pm3M^?)0XnrXn~}(!6k72gy{ZSEE0=;o{nh* zfqqXCj{70{IaI);Z4frS_U17!Lk{l7tAkGAf=M&A=#R0?VnR7S5`DZ*3$=Z#?Llmc zZvm!vD(I7lr-l+h?WqCN=~to#ukuJ}Fo@dp(Sg54Na+==ih z73|q-ev27(Ig{FA+@oHMhP8ylb=xu0zP%~oH1eW1d(jx%aWGwI(kZpU$>}4LMw63; zuaiGRdJ&pswf@<^flT_pCi+*u%p*(x8SEkNd(jO05xJwkXNiu8 y0iIW0>70!^Bn}%KAP$jAB7fHQW&&KBg~ryb^&S>Vt;$&ch$x(8g#WaAZ+a@mW|0&C literal 0 HcmV?d00001 diff --git a/public/fonts/outfit-latin-wght-normal.woff2 b/public/fonts/outfit-latin-wght-normal.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..85e3332e6d9430f3c6b158843ceb6d3f95743f8a GIT binary patch literal 32292 zcmZ5`Q;;ZK(rw$_r)~SRZQHhO+qP}nHc#8OZQI@V%r`R;^WR+$8L=O-s#dOCD=T)n z%8D=m00R77KEwdXe*+-mD*%9Z^}qN2wf}z?W;hghu1N|g-^T*h zan%9{P>Sb`32jto{dzWK0D$6-HZ3AlXODmE?#)2{~vAPGpBAqKockIt@jJ&NJxDtZjo$eQwpt=SRffwSdg`Ixs?u zp*=2MmGG2#0$}5b9~oo$fZ9Fmhxfy0iRVtaLsX%r2qqcuOUS3Mf@uEA_n8J#90E{) zoH__z0ESvf2;?zT4rVDVObruIi0|)Zg-;+r9zp?h4=+fa5(A5s5>o7wgUrc7Rm+ce z`O=%-_;LLu&7^Kt@jEh@7%WJv#00TebN{Dkp@%gO!@MZopB0YtHom>1k`8O23s5-Y>1>ji7GOfgTP#BUXDAGQ#!eNDYiTToKOYxs=w6^ef&*kIK8HR|~%ryw27a zLm9mpft+NS-Xm`Fh-A$&=t*IK?>{rj;tJH{3b0 z%=Gv&z&gUUwY672evX!3bmlcu-`8p4dG~b?6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Resolves a fetch() promise into { status, data }, or throws an ApiError. */ +export async function readJson(responsePromise) { + let res; + try { + res = await responsePromise; + } catch (cause) { + const timedOut = cause?.name === 'TimeoutError'; + throw new ApiError(timedOut ? 'The request took too long.' : 'Could not reach the server.', { + code: timedOut ? 'TIMEOUT' : 'NETWORK', + cause, + }); + } + + if (res.status === 304) return { status: 304 }; + + let body = null; + try { + body = await res.json(); + } catch (cause) { + if (res.ok) throw new ApiError('The server sent a response we could not read.', { status: res.status, code: 'BAD_RESPONSE', cause }); + } + + if (!res.ok) { + throw new ApiError(body?.error?.message || `Request failed (${res.status}).`, { + status: res.status, + code: body?.error?.code || `HTTP_${res.status}`, + requestId: body?.error?.requestId || res.headers.get('x-request-id') || undefined, + retryAfter: Number(res.headers.get('retry-after')) || undefined, + }); + } + return { status: res.status, data: body }; +} + +// 503 means "the server has no playlists yet"; the caller waits Retry-After instead. +const isRetryable = (error) => ['NETWORK', 'TIMEOUT', 'BAD_RESPONSE'].includes(error.code) || (error.status >= 500 && error.status !== 503); + +/** GET with a timeout, an optional ETag for a conditional request, and one retry on transient failures. */ +export async function getJson(url, { etag, timeoutMs = 15_000, retries = 1 } = {}) { + for (let attempt = 0; ; attempt++) { + try { + return await readJson( + fetch(url, { + headers: etag ? { 'If-None-Match': `"${etag}"` } : {}, + cache: 'no-store', + signal: timeoutSignal(timeoutMs), + }), + ); + } catch (error) { + if (attempt >= retries || !isRetryable(error)) throw error; + await new Promise((resolve) => setTimeout(resolve, 800 * (attempt + 1))); + } + } +} diff --git a/public/js/app.js b/public/js/app.js deleted file mode 100644 index 9c1458f4..00000000 --- a/public/js/app.js +++ /dev/null @@ -1,256 +0,0 @@ -const userId = '111112791'; -const playlistsContainer = document.getElementById('playlists-container'); -const searchInput = document.getElementById('search'); -const loadingMessage = document.getElementById('loading-message'); -const resetButton = document.getElementById('reset-button'); -const openWebButton = document.getElementById('open-web'); -const copyUrlButton = document.getElementById('copy-url'); - -let allFetchedPlaylists = []; -let searchQuery = ''; - -const toggleLoadingMessage = (show) => { - loadingMessage.style.display = show ? 'block' : 'none'; -}; - -const updateResetButton = (search) => { - resetButton.style.display = search !== '' ? 'inline-block' : 'none'; -}; - -const fetchAllPlaylists = async (userId, offset = 0, fetchedPlaylists = []) => { - try { - const response = await fetch(`/playlists/${userId}?offset=${offset}`); - if (!response.ok) { - const errorDetails = await response.json(); - console.error('Error fetching playlists:', errorDetails); - return []; - } - - const newPlaylists = await response.json(); - console.log('Received playlists:', newPlaylists); - - fetchedPlaylists = fetchedPlaylists.concat(newPlaylists.items); - - if (newPlaylists.items.length === 50) { - return await fetchAllPlaylists(userId, offset + 50, - fetchedPlaylists); - } - - return fetchedPlaylists; - } catch (error) { - console.error('Error fetching playlists:', error); - return []; - } -}; - -const fetchPlaylists = async (search = '') => { - toggleLoadingMessage(true); - - try { - if (allFetchedPlaylists.length === 0) { - const cacheKey = `playlists-${userId}`; - const cachedPlaylists = localStorage.getItem(cacheKey); - - if (cachedPlaylists) { - console.log('Using cached playlists'); - allFetchedPlaylists = JSON.parse(cachedPlaylists); - } else { - allFetchedPlaylists = await fetchAllPlaylists(userId); - localStorage.setItem(cacheKey, JSON.stringify(allFetchedPlaylists)); - } - } - - const searchLowerCase = search.toLowerCase(); - - const filteredPlaylists = allFetchedPlaylists.filter((playlist) => - playlist.name.toLowerCase().includes(searchLowerCase) || - (playlist.description && playlist.description.toLowerCase().includes(searchLowerCase)) - ); - displayPlaylists(filteredPlaylists); - updateResetButton(search); - } catch (error) { - console.error(error); - } finally { - toggleLoadingMessage(false); - } -}; - -const handleArrowKeys = (event) => { - const focusedElement = document.activeElement; - const gridItems = Array.from(playlistsContainer.children); - const currentIndex = gridItems.indexOf(focusedElement); - - let nextIndex; - switch (event.key) { - case 'ArrowUp': - nextIndex = currentIndex - 4; // Adjust this value based on your grid layout - break; - case 'ArrowDown': - nextIndex = currentIndex + 4; // Adjust this value based on your grid layout - break; - case 'ArrowLeft': - nextIndex = currentIndex - 1; - break; - case 'ArrowRight': - nextIndex = currentIndex + 1; - break; - default: - return; - } - - if (nextIndex >= 0 && nextIndex < gridItems.length) { - gridItems[nextIndex].focus(); - } - - event.preventDefault(); // Prevent default scrolling behavior -}; - -const displayPlaylists = (playlists) => { - while (playlistsContainer.firstChild) { - playlistsContainer.removeChild(playlistsContainer.firstChild); - } - - playlists.sort((a, b) => a.name.localeCompare(b.name)); - - const counter = document.getElementById('playlist-counter'); - counter.textContent = `Showing ${playlists.length} playlists`; - - playlists.forEach((playlist, index) => { - const playlistElement = document.createElement('article'); - playlistElement.className = 'playlist flex lay--column lay--gap-small-xx'; - // playlistElement.tabIndex = index === 0 ? 0 : -1; // Set tabindex here - playlistElement.innerHTML = ` - ${playlist.name} cover art -

${playlist.name}

-
-

${(playlist.tracks?.total || 0)} songs

-

|

-

${(playlist.followers?.total || 0)} followers

-
-

${playlist.description || ''}

- `; - - playlistElement.addEventListener('keydown', handleArrowKeys); // Attach event listener for keyboard navigation - - playlistsContainer.appendChild(playlistElement); - - const coverArt = playlistElement.querySelector('.playlist-img'); - coverArt.addEventListener('click', (event) => { - event.stopPropagation(); - const overlay = document.getElementById('overlay-background'); - const player = document.getElementById('spotify-player'); - const overlayTitle = document.getElementById('overlay-playlist-title'); - const overlayTracks = document.getElementById('overlay-playlist-tracks'); - const overlayFollowers = document.getElementById('overlay-playlist-followers'); - const overlayDescription = document.getElementById('overlay-playlist-description'); - - player.src = `https://open.spotify.com/embed/playlist/${playlist.id}`; - overlayTitle.textContent = playlist.name; - overlayTracks.textContent = `${playlist.tracks.total} songs`; - overlayFollowers.textContent = `${playlist.followers.total} followers`; - overlayDescription.textContent = playlist.description || ''; - openWebButton.setAttribute('data-playlist-id', playlist.id); - overlay.classList.remove('hidden'); - }); - }); -}; - -const closeOverlay = document.getElementById('close-overlay'); -closeOverlay.addEventListener('click', () => { - const overlay = document.getElementById('overlay-background'); - overlay.classList.add('hidden'); -}); - -const overlay = document.getElementById('overlay-background'); -overlay.addEventListener('click', (event) => { - event.stopPropagation(); -}); - -const overlayBackground = document.getElementById('overlay-background'); -overlayBackground.addEventListener('click', (event) => { - if (event.target === event.currentTarget) { - overlayBackground.classList.add('hidden'); - } -}); - -const searchPlaylists = (query) => { - playlistsContainer.innerHTML = ''; - searchQuery = query; - fetchPlaylists(query); -}; - -searchInput.addEventListener('keydown', (event) => { - if (event.key === 'Enter') { - searchPlaylists(event.target.value); - } -}); - -resetButton.addEventListener('click', () => { - searchInput.value = ''; - resetButton.style.display = 'none'; - fetchPlaylists(); -}); - -let isLoading = false; - -window.addEventListener('scroll', async () => { - if (isLoading || (window.innerHeight + window.scrollY) < document.body.offsetHeight - 500) { - return; - } - - isLoading = true; - const currentPlaylistsCount = playlistsContainer.childElementCount; - await fetchPlaylists(searchQuery, currentPlaylistsCount); - isLoading = false; -}); - -openWebButton.addEventListener('click', () => { - const playlistId = openWebButton.getAttribute('data-playlist-id'); - const webUrl = `https://open.spotify.com/playlist/${playlistId}`; - window.open(webUrl, '_blank'); -}); - -copyUrlButton.addEventListener('click', () => { - const player = document.getElementById('spotify-player'); - const textarea = document.createElement('textarea'); - textarea.value = player.src; - document.body.appendChild(textarea); - textarea.select(); - document.execCommand('copy'); - document.body.removeChild(textarea); - alert('Playlist URL copied to clipboard'); -}); - -const tooltipElements = document.querySelectorAll('.tooltip'); -const tooltipContainer = document.getElementById('tooltip'); - -tooltipElements.forEach((element) => { - element.addEventListener('mouseover', (event) => { - tooltipContainer.textContent = event.target.getAttribute('data-tooltip'); - tooltipContainer.classList.add('visible'); - }); - - element.addEventListener('mousemove', (event) => { - tooltipContainer.style.left = event.pageX + 10 + 'px'; - tooltipContainer.style.top = event.pageY + 10 + 'px'; - }); - - element.addEventListener('mouseout', () => { - tooltipContainer.classList.remove('visible'); - }); -}); - -const genreLinks = document.querySelectorAll('.genre-link'); - -genreLinks.forEach(link => { - link.addEventListener('click', (event) => { - event.preventDefault(); - const genre = event.target.getAttribute('data-genre'); - const searchInput = document.getElementById('search'); - searchInput.value = genre; - searchPlaylists(genre); - }); -}); - -fetchPlaylists(); - diff --git a/public/js/constants.js b/public/js/constants.js new file mode 100644 index 00000000..3621e240 --- /dev/null +++ b/public/js/constants.js @@ -0,0 +1,20 @@ +// Shared by the browser and the server (which uses CARD_IMAGE_SIZES to preload +// the first artwork). Keep this file free of DOM access. + +/** localStorage keys. Bump the version when the cached record shape changes. */ +export const CACHE_KEY = 'selections:v1'; +export const CACHE_ETAG_KEY = 'selections:v1:etag'; + +/** Approximate rendered width of a grid card's artwork; mirrors the grid in app.css. */ +export const CARD_IMAGE_SIZES = '(min-width: 80rem) 14rem, (min-width: 40rem) 30vw, 50vw'; + +/** Cards in the first rows load eagerly; the rest are lazy-loaded as you scroll. */ +export const EAGER_CARD_COUNT = 6; + +/** Playlists created within this many days get a "New" badge. */ +export const NEW_PLAYLIST_DAYS = 21; + +export const embedUrl = (id) => `https://embed.tidal.com/playlists/${encodeURIComponent(id)}`; + +/** `srcset` value from a record's artwork sources. */ +export const srcsetFor = (art) => art?.sources?.map(([url, width]) => `${url} ${width}w`).join(', ') ?? ''; diff --git a/public/js/dialog.js b/public/js/dialog.js new file mode 100644 index 00000000..9c0b03e9 --- /dev/null +++ b/public/js/dialog.js @@ -0,0 +1,198 @@ +// The playlist dialog: artwork, details, TIDAL player, and open/copy actions. +// A native modal provides the focus trap, Esc to close, an inert +// background and focus restoration; this module adds the rest. + +import { embedUrl } from './constants.js'; +import { formatDate, formatDuration, formatFollowers, formatTracks, joinStats } from './format.js'; +import { setArtwork } from './grid.js'; +import { reportError } from './report.js'; + +const PLAYER_SLOW_MS = 12_000; +const DIALOG_ART_SIZES = '(min-width: 52rem) 19rem, 5.5rem'; + +// --- Exit animations where the browser can't animate leaving the top layer --- + +let displayTransitionSupport; +function canTransitionDisplay() { + if (displayTransitionSupport !== undefined) return displayTransitionSupport; + if (!window.CSS?.supports?.('transition-behavior', 'allow-discrete')) return (displayTransitionSupport = false); + // Firefox parses allow-discrete without transitioning display, so probe for real. + const probe = document.createElement('div'); + probe.style.cssText = 'transition: display 1s allow-discrete !important; display: block;'; + document.body.append(probe); + getComputedStyle(probe).display; + probe.style.display = 'none'; + displayTransitionSupport = getComputedStyle(probe).display === 'block'; + probe.remove(); + return displayTransitionSupport; +} + +const supportsTopLayerExit = () => Boolean(window.CSS?.supports?.('overlay', 'auto')) && canTransitionDisplay(); +const prefersReducedMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches; + +async function closeTopLayer(dialog) { + if (!dialog.open) return; + if (!supportsTopLayerExit() && !prefersReducedMotion()) { + dialog.setAttribute('data-closing', ''); + const transitions = dialog.getAnimations().filter((animation) => animation instanceof CSSTransition); + if (transitions.length) { + await Promise.race([Promise.allSettled(transitions.map((animation) => animation.finished)), new Promise((resolve) => setTimeout(resolve, 600))]); + } + if (!dialog.hasAttribute('data-closing')) return; + dialog.removeAttribute('data-closing'); + } + dialog.close(); +} + +// --- Clipboard ------------------------------------------------------------------- + +async function writeClipboard(text, container) { + if (navigator.clipboard?.writeText && window.isSecureContext) { + try { + return await navigator.clipboard.writeText(text); + } catch (error) { + if (error?.name !== 'NotAllowedError') reportError(error, { where: 'clipboard' }); + } + } + // Older browsers, or clipboard permission denied: the classic selection trick. + const field = document.createElement('textarea'); + field.value = text; + field.readOnly = true; + field.className = 'visually-hidden'; + container.append(field); + field.select(); + const copied = document.execCommand('copy'); + field.remove(); + if (!copied) throw new Error('Copying to the clipboard was blocked'); +} + +// --- Dialog ------------------------------------------------------------------------ + +export function createPlaylistDialog({ dialog, onClose }) { + const $ = (selector) => dialog.querySelector(selector); + const ui = { + img: $('.sheet-art img'), + tag: $('.sheet-tag'), + title: $('.sheet-title'), + stats: $('.sheet-stats'), + description: $('.sheet-description'), + open: $('[data-action="open"]'), + copy: $('[data-action="copy"]'), + copyStatus: $('.copy-status'), + close: $('.sheet-close'), + player: $('.sheet-player'), + playerMessage: $('.player-message'), + }; + let current = null; + let slowTimer; + let copyTimer; + + function unloadPlayer() { + clearTimeout(slowTimer); + ui.player.querySelector('iframe')?.remove(); // Also stops playback. + ui.player.dataset.state = 'idle'; + ui.playerMessage.hidden = true; + } + + function loadPlayer(record) { + unloadPlayer(); + const iframe = document.createElement('iframe'); + iframe.title = `TIDAL player: ${record.title}`; + iframe.allow = 'encrypted-media; fullscreen; clipboard-write; autoplay'; + iframe.referrerPolicy = 'strict-origin-when-cross-origin'; + iframe.addEventListener( + 'load', + () => { + clearTimeout(slowTimer); + ui.player.dataset.state = 'loaded'; + ui.playerMessage.hidden = true; + }, + { once: true }, + ); + ui.player.dataset.state = 'loading'; + slowTimer = setTimeout(() => { + if (ui.player.dataset.state === 'loading') ui.playerMessage.hidden = false; + }, PLAYER_SLOW_MS); + iframe.src = embedUrl(record.id); + ui.player.append(iframe); + } + + function fill(record) { + dialog.classList.toggle('no-art', !record.art); + dialog.style.setProperty('--art', record.art?.color ?? ''); + setArtwork(ui.img, record.art, { sizes: DIALOG_ART_SIZES, loading: 'eager' }); + ui.tag.textContent = record.tag ?? ''; + ui.tag.hidden = !record.tag; + ui.title.textContent = record.title; + ui.stats.textContent = joinStats( + formatTracks(record.tracks), + formatDuration(record.duration), + formatFollowers(record.followers), + record.createdAt && `Added ${formatDate(record.createdAt)}`, + ); + ui.description.textContent = record.description ?? ''; + ui.open.href = record.url; + ui.copy.textContent = 'Copy link'; + ui.copyStatus.textContent = ''; + } + + async function copyLink() { + if (!current) return; + clearTimeout(copyTimer); + try { + await writeClipboard(current.url, dialog); + ui.copy.textContent = 'Copied ✓'; + ui.copyStatus.textContent = 'Link copied to your clipboard.'; + copyTimer = setTimeout(() => { + ui.copy.textContent = 'Copy link'; + ui.copyStatus.textContent = ''; + }, 2500); + } catch (error) { + reportError(error, { where: 'copyLink' }); + ui.copyStatus.textContent = `Couldn't copy automatically. Here's the link: ${current.url}`; + } + ui.copy.focus(); + } + + const close = () => closeTopLayer(dialog); + + ui.close.addEventListener('click', close); + ui.copy.addEventListener('click', copyLink); + dialog.addEventListener('close', () => { + unloadPlayer(); + const closed = current; + current = null; + onClose?.(closed); + }); + + // Route Esc through the animated close where the browser can't animate it natively. + dialog.addEventListener('cancel', (event) => { + if (supportsTopLayerExit() || prefersReducedMotion()) return; + event.preventDefault(); + close(); + }); + + // Light dismiss (click outside) for browsers without . + if (!('closedBy' in HTMLDialogElement.prototype)) { + dialog.addEventListener('click', (event) => { + if (event.target !== dialog) return; + const rect = dialog.getBoundingClientRect(); + const inside = rect.top <= event.clientY && event.clientY <= rect.bottom && rect.left <= event.clientX && event.clientX <= rect.right; + if (!inside) close(); + }); + } + + return { + get openId() { + return current?.id ?? null; + }, + open(record) { + current = record; + fill(record); + if (!dialog.open) dialog.showModal(); + dialog.scrollTop = 0; + loadPlayer(record); + }, + close, + }; +} diff --git a/public/js/error-handlers.js b/public/js/error-handlers.js new file mode 100644 index 00000000..78882d6e --- /dev/null +++ b/public/js/error-handlers.js @@ -0,0 +1,4 @@ +// Imported first by main.js, so errors in any later module are still reported. +import { installGlobalErrorHandlers } from './report.js'; + +installGlobalErrorHandlers(); diff --git a/public/js/filter.js b/public/js/filter.js new file mode 100644 index 00000000..fed1ac46 --- /dev/null +++ b/public/js/filter.js @@ -0,0 +1,61 @@ +// Searching, filtering and sorting. Pure functions: no DOM, easy to test. + +const collator = new Intl.Collator('en-GB', { sensitivity: 'base', numeric: true }); + +/** Lower-case and strip accents, so "bjork" finds "Björk". */ +export const fold = (text) => + String(text ?? '') + .normalize('NFKD') + .replace(/\p{M}/gu, '') + .toLowerCase(); + +export const tagKey = (tag) => (tag ? fold(tag).trim() : ''); + +/** Text searched for a record: its title, artist/genre tag and description. */ +export const searchText = (record) => fold([record.title, record.tag, record.description].filter(Boolean).join('\n')); + +export const parseQuery = (query) => fold(query).split(/\s+/).filter(Boolean); + +/** Every word of the query must appear somewhere in the record. */ +export const matches = (text, terms) => terms.every((term) => text.includes(term)); + +export const SORTS = { + newest: (a, b) => (b.createdAt ?? '').localeCompare(a.createdAt ?? '') || collator.compare(a.title, b.title), + updated: (a, b) => (b.updatedAt ?? '').localeCompare(a.updatedAt ?? '') || collator.compare(a.title, b.title), + az: (a, b) => collator.compare(a.title, b.title) || collator.compare(a.tag ?? '', b.tag ?? ''), +}; + +export const DEFAULT_SORT = 'newest'; +export const isSort = (value) => Object.hasOwn(SORTS, value); + +/** + * Applies a view to `entries` ({ record, text }) and returns the visible + * records in order. + */ +export function applyView(entries, { query = '', tag = '', sort = DEFAULT_SORT } = {}) { + const terms = parseQuery(query); + const key = tagKey(tag); + return entries + .filter((entry) => (!key || tagKey(entry.record.tag) === key) && matches(entry.text, terms)) + .map((entry) => entry.record) + .sort(SORTS[isSort(sort) ? sort : DEFAULT_SORT]); +} + +/** + * Tags shared by at least `min` playlists, most common first — in practice + * the genres, since single-artist deep dives tend to be one per artist. + */ +export function popularTags(records, { min = 2, limit = 24 } = {}) { + const byKey = new Map(); + for (const { tag } of records) { + const key = tagKey(tag); + if (!key) continue; + const entry = byKey.get(key) ?? { key, label: tag, count: 0 }; + entry.count++; + byKey.set(key, entry); + } + return [...byKey.values()] + .filter((entry) => entry.count >= min) + .sort((a, b) => b.count - a.count || collator.compare(a.label, b.label)) + .slice(0, limit); +} diff --git a/public/js/format.js b/public/js/format.js new file mode 100644 index 00000000..4f0e695f --- /dev/null +++ b/public/js/format.js @@ -0,0 +1,33 @@ +import { NEW_PLAYLIST_DAYS } from './constants.js'; + +const LOCALE = 'en-GB'; +const numbers = new Intl.NumberFormat(LOCALE); +const dates = new Intl.DateTimeFormat(LOCALE, { day: 'numeric', month: 'short', year: 'numeric' }); + +const plural = (n, one, many) => `${numbers.format(n)} ${n === 1 ? one : many}`; + +export const formatTracks = (n) => (Number.isFinite(n) ? plural(n, 'track', 'tracks') : null); +// Zero followers says nothing useful, so it is left out. +export const formatFollowers = (n) => (Number.isFinite(n) && n > 0 ? plural(n, 'follower', 'followers') : null); + +/** 3723 → "1 hr 2 min"; 2880 → "48 min". */ +export function formatDuration(seconds) { + if (!Number.isFinite(seconds) || seconds <= 0) return null; + const minutes = Math.round(seconds / 60); + const hours = Math.floor(minutes / 60); + if (!hours) return `${minutes} min`; + return minutes % 60 ? `${hours} hr ${minutes % 60} min` : `${hours} hr`; +} + +export function formatDate(iso) { + const time = Date.parse(iso); + return Number.isFinite(time) ? dates.format(time) : null; +} + +export function isNew(record, now = Date.now()) { + const created = Date.parse(record.createdAt); + return Number.isFinite(created) && now - created < NEW_PLAYLIST_DAYS * 86_400_000; +} + +/** "42 tracks · 2 hr 13 min" — skipping anything unknown. */ +export const joinStats = (...parts) => parts.filter(Boolean).join(' · '); diff --git a/public/js/grid.js b/public/js/grid.js new file mode 100644 index 00000000..1a0c397c --- /dev/null +++ b/public/js/grid.js @@ -0,0 +1,145 @@ +// The playlist grid. Cards are created once per playlist and reused: filtering +// and sorting only re-order existing elements, so loaded artwork is never +// re-requested and typing in the search box stays instant. + +import { CARD_IMAGE_SIZES, EAGER_CARD_COUNT, srcsetFor } from './constants.js'; +import { formatDuration, formatTracks, isNew, joinStats } from './format.js'; +import { reportError } from './report.js'; + +/** A sensible single image for browsers that ignore srcset: the first ≥ 320px wide. */ +export const fallbackSrc = (art) => (art.sources.find(([, width]) => width >= 320) ?? art.sources.at(-1))[0]; + +let reportedArtworkFailure = false; + +// Per-image listeners (not delegated): a card can be detached by filtering while its image loads. +function onImageLoad(event) { + event.currentTarget.classList.remove('is-loading'); +} + +function onImageError(event) { + const img = event.currentTarget; + img.classList.remove('is-loading'); + img.closest('.card, .sheet')?.classList.add('no-art'); + if (!reportedArtworkFailure) { + reportedArtworkFailure = true; + reportError(new Error('Playlist artwork failed to load'), { where: 'artwork', src: img.currentSrc || img.src }); + } +} + +/** Points an at a playlist's artwork, fading it in once loaded. */ +export function setArtwork(img, art, { sizes, loading = 'lazy', priority = false }) { + const srcset = srcsetFor(art); + if (srcset && img.getAttribute('srcset') === srcset) return; // Unchanged: keep what is loaded. + img.removeAttribute('srcset'); + img.removeAttribute('src'); + if (!art) return; + // Order matters: `loading` must be set before the browser sees a source. + img.loading = loading; + if (priority) img.fetchPriority = 'high'; + img.classList.add('is-loading'); + img.addEventListener('load', onImageLoad); + img.addEventListener('error', onImageError); + img.sizes = sizes; + img.srcset = srcset; + img.src = fallbackSrc(art); +} + +export function createGrid({ list, template, onOpen, onTag }) { + const cards = new Map(); // id → { el, rev } + let order = []; + let firstRender = true; + + function fillImage(el, record, { eager, priority }) { + el.classList.toggle('no-art', !record.art); + el.style.setProperty('--art', record.art?.color ?? ''); + setArtwork(el.querySelector('img'), record.art, { + loading: eager ? 'eager' : 'lazy', + priority, + // `auto` lets lazy images use their laid-out width; eager ones need the explicit list. + sizes: eager ? CARD_IMAGE_SIZES : `auto, ${CARD_IMAGE_SIZES}`, + }); + } + + function fillText(el, record) { + el.dataset.id = record.id; + const link = el.querySelector('.card-link'); + link.href = `?p=${encodeURIComponent(record.id)}`; + link.textContent = record.title; + + const tag = el.querySelector('.tag-chip'); + tag.hidden = !record.tag; + tag.textContent = record.tag ?? ''; + tag.dataset.tag = record.tag ?? ''; + tag.setAttribute('aria-label', record.tag ? `Show all “${record.tag}” playlists` : ''); + + el.querySelector('.card-stats').textContent = joinStats(formatTracks(record.tracks), formatDuration(record.duration)); + el.querySelector('.card-description').textContent = record.description ?? ''; + el.querySelector('.badge').hidden = !isNew(record); + } + + function cardFor(record, index) { + let card = cards.get(record.id); + if (!card) { + const el = template.content.firstElementChild.cloneNode(true); + fillText(el, record); + const eager = firstRender && index < EAGER_CARD_COUNT; + fillImage(el, record, { eager, priority: eager && index === 0 }); + card = { el, rev: record.rev }; + cards.set(record.id, card); + } else if (card.rev !== record.rev) { + fillText(card.el, record); + fillImage(card.el, record, { eager: false, priority: false }); + card.rev = record.rev; + } + return card.el; + } + + /** Shows exactly `records`, in order. */ + function render(records) { + const elements = records.map(cardFor); + const ids = records.map((record) => record.id); + if (ids.length !== order.length || ids.some((id, i) => id !== order[i])) { + const focusedId = document.activeElement?.closest?.('.card')?.dataset.id; + list.replaceChildren(...elements); + order = ids; + // Re-ordering detaches the focused card; put focus back if it is still shown. + if (focusedId && cards.has(focusedId) && ids.includes(focusedId)) { + cards.get(focusedId).el.querySelector('.card-link').focus({ preventScroll: true }); + } + } + list.setAttribute('aria-busy', 'false'); + // An empty render (e.g. after a failed load) shouldn't use up the first-row priority hints. + if (records.length) firstRender = false; + } + + /** Forgets cards for playlists that no longer exist. */ + function prune(liveIds) { + for (const id of cards.keys()) if (!liveIds.has(id)) cards.delete(id); + } + + // Event delegation: one listener each, however many cards there are. + list.addEventListener('click', (event) => { + const tag = event.target.closest('.tag-chip'); + if (tag) return onTag(tag.dataset.tag); + const link = event.target.closest('.card-link'); + // Let modified clicks (new tab, new window) behave as normal links. + if (!link || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; + event.preventDefault(); + onOpen(link.closest('.card').dataset.id); + }); + + // Arrow keys move between cards, row by row, as well as Tab. + list.addEventListener('keydown', (event) => { + const link = event.target.closest?.('.card-link'); + if (!link) return; + const links = [...list.querySelectorAll('.card-link')]; + const index = links.indexOf(link); + const columns = getComputedStyle(list).gridTemplateColumns.split(' ').length; + const target = { ArrowRight: index + 1, ArrowLeft: index - 1, ArrowDown: index + columns, ArrowUp: index - columns, Home: 0, End: links.length - 1 }[event.key]; + if (target === undefined || event.altKey || event.ctrlKey || event.metaKey) return; + event.preventDefault(); + links[Math.max(0, Math.min(links.length - 1, target))].focus(); + }); + + return { render, prune }; +} diff --git a/public/js/main.js b/public/js/main.js new file mode 100644 index 00000000..7dcf11aa --- /dev/null +++ b/public/js/main.js @@ -0,0 +1,347 @@ +import './error-handlers.js'; +import { ApiError } from './api.js'; +import { createPlaylistDialog } from './dialog.js'; +import { DEFAULT_SORT, applyView, isSort, popularTags, searchText, tagKey } from './filter.js'; +import { createGrid } from './grid.js'; +import { reportError } from './report.js'; +import { loadCache, saveCache } from './store.js'; +import { syncPlaylists } from './sync.js'; +import { showToast } from './toast.js'; + +const RESYNC_AFTER_MS = 30 * 60_000; +const MAX_AUTO_RETRIES = 3; + +const $ = (id) => document.getElementById(id); +const els = { + main: $('playlists'), + form: $('filters'), + search: $('search'), + sort: $('sort'), + count: $('result-count'), + announcer: $('announcer'), + clear: $('clear-filters'), + tags: $('tags'), + notice: $('notice'), + empty: $('empty'), + grid: $('grid'), +}; + +const state = { + playlists: [], + entries: [], + byId: new Map(), + view: readViewFromUrl(), + deepLink: new URL(location.href).searchParams.get('p'), + lastSyncAt: 0, + syncing: false, + autoRetries: 0, +}; + +const plural = (n, word) => `${n.toLocaleString('en-GB')} ${word}${n === 1 ? '' : 's'}`; + +// --- URL state --------------------------------------------------------------------- +// ?q= search, ?tag= artist/genre, ?sort=, ?p= open playlist. Shareable and bookmarkable. + +function readViewFromUrl() { + const params = new URL(location.href).searchParams; + const sort = params.get('sort'); + return { query: params.get('q') ?? '', tag: params.get('tag') ?? '', sort: isSort(sort) ? sort : DEFAULT_SORT }; +} + +let urlTimer; +function flushViewToUrl() { + clearTimeout(urlTimer); + urlTimer = undefined; + const url = new URL(location.href); + const set = (key, value) => (value ? url.searchParams.set(key, value) : url.searchParams.delete(key)); + set('q', state.view.query.trim()); + set('tag', state.view.tag); + set('sort', state.view.sort === DEFAULT_SORT ? '' : state.view.sort); + if (url.href !== location.href) history.replaceState(history.state, '', url); +} + +/** Debounced, so typing doesn't spam the history API. */ +function writeViewToUrl() { + clearTimeout(urlTimer); + urlTimer = setTimeout(flushViewToUrl, 300); +} + +// --- Rendering ------------------------------------------------------------------------- + +const grid = createGrid({ + list: els.grid, + template: $('card-template'), + onOpen: (id) => openPlaylist(id, { push: true }), + onTag: (tag) => { + setView({ tag }); + els.main.scrollIntoView({ block: 'start', behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' }); + }, +}); + +const sheet = createPlaylistDialog({ dialog: $('playlist-dialog'), onClose: handleDialogClosed }); + +function makeTagChip({ label, count, key }) { + const chip = document.createElement('button'); + chip.type = 'button'; + chip.className = 'tag-chip'; + chip.dataset.tag = key ? label : ''; + chip.dataset.key = key; + chip.textContent = label; + if (count) { + const badge = document.createElement('span'); + badge.className = 'tag-count'; + badge.textContent = count; + badge.setAttribute('aria-label', `(${plural(count, 'playlist')})`); + chip.append(' ', badge); + } + return chip; +} + +/** Chips for the common tags; built only when the playlists change, so focus is kept. */ +function renderTags() { + const tags = popularTags(state.playlists); + els.tags.replaceChildren(makeTagChip({ label: 'All', key: '' }), ...tags.map(makeTagChip)); + els.tags.hidden = tags.length === 0; +} + +function syncTagChips() { + const active = tagKey(state.view.tag); + let found = !active; + for (const chip of els.tags.querySelectorAll('.tag-chip')) { + const pressed = chip.dataset.key === active; + chip.setAttribute('aria-pressed', String(pressed)); + found ||= pressed; + if (chip.dataset.extra && !pressed) chip.remove(); + } + // A tag picked from a card that isn't among the common ones: show it so it can be cleared. + if (!found) { + const chip = makeTagChip({ label: state.view.tag, key: active }); + chip.dataset.extra = 'true'; + chip.setAttribute('aria-pressed', 'true'); + els.tags.firstElementChild?.after(chip); + els.tags.hidden = false; + } +} + +let announceTimer; +function renderView({ announce = false } = {}) { + const visible = applyView(state.entries, state.view); + grid.render(visible); + + const total = state.playlists.length; + const filtered = Boolean(state.view.query.trim() || state.view.tag); + els.count.textContent = filtered ? `${visible.length} of ${plural(total, 'playlist')}` : plural(total, 'playlist'); + els.clear.hidden = !filtered; + syncTagChips(); + + const noMatches = filtered && total > 0 && visible.length === 0; + els.empty.hidden = !noMatches; + if (noMatches) { + const what = [state.view.query.trim() && `“${state.view.query.trim()}”`, state.view.tag && `the tag “${state.view.tag}”`].filter(Boolean).join(' and '); + els.empty.querySelector('.empty-message').textContent = `No playlists match ${what}.`; + } + + if (announce) { + // Debounced so screen readers hear the result, not every keystroke. + clearTimeout(announceTimer); + announceTimer = setTimeout(() => { + els.announcer.textContent = filtered ? `${plural(visible.length, 'playlist')} found` : `Showing all ${plural(total, 'playlist')}`; + }, 700); + } +} + +function setView(changes) { + state.view = { ...state.view, ...changes }; + syncControls(); + renderView({ announce: true }); + writeViewToUrl(); +} + +function syncControls() { + if (els.search.value !== state.view.query) els.search.value = state.view.query; + els.sort.value = state.view.sort; +} + +function setPlaylists(playlists) { + state.playlists = playlists; + state.byId = new Map(playlists.map((record) => [record.id, record])); + state.entries = playlists.map((record) => ({ record, text: searchText(record) })); + grid.prune(state.byId); + renderTags(); + renderView(); +} + +// --- Dialog & history ---------------------------------------------------------------------- + +let closingFromHistory = false; + +function openPlaylist(id, { push }) { + const record = state.byId.get(id); + if (!record) return false; + if (push) { + // Save the current filters into this history entry first, so Back returns to them. + if (urlTimer) flushViewToUrl(); + const url = new URL(location.href); + url.searchParams.set('p', id); + history.pushState({ playlist: id }, '', url); + } + sheet.open(record); + return true; +} + +function handleDialogClosed() { + if (closingFromHistory) { + closingFromHistory = false; + return; + } + // Opened from the grid: step back so Back doesn't reopen it. Arrived via a link: tidy the URL. + if (history.state?.playlist) { + history.back(); + } else { + const url = new URL(location.href); + url.searchParams.delete('p'); + history.replaceState(null, '', url); + } +} + +window.addEventListener('popstate', () => { + const id = new URL(location.href).searchParams.get('p'); + if (id && state.byId.has(id)) { + if (sheet.openId !== id) openPlaylist(id, { push: false }); + } else if (sheet.openId) { + closingFromHistory = true; + sheet.close(); + } + state.view = readViewFromUrl(); + syncControls(); + renderView(); +}); + +/** Opens ?p= once its playlist is known; after a full sync, gives up politely. */ +function openDeepLink({ final }) { + if (!state.deepLink) return; + if (openPlaylist(state.deepLink, { push: false })) { + state.deepLink = null; + } else if (final) { + state.deepLink = null; + handleDialogClosed(); + showToast('Sorry, that playlist isn’t available any more.'); + } +} + +// --- Notices --------------------------------------------------------------------------------- + +function showNotice(message, action) { + els.notice.querySelector('.notice-message').textContent = message; + const button = els.notice.querySelector('.notice-action'); + button.hidden = !action; + if (action) { + button.textContent = action.label; + button.onclick = action.run; + } + els.notice.hidden = false; +} + +const hideNotice = () => { + els.notice.hidden = true; +}; + +function handleSyncError(error) { + const known = error instanceof ApiError; + // Network trouble is the visitor's, and 5xx errors are already logged by the server. + const worthReporting = !known || error.code === 'BAD_RESPONSE' || (error.status >= 400 && error.status < 500); + if (worthReporting) reportError(error, { where: 'sync', code: error.code, status: error.status, requestId: error.requestId }); + + const retry = () => refresh(); + if (known && error.isOffline) window.addEventListener('online', retry, { once: true }); + + if (state.playlists.length) { + // We still have the saved copy on screen; mention it without getting in the way. + showToast(known && error.isOffline ? 'You’re offline — showing your saved playlists.' : 'Couldn’t check for new playlists. Showing your saved copy.'); + return; + } + + grid.render([]); + els.count.textContent = ''; + if (known && error.isOffline) { + showNotice('You’re offline. The playlists will load as soon as you reconnect.'); + } else if (known && error.code === 'CATALOGUE_UNAVAILABLE' && state.autoRetries < MAX_AUTO_RETRIES) { + state.autoRetries++; + const seconds = Math.min(error.retryAfter ?? 15, 60); + showNotice('The playlists are temporarily unavailable — TIDAL may be having a moment. Trying again shortly…', { label: 'Try again now', run: retry }); + setTimeout(retry, seconds * 1000); + } else { + const reference = known && error.requestId ? ` (Reference: ${error.requestId.slice(0, 8)})` : ''; + showNotice(`Sorry, the playlists couldn’t be loaded.${reference}`, { label: 'Try again', run: retry }); + } +} + +// --- Sync ------------------------------------------------------------------------------------ + +async function refresh({ boot } = {}) { + if (state.syncing) return; + state.syncing = true; + const cache = loadCache(); + try { + const result = await syncPlaylists({ cache, boot }); + state.lastSyncAt = Date.now(); + state.autoRetries = 0; + hideNotice(); + if (result.mode !== 'unchanged') saveCache(result); + if (result.mode !== 'unchanged' || !state.playlists.length) setPlaylists(result.playlists); + if (cache && result.added.length) { + showToast(result.added.length === 1 ? 'A new playlist has been added since your last visit.' : `${result.added.length} new playlists have been added since your last visit.`); + } + } catch (error) { + handleSyncError(error); + } finally { + state.syncing = false; + openDeepLink({ final: true }); + } +} + +// --- Controls -------------------------------------------------------------------------------- + +els.search.addEventListener('input', () => setView({ query: els.search.value })); +els.sort.addEventListener('change', () => setView({ sort: els.sort.value })); +els.form.addEventListener('submit', (event) => { + event.preventDefault(); + els.search.blur(); // Closes the on-screen keyboard on phones. +}); +els.clear.addEventListener('click', () => { + setView({ query: '', tag: '' }); + els.search.focus(); +}); +els.empty.querySelector('[data-action="clear-filters"]').addEventListener('click', () => { + setView({ query: '', tag: '' }); + els.search.focus(); +}); +els.tags.addEventListener('click', (event) => { + const chip = event.target.closest('.tag-chip'); + if (!chip) return; + setView({ tag: chip.getAttribute('aria-pressed') === 'true' ? '' : chip.dataset.tag }); +}); + +// Long-lived tabs: look for new playlists when the visitor comes back. +const resyncIfStale = () => { + if (document.visibilityState === 'visible' && Date.now() - state.lastSyncAt > RESYNC_AFTER_MS) refresh(); +}; +document.addEventListener('visibilitychange', resyncIfStale); +window.addEventListener('pageshow', (event) => event.persisted && resyncIfStale()); + +// --- Start ------------------------------------------------------------------------------------- + +try { + syncControls(); + const cached = loadCache(); + if (cached) { + setPlaylists(cached.playlists); // Instant: no network needed to show the grid. + openDeepLink({ final: false }); + } + const boot = window.__selectionsBoot; + window.__selectionsBoot = undefined; + await refresh({ boot }); +} catch (error) { + reportError(error, { where: 'start' }); + showNotice('Sorry, something went wrong while starting up.', { label: 'Reload', run: () => location.reload() }); +} diff --git a/public/js/modules/DataFetcher.js b/public/js/modules/DataFetcher.js deleted file mode 100644 index 8609bc22..00000000 --- a/public/js/modules/DataFetcher.js +++ /dev/null @@ -1,61 +0,0 @@ -export const DataFetcher = (() => { - const userId = '111112791'; - - const fetchAllPlaylists = async (userId, offset = 0, fetchedPlaylists = []) => { - try { - const response = await fetch(`/playlists/${userId}?offset=${offset}`); - if (!response.ok) { - const errorDetails = await response.json(); - console.error('Error fetching playlists:', errorDetails); - return []; - } - - const newPlaylists = await response.json(); - console.log('Received playlists:', newPlaylists); - - fetchedPlaylists = fetchedPlaylists.concat(newPlaylists.items); - - if (newPlaylists.items.length === 50) { - return await fetchAllPlaylists(userId, offset + 50, fetchedPlaylists); - } - - return fetchedPlaylists; - } catch (error) { - console.error('Error fetching playlists:', error); - return []; - } - }; - - const fetchPlaylists = async (search = '') => { - let allFetchedPlaylists = []; - - try { - const cacheKey = `playlists-${userId}`; - const cachedPlaylists = localStorage.getItem(cacheKey); - - if (cachedPlaylists) { - console.log('Using cached playlists'); - allFetchedPlaylists = JSON.parse(cachedPlaylists); - } else { - allFetchedPlaylists = await fetchAllPlaylists(userId); - localStorage.setItem(cacheKey, JSON.stringify(allFetchedPlaylists)); - } - - const searchLowerCase = search.toLowerCase(); - - const filteredPlaylists = allFetchedPlaylists.filter((playlist) => - playlist.name.toLowerCase().includes(searchLowerCase) || - (playlist.description && playlist.description.toLowerCase().includes(searchLowerCase)) - ); - return filteredPlaylists; - } catch (error) { - console.error(error); - return []; - } - }; - - return { - fetchAllPlaylists, - fetchPlaylists - }; -})(); diff --git a/public/js/modules/EventHandlers.js b/public/js/modules/EventHandlers.js deleted file mode 100644 index 6f218dd2..00000000 --- a/public/js/modules/EventHandlers.js +++ /dev/null @@ -1,82 +0,0 @@ -import { DataFetcher } from './DataFetcher.js'; -import { UIManager } from './UIManager.js'; - -export const EventHandlers = (() => { - const searchInput = document.getElementById('search'); - const resetButton = document.getElementById('reset-button'); - const closeOverlay = document.getElementById('close-overlay'); - const overlayBackground = document.getElementById('overlay-background'); - const openWebButton = document.getElementById('open-web'); - const copyUrlButton = document.getElementById('copy-url'); - - const onSearchInputKeyDown = async (event) => { - if (event.key === 'Enter') { - UIManager.toggleLoadingMessage(true); - try { - const playlists = await DataFetcher.fetchPlaylists(event.target.value); - UIManager.displayPlaylists(playlists); - } catch (error) { - console.error('Error fetching playlists:', error); - } finally { - UIManager.toggleLoadingMessage(false); - } - } - }; - - const onResetButtonClick = async () => { - searchInput.value = ''; - UIManager.updateResetButton(''); - UIManager.toggleLoadingMessage(true); - try { - const playlists = await DataFetcher.fetchPlaylists(); - UIManager.displayPlaylists(playlists); - } catch (error) { - console.error('Error fetching playlists:', error); - } finally { - UIManager.toggleLoadingMessage(false); - } - }; - - const onCloseOverlayClick = () => { - const overlay = document.getElementById('overlay-background'); - overlay.classList.add('hidden'); - }; - - const onOverlayBackgroundClick = (event) => { - if (event.target === event.currentTarget) { - overlayBackground.classList.add('hidden'); - } - }; - - const onOpenWebButtonClick = () => { - const playlistId = openWebButton.getAttribute('data-playlist-id'); - const webUrl = `https://open.spotify.com/playlist/${playlistId}`; - window.open(webUrl, '_blank'); - }; - - const onCopyUrlButtonClick = () => { - const player = document.getElementById('spotify-player'); - const textarea = document.createElement('textarea'); - textarea.value = player.src; - document.body.appendChild(textarea); - textarea.select(); - document.execCommand('copy'); - document.body.removeChild(textarea); - alert('Playlist URL copied to clipboard'); - }; - - // Initialize all event listeners - const initEventListeners = () => { - searchInput.addEventListener('keydown', onSearchInputKeyDown); - resetButton.addEventListener('click', onResetButtonClick); - closeOverlay.addEventListener('click', onCloseOverlayClick); - overlayBackground.addEventListener('click', onOverlayBackgroundClick); - openWebButton.addEventListener('click', onOpenWebButtonClick); - copyUrlButton.addEventListener('click', onCopyUrlButtonClick); - // Additional event listeners can be added here as needed - }; - - return { - initEventListeners - }; -})(); diff --git a/public/js/modules/UIManager.js b/public/js/modules/UIManager.js deleted file mode 100644 index 06642e6e..00000000 --- a/public/js/modules/UIManager.js +++ /dev/null @@ -1,55 +0,0 @@ -export const UIManager = (() => { - const playlistsContainer = document.getElementById('playlists-container'); - const loadingMessage = document.getElementById('loading-message'); - const resetButton = document.getElementById('reset-button'); - - const toggleLoadingMessage = (show) => { - loadingMessage.style.display = show ? 'block' : 'none'; - }; - - const updateResetButton = (search) => { - resetButton.style.display = search !== '' ? 'inline-block' : 'none'; - }; - - const displayPlaylists = (playlists) => { - while (playlistsContainer.firstChild) { - playlistsContainer.removeChild(playlistsContainer.firstChild); - } - - playlists.sort((a, b) => a.name.localeCompare(b.name)); - - const counter = document.getElementById('playlist-counter'); - counter.textContent = `Showing ${playlists.length} playlists`; - - playlists.forEach((playlist) => { - const playlistElement = document.createElement('div'); - playlistElement.className = 'playlist flex lay--column lay--gap-small-xx'; - playlistElement.innerHTML = ` - ${playlist.name} cover art -

${playlist.name}

-
-

${(playlist.tracks?.total || 0)} songs

-

|

-

${(playlist.followers?.total || 0)} followers

-
-

${playlist.description || ''}

- `; - - playlistsContainer.appendChild(playlistElement); - - // Additional logic for playlist interaction can be added here - }); - }; - - const updateOverlay = (playlist) => { - // Logic to update overlay with playlist details - // This needs to be implemented based on your specific requirements - }; - - return { - toggleLoadingMessage, - updateResetButton, - displayPlaylists, - updateOverlay - }; -})(); diff --git a/public/js/modules/Utils.js b/public/js/modules/Utils.js deleted file mode 100644 index 395030f5..00000000 --- a/public/js/modules/Utils.js +++ /dev/null @@ -1 +0,0 @@ -export const Utils = (() => { })(); \ No newline at end of file diff --git a/public/js/report.js b/public/js/report.js new file mode 100644 index 00000000..5e0ee50b --- /dev/null +++ b/public/js/report.js @@ -0,0 +1,68 @@ +// Sends browser errors to the server (POST /api/reports), which logs them and +// forwards them to Sentry when configured. No third-party script required. + +const ENDPOINT = '/api/reports'; +const MAX_REPORTS_PER_PAGE = 10; + +// Errors that are not ours or not actionable. +const IGNORED = [/ResizeObserver loop/i, /^Script error\.?$/i, /extension:\/\//i, /^AbortError/]; + +const sent = new Set(); +let count = 0; + +const release = () => document.documentElement.dataset.release; + +function toError(value) { + if (value instanceof Error) return value; + if (typeof value === 'string') return new Error(value); + try { + return new Error(JSON.stringify(value)); + } catch { + return new Error(String(value)); + } +} + +/** + * Records an error: always logs to the console, and reports it to the server + * at most once per distinct message, and at most 10 times per page view. + */ +export function reportError(value, context = {}) { + const error = toError(value); + console.error(error, context); + + const signature = `${error.name}: ${error.message}`; + const haystack = `${signature}\n${error.stack ?? ''}`; + if (IGNORED.some((pattern) => pattern.test(haystack))) return; + if (sent.has(signature) || count >= MAX_REPORTS_PER_PAGE) return; + sent.add(signature); + count++; + + const payload = JSON.stringify({ + type: 'client-error', + name: error.name, + message: error.message, + stack: error.stack, + url: location.href, + userAgent: navigator.userAgent, + release: release(), + context, + }); + + try { + const blob = new Blob([payload], { type: 'application/json' }); + if (navigator.sendBeacon?.(ENDPOINT, blob)) return; + fetch(ENDPOINT, { method: 'POST', body: payload, headers: { 'Content-Type': 'application/json' }, keepalive: true }).catch(() => {}); + } catch { + // Reporting must never throw. + } +} + +/** Catches anything not handled elsewhere. */ +export function installGlobalErrorHandlers() { + window.addEventListener('error', (event) => { + reportError(event.error ?? event.message, { where: 'window.onerror', source: event.filename, line: event.lineno, column: event.colno }); + }); + window.addEventListener('unhandledrejection', (event) => { + reportError(event.reason, { where: 'unhandledrejection' }); + }); +} diff --git a/public/js/store.js b/public/js/store.js new file mode 100644 index 00000000..7c3a1612 --- /dev/null +++ b/public/js/store.js @@ -0,0 +1,60 @@ +// The browser's copy of the playlists, kept in localStorage so repeat visits +// render instantly and only download what changed. ~100 KB for 150 playlists. + +import { CACHE_ETAG_KEY, CACHE_KEY } from './constants.js'; +import { reportError } from './report.js'; + +export const isRecord = (record) => + typeof record?.id === 'string' && typeof record.rev === 'string' && typeof record.title === 'string'; + +function storage() { + try { + return window.localStorage; // Throws when storage is blocked. + } catch { + return null; + } +} + +export function clearCache() { + try { + storage()?.removeItem(CACHE_KEY); + storage()?.removeItem(CACHE_ETAG_KEY); + } catch { + // Nothing more we can do. + } +} + +/** The cached { etag, savedAt, playlists }, or null if missing or unusable. */ +export function loadCache() { + const store = storage(); + if (!store) return null; + try { + const raw = store.getItem(CACHE_KEY); + if (!raw) return null; + const data = JSON.parse(raw); + if (typeof data?.etag !== 'string' || !Array.isArray(data.playlists) || !data.playlists.every(isRecord)) { + throw new Error('Cached playlists have an unexpected shape'); + } + return data; + } catch (error) { + reportError(error, { where: 'loadCache' }); + clearCache(); + return null; + } +} + +export function saveCache({ etag, playlists }) { + const store = storage(); + if (!store) return false; + try { + store.setItem(CACHE_KEY, JSON.stringify({ etag, savedAt: Date.now(), playlists })); + // Written last, read by the boot script in : only set once the data it describes is saved. + store.setItem(CACHE_ETAG_KEY, etag); + return true; + } catch (error) { + clearCache(); + // A full disk is the browser's business, not a bug; anything else is worth knowing about. + if (error?.name !== 'QuotaExceededError') reportError(error, { where: 'saveCache' }); + return false; + } +} diff --git a/public/js/sync.js b/public/js/sync.js new file mode 100644 index 00000000..c8c29240 --- /dev/null +++ b/public/js/sync.js @@ -0,0 +1,100 @@ +// Keeps the browser's copy of the playlists current while downloading as little +// as possible: +// +// 1. Ask for the manifest with the cached etag → usually a bodiless 304. Done. +// 2. Otherwise compare the manifest (id + revision per playlist) with the +// cache, and fetch only playlists that are new or changed. +// 3. Fall back to one full download when most of it changed anyway. + +import { ApiError, getJson, readJson } from './api.js'; +import { isRecord } from './store.js'; + +const BATCH_SIZE = 50; +const FULL_DOWNLOAD_RATIO = 0.5; + +const chunk = (items, size) => Array.from({ length: Math.ceil(items.length / size) }, (_, i) => items.slice(i * size, (i + 1) * size)); + +export function diffManifest(cached, items) { + const known = new Map(cached.map((record) => [record.id, record.rev])); + const live = new Set(); + const added = []; + const changed = []; + for (const [id, rev] of items) { + live.add(id); + if (!known.has(id)) added.push(id); + else if (known.get(id) !== rev) changed.push(id); + } + const removed = cached.filter((record) => !live.has(record.id)).map((record) => record.id); + return { added, changed, removed }; +} + +export function mergePlaylists(cached, fetched, removed) { + const byId = new Map(cached.map((record) => [record.id, record])); + for (const id of removed) byId.delete(id); + for (const record of fetched) byId.set(record.id, record); + return [...byId.values()]; +} + +function expectPlaylists(data) { + if (typeof data?.etag !== 'string' || !Array.isArray(data.playlists) || !data.playlists.every(isRecord)) { + throw new ApiError('The server sent playlists in an unexpected format.', { code: 'BAD_RESPONSE' }); + } + return data; +} + +function expectManifest(data) { + if (typeof data?.etag !== 'string' || !Array.isArray(data.items) || !data.items.every((item) => Array.isArray(item) && item.length === 2)) { + throw new ApiError('The server sent a manifest in an unexpected format.', { code: 'BAD_RESPONSE' }); + } + return data; +} + +async function downloadAll() { + const { data } = await getJson('/api/playlists'); + return expectPlaylists(data); +} + +/** + * @param cache { etag, playlists } from localStorage, or null + * @param boot { etag, request } started by the inline script in , if any + * @returns { playlists, etag, added, changed, removed, mode: 'unchanged' | 'delta' | 'full' } + */ +export async function syncPlaylists({ cache, boot }) { + if (!cache) { + // The boot script only requested everything when it found no cached etag. + const data = boot && !boot.etag ? expectPlaylists((await readJson(boot.request)).data) : await downloadAll(); + return { playlists: data.playlists, etag: data.etag, added: [], changed: 0, removed: 0, mode: 'full' }; + } + + const response = boot?.etag === cache.etag ? await readJson(boot.request) : await getJson('/api/playlists/manifest', { etag: cache.etag }); + if (response.status === 304) { + return { playlists: cache.playlists, etag: cache.etag, added: [], changed: 0, removed: 0, mode: 'unchanged' }; + } + + const manifest = expectManifest(response.data); + const { added, changed, removed } = diffManifest(cache.playlists, manifest.items); + const wanted = [...added, ...changed]; + + if (wanted.length > Math.max(20, manifest.items.length * FULL_DOWNLOAD_RATIO)) { + const data = await downloadAll(); + return { playlists: data.playlists, etag: data.etag, added, changed: changed.length, removed: removed.length, mode: 'full' }; + } + + const pages = await Promise.all( + chunk(wanted, BATCH_SIZE).map(async (ids) => expectPlaylists((await getJson(`/api/playlists?ids=${ids.map(encodeURIComponent).join(',')}`)).data)), + ); + // The catalogue changed between our two requests: simplest to start afresh. + if (pages.some((page) => page.missing?.length)) { + const data = await downloadAll(); + return { playlists: data.playlists, etag: data.etag, added, changed: changed.length, removed: removed.length, mode: 'full' }; + } + + return { + playlists: mergePlaylists(cache.playlists, pages.flatMap((page) => page.playlists), removed), + etag: manifest.etag, + added, + changed: changed.length, + removed: removed.length, + mode: 'delta', + }; +} diff --git a/public/js/toast.js b/public/js/toast.js new file mode 100644 index 00000000..d253bfb2 --- /dev/null +++ b/public/js/toast.js @@ -0,0 +1,13 @@ +let timer; + +/** Brief, non-blocking message at the bottom of the page (announced politely). */ +export function showToast(message, { duration = 4000 } = {}) { + const toast = document.getElementById('toast'); + if (!toast) return; + clearTimeout(timer); + toast.textContent = message; + toast.hidden = false; + timer = setTimeout(() => { + toast.hidden = true; + }, duration); +} diff --git a/scripts/check-syntax.js b/scripts/check-syntax.js new file mode 100644 index 00000000..f986c4ac --- /dev/null +++ b/scripts/check-syntax.js @@ -0,0 +1,29 @@ +// Parses every JavaScript file in the project without running it, so syntax +// errors in browser modules (which no server test imports) still fail CI. +import { spawnSync } from 'node:child_process'; +import { readdirSync } from 'node:fs'; +import { join } from 'node:path'; + +const roots = ['app.js', 'src', 'scripts', 'public/js', 'test']; +const files = []; + +const walk = (path) => { + if (path.endsWith('.js')) return files.push(path); + for (const entry of readdirSync(path, { withFileTypes: true })) { + if (entry.isDirectory()) walk(join(path, entry.name)); + else if (entry.name.endsWith('.js')) files.push(join(path, entry.name)); + } +}; +roots.forEach(walk); + +let failed = 0; +for (const file of files) { + const result = spawnSync(process.execPath, ['--check', file], { encoding: 'utf8' }); + if (result.status !== 0) { + failed++; + process.stderr.write(result.stderr); + } +} + +console.log(`Checked ${files.length} files, ${failed} with syntax errors.`); +process.exit(failed ? 1 : 0); diff --git a/scripts/tidal-login.js b/scripts/tidal-login.js new file mode 100644 index 00000000..ab5156d5 --- /dev/null +++ b/scripts/tidal-login.js @@ -0,0 +1,129 @@ +// One-time sign-in with your TIDAL account, for when TIDAL won't let the app +// read your playlists with client credentials alone. +// +// npm run tidal:login prints TIDAL_REFRESH_TOKEN and TIDAL_USER_ID +// npm run tidal:login -- --save also writes them into .env +// +// Uses the OAuth 2.1 authorisation-code flow with PKCE. Register the redirect +// URI (default http://localhost:3000/callback) in your app at +// developer.tidal.com first, and stop the app if it is using that port. + +import { createHash, randomBytes } from 'node:crypto'; +import { existsSync, readFileSync, writeFileSync } from 'node:fs'; +import { createServer } from 'node:http'; +import { loadEnvFile } from '../src/config.js'; + +const AUTHORIZE_URL = 'https://login.tidal.com/authorize'; +const TOKEN_URL = 'https://auth.tidal.com/v1/oauth2/token'; +const API_URL = 'https://openapi.tidal.com/v2'; +const TIMEOUT_MS = 5 * 60_000; + +loadEnvFile(); +const clientId = process.env.TIDAL_CLIENT_ID?.trim(); +const clientSecret = process.env.TIDAL_CLIENT_SECRET?.trim(); +const redirectUri = process.env.TIDAL_REDIRECT_URI?.trim() || 'http://localhost:3000/callback'; +const scopes = process.env.TIDAL_SCOPES?.trim() || 'user.read playlists.read'; +const save = process.argv.includes('--save'); + +const fail = (message) => { + console.error(`\n✖ ${message}\n`); + process.exit(1); +}; + +if (!clientId) fail('Set TIDAL_CLIENT_ID (and TIDAL_CLIENT_SECRET) in .env first.'); +const redirect = new URL(redirectUri); +if (redirect.protocol !== 'http:' || !['localhost', '127.0.0.1'].includes(redirect.hostname)) { + fail('TIDAL_REDIRECT_URI must be a http://localhost address for this helper.'); +} + +const verifier = randomBytes(48).toString('base64url'); +const challenge = createHash('sha256').update(verifier).digest('base64url'); +const state = randomBytes(16).toString('base64url'); +const authorizeUrl = `${AUTHORIZE_URL}?${new URLSearchParams({ + response_type: 'code', + client_id: clientId, + redirect_uri: redirectUri, + scope: scopes, + code_challenge_method: 'S256', + code_challenge: challenge, + state, +})}`; + +async function exchangeCode(code) { + const body = new URLSearchParams({ grant_type: 'authorization_code', client_id: clientId, code, redirect_uri: redirectUri, code_verifier: verifier }); + if (clientSecret) body.set('client_secret', clientSecret); + const res = await fetch(TOKEN_URL, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body }); + const payload = await res.json().catch(() => ({})); + if (!res.ok) throw new Error(`TIDAL refused the sign-in (${res.status}): ${payload.error_description || payload.error || res.statusText}`); + if (!payload.refresh_token) throw new Error('TIDAL did not return a refresh token.'); + return payload; +} + +async function findUserId(tokens) { + const fromToken = tokens.user_id ?? tokens.user?.userId; + if (fromToken) return String(fromToken); + try { + const res = await fetch(`${API_URL}/users/me`, { headers: { Authorization: `Bearer ${tokens.access_token}`, Accept: 'application/vnd.api+json' } }); + if (res.ok) return (await res.json())?.data?.id ?? null; + } catch { + // Not essential: with a refresh token the app can use "me". + } + return null; +} + +function saveToEnv(values) { + const lines = existsSync('.env') ? readFileSync('.env', 'utf8').split('\n') : []; + for (const [key, value] of Object.entries(values)) { + if (!value) continue; + const index = lines.findIndex((line) => line.startsWith(`${key}=`)); + if (index === -1) lines.push(`${key}=${value}`); + else lines[index] = `${key}=${value}`; + } + writeFileSync('.env', `${lines.join('\n').replace(/\n*$/, '')}\n`, { mode: 0o600 }); +} + +const page = (title, message) => + `${title}

${title}

${message}

`; + +const server = createServer(async (req, res) => { + const url = new URL(req.url, redirectUri); + if (url.pathname !== redirect.pathname) return res.writeHead(404).end(); + + const respond = (status, title, message) => res.writeHead(status, { 'Content-Type': 'text/html; charset=utf-8' }).end(page(title, message)); + try { + if (url.searchParams.get('error')) throw new Error(`TIDAL said: ${url.searchParams.get('error_description') || url.searchParams.get('error')}`); + if (url.searchParams.get('state') !== state) throw new Error('The sign-in response did not match this request. Please run the command again.'); + const code = url.searchParams.get('code'); + if (!code) throw new Error('TIDAL did not send an authorisation code.'); + + const tokens = await exchangeCode(code); + const userId = await findUserId(tokens); + respond(200, 'Signed in ✓', 'You can close this tab and return to the terminal.'); + + console.log('\n✔ Signed in to TIDAL.\n'); + if (save) { + saveToEnv({ TIDAL_REFRESH_TOKEN: tokens.refresh_token, TIDAL_USER_ID: userId }); + console.log('Saved TIDAL_REFRESH_TOKEN' + (userId ? ' and TIDAL_USER_ID' : '') + ' to .env.'); + } else { + console.log('Add these to .env (and to your host’s environment settings):\n'); + console.log(` TIDAL_REFRESH_TOKEN=${tokens.refresh_token}`); + if (userId) console.log(` TIDAL_USER_ID=${userId}`); + } + console.log('\nKeep the refresh token secret: it grants read access to your TIDAL account.\n'); + server.close(() => process.exit(0)); + } catch (error) { + respond(400, 'Sign-in failed', error.message); + server.close(() => fail(error.message)); + } +}); + +server.on('error', (error) => { + fail(error.code === 'EADDRINUSE' ? `Port ${redirect.port} is in use. Stop the app (or whatever uses it) and try again.` : error.message); +}); + +server.listen(Number(redirect.port) || 80, '127.0.0.1', () => { + console.log('\nOpen this link to sign in to TIDAL:\n'); + console.log(` ${authorizeUrl}\n`); + console.log(`Waiting for TIDAL to redirect back to ${redirectUri} …`); + setTimeout(() => server.close(() => fail('Timed out waiting for the sign-in. Run the command again.')), TIMEOUT_MS).unref(); +}); diff --git a/src/catalogue.js b/src/catalogue.js new file mode 100644 index 00000000..4f3050b8 --- /dev/null +++ b/src/catalogue.js @@ -0,0 +1,158 @@ +import { createHash } from 'node:crypto'; +import { mkdir, readFile, rename, writeFile } from 'node:fs/promises'; +import { dirname } from 'node:path'; +import { CatalogueUnavailableError, TidalAuthError } from './errors.js'; + +// Bump when the record shape changes, so old snapshots on disk are ignored. +const SNAPSHOT_VERSION = 1; + +/** Content-derived version of the whole catalogue: identical data ⇒ identical etag, across restarts. */ +export function catalogueEtag(records) { + const hash = createHash('sha256'); + for (const record of records) hash.update(`${record.id}:${record.rev}\n`); + return hash.digest('base64url').slice(0, 16); +} + +function buildSnapshot(records, fetchedAt) { + return { + records, + byId: new Map(records.map((record) => [record.id, record])), + manifest: records.map((record) => [record.id, record.rev]), + etag: catalogueEtag(records), + fetchedAt, + }; +} + +const isValidRecord = (record) => typeof record?.id === 'string' && typeof record?.rev === 'string' && typeof record?.title === 'string'; + +/** + * The server's copy of the playlists. + * + * - Serves from memory; once older than `ttlMs`, the next request triggers a + * background refresh and is answered immediately with the current copy. + * - Persists a last-known-good snapshot to disk, so restarts are instant and + * a TIDAL outage doesn't take the site down. + * - Backs off exponentially while TIDAL is failing. + */ +export function createCatalogue({ load, ttlMs, snapshotPath, logger, reporter, now = Date.now, minRetryMs = 30_000 }) { + let snapshot = null; + let refreshing = null; + let failures = 0; + let lastError = null; + let nextAttemptAt = 0; + + async function persist(snap) { + if (!snapshotPath) return; + const tmp = `${snapshotPath}.${process.pid}.tmp`; + await mkdir(dirname(snapshotPath), { recursive: true }); + await writeFile(tmp, JSON.stringify({ version: SNAPSHOT_VERSION, fetchedAt: snap.fetchedAt, records: snap.records })); + await rename(tmp, snapshotPath); + } + + async function restore() { + if (!snapshotPath) return false; + let raw; + try { + raw = await readFile(snapshotPath, 'utf8'); + } catch (err) { + if (err.code !== 'ENOENT') logger.warn({ err }, 'Could not read playlist snapshot'); + return false; + } + try { + const data = JSON.parse(raw); + if (data?.version !== SNAPSHOT_VERSION || !Array.isArray(data.records) || !data.records.every(isValidRecord)) { + logger.info('Ignoring playlist snapshot from an older version'); + return false; + } + snapshot = buildSnapshot(data.records, Number(data.fetchedAt) || 0); + logger.info({ count: snapshot.records.length, ageSeconds: ageSeconds() }, 'Restored playlist snapshot from disk'); + return true; + } catch (err) { + logger.warn({ err }, 'Playlist snapshot is corrupt; ignoring it'); + return false; + } + } + + const ageSeconds = () => (snapshot ? Math.round((now() - snapshot.fetchedAt) / 1000) : null); + const isStale = () => !snapshot || now() - snapshot.fetchedAt >= ttlMs; + + function refresh() { + refreshing ??= (async () => { + const startedAt = now(); + try { + const records = await load(); + const changed = snapshot?.etag !== catalogueEtag(records); + snapshot = buildSnapshot(records, now()); + failures = 0; + lastError = null; + nextAttemptAt = 0; + logger.info({ count: records.length, etag: snapshot.etag, changed, ms: now() - startedAt }, 'Playlist catalogue refreshed'); + persist(snapshot).catch((err) => logger.warn({ err }, 'Could not save playlist snapshot')); + return snapshot; + } catch (error) { + failures++; + lastError = { code: error.code ?? 'UNKNOWN', message: error.message, at: new Date(now()).toISOString() }; + nextAttemptAt = now() + Math.min(minRetryMs * 2 ** (failures - 1), ttlMs); + // Credentials problems never fix themselves; a blip while we still have data is just a warning. + const serious = !snapshot || error instanceof TidalAuthError || failures >= 3; + reporter.exception(error, { + level: serious ? 'error' : 'warn', + msg: snapshot ? 'Could not refresh playlists from TIDAL; still serving the previous copy' : 'Could not load playlists from TIDAL', + tags: { component: 'catalogue' }, + extra: { failures, retryInSeconds: Math.round((nextAttemptAt - now()) / 1000) }, + }); + throw error; + } finally { + refreshing = null; + } + })(); + return refreshing; + } + + const unavailable = (cause) => { + const error = new CatalogueUnavailableError(cause); + error.retryAfterSeconds = Math.max(5, Math.ceil((nextAttemptAt - now()) / 1000)); + return error; + }; + + return { + /** Restores the disk snapshot and starts fetching fresh data without waiting for it. */ + async start() { + await restore(); + if (isStale()) refresh().catch(() => {}); + }, + + /** The current snapshot. Only waits for TIDAL when there is nothing to serve yet. */ + async get() { + if (snapshot) { + if (isStale() && !refreshing && now() >= nextAttemptAt) refresh().catch(() => {}); + return snapshot; + } + if (!refreshing && now() < nextAttemptAt) throw unavailable(lastError); + try { + return await (refreshing ?? refresh()); + } catch (error) { + throw unavailable(error); + } + }, + + /** The current snapshot or null, without waiting or triggering a refresh. */ + peek() { + return snapshot; + }, + + status() { + return { + ready: Boolean(snapshot), + count: snapshot?.records.length ?? 0, + etag: snapshot?.etag ?? null, + fetchedAt: snapshot ? new Date(snapshot.fetchedAt).toISOString() : null, + ageSeconds: ageSeconds(), + stale: isStale(), + refreshing: Boolean(refreshing), + consecutiveFailures: failures, + lastError, + }; + }, + }; +} diff --git a/src/config.js b/src/config.js new file mode 100644 index 00000000..ca67f107 --- /dev/null +++ b/src/config.js @@ -0,0 +1,94 @@ +import { existsSync } from 'node:fs'; +import { ConfigError } from './errors.js'; + +const MINUTE = 60_000; + +/** Loads `.env` (if present) into process.env without overriding real env vars. */ +export function loadEnvFile(path = '.env') { + if (existsSync(path)) process.loadEnvFile(path); +} + +const toInt = (value, fallback, name) => { + if (value === undefined || value === '') return fallback; + const n = Number(value); + if (!Number.isInteger(n) || n < 0) throw new ConfigError(`${name} must be a whole number, got "${value}".`); + return n; +}; + +const toUrl = (value, name) => { + if (!value) return null; + try { + return new URL(value).href.replace(/\/$/, ''); + } catch { + throw new ConfigError(`${name} must be an absolute URL, got "${value}".`); + } +}; + +/** + * Reads and validates configuration. Throws a ConfigError listing every + * problem at once, so a misconfigured deploy fails fast with a clear message. + */ +export function readConfig(env = process.env) { + const problems = []; + const mock = env.TIDAL_MOCK === '1' || env.TIDAL_MOCK === 'true'; + + const tidal = { + clientId: env.TIDAL_CLIENT_ID?.trim() || '', + clientSecret: env.TIDAL_CLIENT_SECRET?.trim() || '', + userId: env.TIDAL_USER_ID?.trim() || '', + refreshToken: env.TIDAL_REFRESH_TOKEN?.trim() || '', + countryCode: (env.TIDAL_COUNTRY_CODE?.trim() || 'GB').toUpperCase(), + apiBaseUrl: 'https://openapi.tidal.com/v2', + tokenUrl: 'https://auth.tidal.com/v1/oauth2/token', + mock, + }; + + if (!mock) { + if (!tidal.clientId || !tidal.clientSecret) { + const legacy = env.CLIENT_ID || env.CLIENT_SECRET + ? ' Found CLIENT_ID/CLIENT_SECRET, which were the old Spotify settings — rename them to TIDAL_CLIENT_ID/TIDAL_CLIENT_SECRET with your TIDAL values.' + : ''; + problems.push(`TIDAL_CLIENT_ID and TIDAL_CLIENT_SECRET are required.${legacy}`); + } + // With a refresh token the owner is known ("me"); otherwise we must be told whose playlists to list. + if (!tidal.userId && !tidal.refreshToken) { + problems.push('TIDAL_USER_ID is required (run `npm run tidal:login` to find it).'); + } + if (!/^[A-Z]{2}$/.test(tidal.countryCode)) { + problems.push(`TIDAL_COUNTRY_CODE must be a two-letter country code, got "${tidal.countryCode}".`); + } + } + + let config; + try { + config = { + env: env.NODE_ENV || 'development', + isProduction: env.NODE_ENV === 'production', + port: toInt(env.PORT, 3000, 'PORT'), + logLevel: env.LOG_LEVEL || (env.NODE_ENV === 'test' ? 'silent' : 'info'), + trustProxy: toInt(env.TRUST_PROXY, 1, 'TRUST_PROXY'), + tidal, + catalogue: { + // CACHE_DURATION keeps the name used by the previous version of the app. + ttlMs: Math.max(toInt(env.CACHE_DURATION, 10 * MINUTE, 'CACHE_DURATION'), 30_000), + snapshotPath: env.SNAPSHOT_PATH || '.cache/playlists.json', + }, + site: { + url: toUrl(env.SITE_URL, 'SITE_URL') || 'https://soundselections.onrender.com', + profileUrl: toUrl(env.TIDAL_PROFILE_URL, 'TIDAL_PROFILE_URL'), + }, + sentry: { + dsn: env.SENTRY_DSN?.trim() || '', + release: env.RENDER_GIT_COMMIT || env.SOURCE_VERSION || undefined, + }, + }; + } catch (error) { + if (!(error instanceof ConfigError)) throw error; + problems.push(error.message); + } + + if (problems.length) { + throw new ConfigError(`Invalid configuration:\n - ${problems.join('\n - ')}\nSee .env.example for every setting.`); + } + return config; +} diff --git a/src/errors.js b/src/errors.js new file mode 100644 index 00000000..b9942c71 --- /dev/null +++ b/src/errors.js @@ -0,0 +1,76 @@ +/** + * Base class for errors we raise on purpose. `code` is a stable identifier for + * logs and API responses; `status` is the HTTP status to answer with; `expose` + * marks messages that are safe to show to visitors. + */ +export class AppError extends Error { + constructor(message, { code = 'INTERNAL', status = 500, expose = false, cause, details } = {}) { + super(message, { cause }); + this.name = new.target.name; + this.code = code; + this.status = status; + this.expose = expose; + if (details) this.details = details; + } +} + +export class ConfigError extends AppError { + constructor(message) { + super(message, { code: 'CONFIG_INVALID' }); + } +} + +/** A failed call to the TIDAL API or token endpoint. Never carries tokens. */ +export class TidalError extends AppError { + constructor(message, { status, tidalCode, subStatus, requestId, url, retryable = false, cause } = {}) { + super(message, { code: 'TIDAL_ERROR', status: 502, cause }); + this.upstreamStatus = status; + this.tidalCode = tidalCode; + this.subStatus = subStatus; + this.requestId = requestId; + this.url = url; + this.retryable = retryable; + } +} + +/** TIDAL refused our credentials or their scope. Retrying will not help. */ +export class TidalAuthError extends TidalError { + constructor(message, options) { + super(message, { ...options, retryable: false }); + this.code = 'TIDAL_AUTH'; + } +} + +export class CatalogueUnavailableError extends AppError { + constructor(cause) { + super('Playlists are temporarily unavailable. Please try again shortly.', { + code: 'CATALOGUE_UNAVAILABLE', + status: 503, + expose: true, + cause, + }); + } +} + +export class BadRequestError extends AppError { + constructor(message) { + super(message, { code: 'BAD_REQUEST', status: 400, expose: true }); + } +} + +export class NotFoundError extends AppError { + constructor(message = 'Not found.') { + super(message, { code: 'NOT_FOUND', status: 404, expose: true }); + } +} + +/** Plain, loggable summary of any thrown value, including its cause chain. */ +export function serialiseError(error, depth = 0) { + if (!(error instanceof Error)) return { message: String(error) }; + const out = { name: error.name, message: error.message, stack: error.stack }; + for (const key of ['code', 'status', 'upstreamStatus', 'tidalCode', 'subStatus', 'requestId', 'url', 'details']) { + if (error[key] !== undefined) out[key] = error[key]; + } + if (error.cause && depth < 3) out.cause = serialiseError(error.cause, depth + 1); + return out; +} diff --git a/src/http/app.js b/src/http/app.js new file mode 100644 index 00000000..280a671b --- /dev/null +++ b/src/http/app.js @@ -0,0 +1,232 @@ +import { randomBytes, randomUUID } from 'node:crypto'; +import { fileURLToPath } from 'node:url'; +import compression from 'compression'; +import express from 'express'; +import helmet from 'helmet'; +import { pinoHttp } from 'pino-http'; +import { CACHE_ETAG_KEY, CARD_IMAGE_SIZES, srcsetFor } from '../../public/js/constants.js'; +import { AppError, BadRequestError, NotFoundError } from '../errors.js'; +import { mockArtworkHandler } from '../tidal/mock.js'; +import { createRateLimiter, parseReports } from './reports.js'; + +const publicDir = fileURLToPath(new URL('../../public', import.meta.url)); +const viewsDir = fileURLToPath(new URL('../../views', import.meta.url)); + +const MAX_IDS_PER_REQUEST = 100; +const ID_PATTERN = /^[A-Za-z0-9-]{1,64}$/; +const REQUEST_ID_PATTERN = /^[\w.:-]{1,100}$/; + +const asyncRoute = (handler) => (req, res, next) => Promise.resolve(handler(req, res, next)).catch(next); + +function parseIds(raw) { + if (raw === undefined) return null; + const ids = [raw].flat().flatMap((value) => String(value).split(',')).map((id) => id.trim()).filter(Boolean); + if (!ids.length) throw new BadRequestError('`ids` must list at least one playlist id.'); + if (ids.length > MAX_IDS_PER_REQUEST) throw new BadRequestError(`Ask for at most ${MAX_IDS_PER_REQUEST} playlists at a time.`); + if (!ids.every((id) => ID_PATTERN.test(id))) throw new BadRequestError('`ids` contains an invalid playlist id.'); + return [...new Set(ids)]; +} + +/** Whether an If-None-Match header names this entity tag. */ +export function etagMatches(header, etag) { + if (!header) return false; + return header.split(',').some((tag) => { + const value = tag.trim().replace(/^W\//, ''); + return value === '*' || value === `"${etag}"`; + }); +} + +/** + * Sends 304 when the browser already has this version. Compared directly + * rather than via `req.fresh`, which (correctly, for HTTP caches) never says + * "fresh" when the request carries Cache-Control: no-cache — and browsers add + * that header to the app's deliberate `cache: 'no-store'` conditional requests. + */ +function sendVersioned(req, res, etag, body) { + res.set('ETag', `"${etag}"`); + if (etagMatches(req.get('if-none-match'), etag)) return res.status(304).end(); + return res.json(body); +} + +export function createApp({ config, catalogue, reporter, logger, assets }) { + const app = express(); + app.disable('x-powered-by'); + app.set('trust proxy', config.trustProxy); + app.set('view engine', 'ejs'); + app.set('views', viewsDir); + + // --- Request identity, logging, security headers ------------------------- + app.use((req, res, next) => { + const incoming = req.get('x-request-id'); + req.id = incoming && REQUEST_ID_PATTERN.test(incoming) ? incoming : randomUUID(); + res.set('X-Request-Id', req.id); + res.locals.nonce = randomBytes(16).toString('base64'); + next(); + }); + + app.use( + pinoHttp({ + logger, + genReqId: (req) => req.id, + quietReqLogger: true, + autoLogging: { ignore: (req) => req.url === '/healthz' || req.url.startsWith('/static/') || req.url.startsWith('/__mock/') }, + customLogLevel: (req, res, err) => (err || res.statusCode >= 500 ? 'error' : res.statusCode >= 400 ? 'warn' : 'info'), + serializers: { + req: (req) => ({ method: req.method, url: req.url }), + res: (res) => ({ statusCode: res.statusCode }), + }, + }), + ); + + app.use( + helmet({ + contentSecurityPolicy: { + useDefaults: false, + directives: { + defaultSrc: ["'self'"], + scriptSrc: ["'self'", (req, res) => `'nonce-${res.locals.nonce}'`], + styleSrc: ["'self'"], + imgSrc: ["'self'", 'data:', 'https://*.tidal.com'], + fontSrc: ["'self'"], + connectSrc: ["'self'"], + frameSrc: ['https://embed.tidal.com'], + objectSrc: ["'none'"], + baseUri: ["'none'"], + formAction: ["'self'"], + frameAncestors: ["'none'"], + reportUri: ['/api/reports'], + reportTo: ['csp'], + }, + }, + // Keep the default browser behaviour so TIDAL's embed sees which site it is on. + referrerPolicy: { policy: 'strict-origin-when-cross-origin' }, + strictTransportSecurity: config.isProduction ? undefined : false, + }), + ); + app.use((req, res, next) => { + // Absolute URL: browsers that reject the endpoint would also stop using report-uri. + res.set('Reporting-Endpoints', `csp="${req.protocol}://${req.get('host')}/api/reports"`); + res.set('Permissions-Policy', 'camera=(), microphone=(), geolocation=(), payment=(), usb=()'); + next(); + }); + + app.use(compression()); + + // --- Static files ---------------------------------------------------------- + const staticOptions = { index: false, redirect: false }; + const immutable = express.static(publicDir, { ...staticOptions, immutable: true, maxAge: '365d' }); + const revalidate = express.static(publicDir, { ...staticOptions, maxAge: 0 }); + app.use('/static/:version', (req, res, next) => + (req.params.version === assets.version && assets.version !== 'dev' ? immutable : revalidate)(req, res, next), + ); + // Stable URL for the social sharing image. + app.use('/media', express.static(`${publicDir}/media`, { ...staticOptions, maxAge: '1d' })); + app.get('/favicon.ico', (req, res) => res.redirect(301, '/media/avatar.jpg')); + app.get('/robots.txt', (req, res) => res.type('text/plain').set('Cache-Control', 'public, max-age=86400').send('User-agent: *\nAllow: /\n')); + if (config.tidal.mock) app.get('/__mock/art/:seed.svg', mockArtworkHandler); + + // --- Health ------------------------------------------------------------------ + app.get('/healthz', (req, res) => { + const catalogueStatus = catalogue.status(); + const status = !catalogueStatus.ready ? (catalogueStatus.refreshing ? 'starting' : 'unavailable') : catalogueStatus.lastError ? 'degraded' : 'ok'; + // Always 200 while the process can serve; the body says how healthy the data is. + res.set('Cache-Control', 'no-store').json({ + status, + version: assets.version, + uptimeSeconds: Math.round(process.uptime()), + errorReporting: reporter.sentryEnabled ? 'sentry' : 'logs', + catalogue: { ...catalogueStatus, lastError: catalogueStatus.lastError && { code: catalogueStatus.lastError.code, at: catalogueStatus.lastError.at } }, + }); + }); + + // --- API --------------------------------------------------------------------- + const api = express.Router(); + api.use((req, res, next) => { + res.set('Cache-Control', 'no-cache'); + next(); + }); + + // Ids and revisions of every playlist. Browsers compare it with their cache + // to fetch only what is new or changed; usually it is a bodiless 304. + api.get( + '/playlists/manifest', + asyncRoute(async (req, res) => { + const snapshot = await catalogue.get(); + sendVersioned(req, res, snapshot.etag, { etag: snapshot.etag, count: snapshot.records.length, items: snapshot.manifest }); + }), + ); + + // All playlists, or just `?ids=a,b,c`. + api.get( + '/playlists', + asyncRoute(async (req, res) => { + const ids = parseIds(req.query.ids); + const snapshot = await catalogue.get(); + if (!ids) return sendVersioned(req, res, snapshot.etag, { etag: snapshot.etag, playlists: snapshot.records }); + const playlists = ids.map((id) => snapshot.byId.get(id)).filter(Boolean); + const missing = ids.filter((id) => !snapshot.byId.has(id)); + res.json({ etag: snapshot.etag, playlists, missing }); + }), + ); + + const allowReport = createRateLimiter(); + api.post( + '/reports', + (req, res, next) => (allowReport(req.ip) ? next() : res.status(429).end()), + express.json({ type: ['application/json', 'application/csp-report', 'application/reports+json'], limit: '16kb' }), + (req, res) => { + for (const report of parseReports(req.body)) { + if (report.kind === 'csp') reporter.cspViolation(report, { requestId: req.id }); + else reporter.browserError(report, { requestId: req.id }); + } + res.status(204).end(); + }, + ); + + api.use((req, res, next) => next(new NotFoundError('No such API endpoint.'))); + app.use('/api', api); + + // --- Page ---------------------------------------------------------------------- + app.get('/', (req, res) => { + // On a plain visit the newest playlist is the first card: start its artwork + // download now rather than after the scripts run. + const plainVisit = !Object.keys(req.query).length; + const first = plainVisit ? catalogue.peek()?.records[0] : null; + res.set('Cache-Control', 'no-cache'); + res.render('index', { + nonce: res.locals.nonce, + asset: assets.url, + modules: assets.modules, + release: assets.version, + site: config.site, + preloadArt: first?.art ? { srcset: srcsetFor(first.art), sizes: CARD_IMAGE_SIZES } : null, + cacheEtagKey: CACHE_ETAG_KEY, + year: new Date().getFullYear(), + }); + }); + + // --- Errors -------------------------------------------------------------------- + app.use((req, res, next) => next(new NotFoundError())); + + app.use((err, req, res, next) => { + const status = Number.isInteger(err.status) && err.status >= 400 && err.status < 600 ? err.status : 500; + const exposed = err instanceof AppError ? err.expose : status < 500 && err.expose !== false; + const code = err.code && typeof err.code === 'string' ? err.code : status >= 500 ? 'INTERNAL' : 'BAD_REQUEST'; + + if (status >= 500 && code !== 'CATALOGUE_UNAVAILABLE') { + // CATALOGUE_UNAVAILABLE was already reported when the refresh failed. + reporter.exception(err, { msg: `Request failed: ${req.method} ${req.originalUrl}`, extra: { requestId: req.id } }); + } + if (res.headersSent) return next(err); + if (err.retryAfterSeconds) res.set('Retry-After', String(err.retryAfterSeconds)); + + const message = exposed ? err.message : status >= 500 ? 'Something went wrong on our side. Please try again.' : 'Bad request.'; + res.status(status).set('Cache-Control', 'no-store'); + if (req.originalUrl.startsWith('/api/') || !req.accepts('html')) { + return res.json({ error: { code, message, requestId: req.id } }); + } + res.render('error', { status, message, requestId: req.id, asset: assets.url }); + }); + + return app; +} diff --git a/src/http/assets.js b/src/http/assets.js new file mode 100644 index 00000000..ace8bee4 --- /dev/null +++ b/src/http/assets.js @@ -0,0 +1,39 @@ +import { createHash } from 'node:crypto'; +import { readdir, readFile } from 'node:fs/promises'; +import { join, relative, sep } from 'node:path'; + +async function listFiles(dir) { + const entries = await readdir(dir, { withFileTypes: true, recursive: true }); + return entries + .filter((entry) => entry.isFile() && !entry.name.startsWith('.')) + .map((entry) => join(entry.parentPath, entry.name)) + .sort(); +} + +/** + * Versioned URLs for everything in /public, without a build step. + * + * Files are served under /static//…, where the version is a hash of + * all their contents. Because ES module imports and CSS url()s are relative, + * they inherit the version automatically, so every asset can be cached + * forever and a deploy that changes anything changes every URL. + */ +export async function createAssets({ publicDir, versioned }) { + const files = await listFiles(publicDir); + const toPath = (file) => relative(publicDir, file).split(sep).join('/'); + + let version = 'dev'; + if (versioned) { + const hash = createHash('sha256'); + for (const file of files) hash.update(toPath(file)).update(await readFile(file)); + version = hash.digest('hex').slice(0, 10); + } + + const url = (path) => `/static/${version}/${path.replace(/^\//, '')}`; + return { + version, + url, + /** Every browser module, for so imports don't load in a waterfall. */ + modules: files.map(toPath).filter((path) => path.startsWith('js/') && path.endsWith('.js')).map(url), + }; +} diff --git a/src/http/reports.js b/src/http/reports.js new file mode 100644 index 00000000..bce081e3 --- /dev/null +++ b/src/http/reports.js @@ -0,0 +1,92 @@ +// Parsing for POST /api/reports. Everything here is untrusted visitor input: +// accept only known fields, cap every string, never echo anything back. + +const clip = (value, max) => (typeof value === 'string' ? value.slice(0, max) : undefined); +const clipNumber = (value) => (Number.isFinite(value) ? value : undefined); + +function clipContext(context) { + if (!context || typeof context !== 'object' || Array.isArray(context)) return undefined; + const out = {}; + for (const [key, value] of Object.entries(context).slice(0, 12)) { + if (['string', 'number', 'boolean'].includes(typeof value)) out[clip(key, 40)] = typeof value === 'string' ? clip(value, 300) : value; + } + return out; +} + +const clientError = (body) => ({ + kind: 'client-error', + name: clip(body.name, 100) || 'Error', + message: clip(body.message, 500) || '(no message)', + stack: clip(body.stack, 4000), + url: clip(body.url, 500), + userAgent: clip(body.userAgent, 300), + release: clip(body.release, 40), + context: clipContext(body.context), +}); + +const cspViolation = ({ documentURL, blockedURL, directive, sourceFile, lineNumber, disposition }) => ({ + kind: 'csp', + documentURL: clip(documentURL, 500), + blockedURL: clip(blockedURL, 500) || '(unknown)', + directive: clip(directive, 100) || '(unknown)', + sourceFile: clip(sourceFile, 500), + lineNumber: clipNumber(lineNumber), + disposition: clip(disposition, 20), +}); + +/** + * Normalises any of the three report formats browsers send: + * our own client-error beacon, legacy `report-uri` CSP reports, and the + * Reporting API (`report-to`) batch format. Returns at most 10 reports. + */ +export function parseReports(body) { + if (Array.isArray(body)) { + return body + .slice(0, 10) + .filter((report) => report?.type === 'csp-violation' && report.body) + .map(({ body: b }) => + cspViolation({ + documentURL: b.documentURL, + blockedURL: b.blockedURL, + directive: b.effectiveDirective, + sourceFile: b.sourceFile, + lineNumber: b.lineNumber, + disposition: b.disposition, + }), + ); + } + if (body?.['csp-report']) { + const r = body['csp-report']; + return [ + cspViolation({ + documentURL: r['document-uri'], + blockedURL: r['blocked-uri'], + directive: r['effective-directive'] || r['violated-directive'], + sourceFile: r['source-file'], + lineNumber: r['line-number'], + disposition: r.disposition, + }), + ]; + } + if (body?.type === 'client-error') return [clientError(body)]; + return []; +} + +/** Fixed-window rate limiter: `perKey` events per key and `total` overall, per window. */ +export function createRateLimiter({ perKey = 20, total = 600, windowMs = 60_000, now = Date.now } = {}) { + let windowStart = now(); + let overall = 0; + const counts = new Map(); + + return function allow(key) { + if (now() - windowStart >= windowMs) { + windowStart = now(); + overall = 0; + counts.clear(); + } + const count = (counts.get(key) ?? 0) + 1; + counts.set(key, count); + overall++; + return count <= perKey && overall <= total; + }; +} diff --git a/src/logger.js b/src/logger.js new file mode 100644 index 00000000..3b11ebeb --- /dev/null +++ b/src/logger.js @@ -0,0 +1,37 @@ +import { createRequire } from 'node:module'; +import pino from 'pino'; +import { serialiseError } from './errors.js'; + +const hasPrettyPrinter = () => { + try { + createRequire(import.meta.url).resolve('pino-pretty'); + return true; + } catch { + return false; + } +}; + +/** + * Structured JSON logs in production (searchable in the host's log viewer), + * readable coloured logs locally. Secrets are redacted wherever they appear. + */ +export function createLogger({ level = 'info', pretty = false } = {}) { + return pino({ + level, + base: undefined, + serializers: { err: serialiseError, error: serialiseError }, + redact: { + paths: [ + 'req.headers.authorization', + 'req.headers.cookie', + '*.access_token', + '*.refresh_token', + '*.client_secret', + ], + censor: '[redacted]', + }, + ...(pretty && hasPrettyPrinter() + ? { transport: { target: 'pino-pretty', options: { translateTime: 'HH:MM:ss', ignore: 'pid,hostname' } } } + : {}), + }); +} diff --git a/src/reporting.js b/src/reporting.js new file mode 100644 index 00000000..1f882335 --- /dev/null +++ b/src/reporting.js @@ -0,0 +1,79 @@ +import { serialiseError } from './errors.js'; + +// Sentry's own process handlers would duplicate ours (see server.js). +const SKIPPED_SENTRY_INTEGRATIONS = new Set(['OnUncaughtException', 'OnUnhandledRejection']); + +/** + * One place for every error, from the server or the browser. Always writes a + * structured log line; also forwards to Sentry when SENTRY_DSN is set. Sentry + * is loaded lazily, so it costs nothing when unused. + */ +export async function createReporter({ logger, dsn, release, environment }) { + let sentry = null; + + if (dsn) { + try { + sentry = await import('@sentry/node'); + sentry.init({ + dsn, + release, + environment, + sendDefaultPii: false, + integrations: (defaults) => defaults.filter((i) => !SKIPPED_SENTRY_INTEGRATIONS.has(i.name)), + }); + logger.info('Error reporting to Sentry is enabled'); + } catch (err) { + sentry = null; + logger.error({ err }, 'Could not start Sentry; errors will only be logged'); + } + } + + return { + get sentryEnabled() { + return Boolean(sentry); + }, + + /** Server-side exception. `level` is 'error' (default), 'warn' or 'fatal'. */ + exception(err, { level = 'error', msg, tags, extra } = {}) { + logger[level]({ err, tags, ...extra }, msg ?? err?.message ?? 'Unknown error'); + sentry?.captureException(err, { level: level === 'warn' ? 'warning' : level, tags, extra }); + }, + + /** Error reported by a visitor's browser via POST /api/reports. */ + browserError(report, { requestId }) { + logger.warn({ source: 'browser', report, requestId }, `Browser error: ${report.name}: ${report.message}`); + sentry?.captureEvent({ + level: 'error', + platform: 'javascript', + release: report.release || release, + exception: { values: [{ type: report.name, value: report.message }] }, + fingerprint: ['browser', report.name, report.message], + tags: { source: 'browser', ...(report.context?.where ? { where: String(report.context.where) } : {}) }, + request: { url: report.url, headers: { 'User-Agent': report.userAgent } }, + extra: { stack: report.stack, context: report.context, requestId }, + }); + }, + + /** Content-Security-Policy violation reported by a browser. */ + cspViolation(violation, { requestId }) { + logger.warn({ source: 'csp', violation, requestId }, `CSP blocked ${violation.blockedURL} (${violation.directive})`); + sentry?.captureEvent({ + level: 'warning', + message: `CSP violation: ${violation.directive} blocked ${violation.blockedURL}`, + fingerprint: ['csp', violation.directive, violation.blockedURL], + tags: { source: 'csp' }, + extra: { violation, requestId }, + }); + }, + + async flush(timeoutMs = 2000) { + if (!sentry) return true; + try { + return await sentry.flush(timeoutMs); + } catch (err) { + logger.warn({ err: serialiseError(err) }, 'Sentry flush failed'); + return false; + } + }, + }; +} diff --git a/src/server.js b/src/server.js new file mode 100644 index 00000000..f12d1e7a --- /dev/null +++ b/src/server.js @@ -0,0 +1,92 @@ +import { fileURLToPath } from 'node:url'; +import { createCatalogue } from './catalogue.js'; +import { loadEnvFile, readConfig } from './config.js'; +import { createAssets } from './http/assets.js'; +import { createApp } from './http/app.js'; +import { createLogger } from './logger.js'; +import { createReporter } from './reporting.js'; +import { createTokenProvider } from './tidal/auth.js'; +import { createTidalClient } from './tidal/client.js'; +import { createMockFetch } from './tidal/mock.js'; +import { fetchPublicPlaylists } from './tidal/playlists.js'; + +const SHUTDOWN_TIMEOUT_MS = 10_000; + +export async function main() { + loadEnvFile(); + + let config; + try { + config = readConfig(); + } catch (error) { + console.error(`\n${error.message}\n`); + process.exit(1); + } + + const logger = createLogger({ level: config.logLevel, pretty: !config.isProduction }); + const reporter = await createReporter({ + logger, + dsn: config.sentry.dsn, + release: config.sentry.release, + environment: config.env, + }); + + // Last line of defence: record the crash, then exit and let the host restart us + // (continuing after an unknown failure risks serving from a corrupt state). + let crashing = false; + const crash = async (error, origin) => { + if (crashing) return; + crashing = true; + reporter.exception(error, { level: 'fatal', msg: `Fatal ${origin}; exiting`, tags: { origin } }); + await reporter.flush(2000); + process.exit(1); + }; + process.on('uncaughtException', (error) => crash(error, 'uncaughtException')); + process.on('unhandledRejection', (reason) => crash(reason instanceof Error ? reason : new Error(String(reason)), 'unhandledRejection')); + + const { tidal } = config; + const fetchImpl = tidal.mock ? createMockFetch() : globalThis.fetch; + if (tidal.mock) logger.warn('TIDAL_MOCK is on: serving generated demo playlists, not your TIDAL account'); + + const tokens = createTokenProvider({ ...tidal, fetch: fetchImpl, logger }); + const client = createTidalClient({ baseUrl: tidal.apiBaseUrl, tokens, fetch: fetchImpl, logger }); + const ownerId = tidal.userId || 'me'; + logger.info({ authMode: tokens.mode, ownerId }, 'TIDAL configured'); + + const catalogue = createCatalogue({ + load: () => fetchPublicPlaylists({ client, ownerId, countryCode: tidal.countryCode, authMode: tokens.mode, logger }), + ttlMs: config.catalogue.ttlMs, + snapshotPath: tidal.mock ? null : config.catalogue.snapshotPath, + logger, + reporter, + }); + + const assets = await createAssets({ + publicDir: fileURLToPath(new URL('../public', import.meta.url)), + versioned: config.isProduction, + }); + + const app = createApp({ config, catalogue, reporter, logger, assets }); + const server = app.listen(config.port, () => { + logger.info({ port: config.port, assetVersion: assets.version, env: config.env }, `Listening on http://localhost:${config.port}`); + }); + server.on('error', (error) => crash(error, 'server')); + // Outlive load-balancer idle connections so they are never cut mid-request. + server.keepAliveTimeout = 65_000; + server.headersTimeout = 66_000; + + await catalogue.start(); + + const shutdown = (signal) => { + logger.info({ signal }, 'Shutting down'); + const force = setTimeout(() => process.exit(1), SHUTDOWN_TIMEOUT_MS); + force.unref(); + server.close(async () => { + await reporter.flush(2000); + process.exit(0); + }); + server.closeIdleConnections(); + }; + process.once('SIGTERM', shutdown); + process.once('SIGINT', shutdown); +} diff --git a/src/tidal/auth.js b/src/tidal/auth.js new file mode 100644 index 00000000..3fbb472a --- /dev/null +++ b/src/tidal/auth.js @@ -0,0 +1,91 @@ +import { TidalAuthError, TidalError } from '../errors.js'; +import { withRetry } from './retry.js'; + +const EXPIRY_MARGIN_MS = 60_000; + +/** + * Supplies TIDAL access tokens, cached until shortly before they expire. + * Concurrent callers share one in-flight token request. + * + * - 'client' mode: client-credentials grant (no user involved). + * - 'user' mode: refresh-token grant, for when TIDAL requires a user's + * authorisation to read playlists. See scripts/tidal-login.js. + */ +export function createTokenProvider({ + clientId, + clientSecret, + refreshToken, + tokenUrl, + fetch = globalThis.fetch, + logger, + now = Date.now, + retryOptions, +}) { + const mode = refreshToken ? 'user' : 'client'; + let currentRefreshToken = refreshToken; + let cached = null; + let pending = null; + + async function requestToken() { + const headers = { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' }; + let body; + if (mode === 'client') { + headers.Authorization = `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`; + body = new URLSearchParams({ grant_type: 'client_credentials' }); + } else { + body = new URLSearchParams({ + grant_type: 'refresh_token', + refresh_token: currentRefreshToken, + client_id: clientId, + client_secret: clientSecret, + }); + } + + let res; + try { + res = await fetch(tokenUrl, { method: 'POST', headers, body, signal: AbortSignal.timeout(10_000) }); + } catch (cause) { + throw new TidalError(`Could not reach the TIDAL token endpoint: ${cause.message}`, { url: tokenUrl, retryable: true, cause }); + } + + const payload = await res.json().catch(() => ({})); + if (!res.ok) { + const reason = payload.error_description || payload.error || res.statusText || `HTTP ${res.status}`; + const details = { status: res.status, tidalCode: payload.error, subStatus: payload.sub_status, url: tokenUrl }; + if (res.status === 429 || res.status >= 500) { + throw new TidalError(`TIDAL token endpoint failed (${res.status}): ${reason}`, { ...details, retryable: true }); + } + const fix = mode === 'client' + ? 'Check TIDAL_CLIENT_ID and TIDAL_CLIENT_SECRET match your app at developer.tidal.com.' + : 'TIDAL_REFRESH_TOKEN was rejected — run `npm run tidal:login` to get a new one.'; + throw new TidalAuthError(`TIDAL refused to issue an access token (${res.status}: ${reason}). ${fix}`, details); + } + if (!payload.access_token) { + throw new TidalAuthError('TIDAL token response did not include an access token.', { url: tokenUrl }); + } + + if (mode === 'user' && payload.refresh_token && payload.refresh_token !== currentRefreshToken) { + currentRefreshToken = payload.refresh_token; + logger?.warn('TIDAL issued a new refresh token. If playlists stop loading after a restart, run `npm run tidal:login` again.'); + } + + const expiresInSeconds = Number(payload.expires_in) > 0 ? Number(payload.expires_in) : 3600; + cached = { accessToken: payload.access_token, expiresAt: now() + expiresInSeconds * 1000 }; + logger?.debug({ mode, expiresInSeconds }, 'Obtained TIDAL access token'); + return cached.accessToken; + } + + return { + mode, + async getToken() { + if (cached && cached.expiresAt - EXPIRY_MARGIN_MS > now()) return cached.accessToken; + pending ??= withRetry(requestToken, retryOptions).finally(() => { + pending = null; + }); + return pending; + }, + invalidate() { + cached = null; + }, + }; +} diff --git a/src/tidal/client.js b/src/tidal/client.js new file mode 100644 index 00000000..8d2a59f3 --- /dev/null +++ b/src/tidal/client.js @@ -0,0 +1,116 @@ +import { TidalAuthError, TidalError } from '../errors.js'; +import { parseRetryAfter, withRetry } from './retry.js'; + +const JSON_API = 'application/vnd.api+json'; + +export function buildUrl(baseUrl, path, query = {}) { + const url = new URL(baseUrl.replace(/\/$/, '') + path); + for (const [key, value] of Object.entries(query)) { + if (value === undefined || value === null || value === '') continue; + url.searchParams.set(key, Array.isArray(value) ? value.join(',') : String(value)); + } + return url.href; +} + +/** Cursor for the next page, from `links.meta.nextCursor` or the `links.next` URL. */ +export function nextCursor(doc) { + const cursor = doc?.links?.meta?.nextCursor; + if (cursor) return cursor; + if (!doc?.links?.next) return undefined; + return new URL(doc.links.next, 'https://placeholder.invalid').searchParams.get('page[cursor]') || undefined; +} + +/** + * Minimal client for TIDAL's JSON:API (https://openapi.tidal.com/v2). + * Retries network errors, timeouts, 429s and 5xx responses; refreshes the + * token once on a 401; raises typed errors with TIDAL's own error details. + */ +export function createTidalClient({ baseUrl, tokens, fetch = globalThis.fetch, logger, timeoutMs = 10_000, retryOptions }) { + async function attempt(url) { + const token = await tokens.getToken(); + let res; + try { + res = await fetch(url, { + headers: { Authorization: `Bearer ${token}`, Accept: JSON_API }, + signal: AbortSignal.timeout(timeoutMs), + }); + } catch (cause) { + const what = cause?.name === 'TimeoutError' ? `timed out after ${timeoutMs}ms` : cause?.message; + throw new TidalError(`TIDAL request ${what}`, { url, retryable: true, cause }); + } + + if (res.ok) { + try { + return await res.json(); + } catch (cause) { + throw new TidalError('TIDAL returned a response that is not valid JSON', { status: res.status, url, retryable: true, cause }); + } + } + + const body = await res.json().catch(() => null); + const first = body?.errors?.[0] ?? {}; + const details = { + status: res.status, + tidalCode: first.code, + // TIDAL sits behind CloudFront; its id identifies the request if you ever need TIDAL support. + requestId: res.headers.get('x-amz-cf-id') ?? res.headers.get('x-request-id') ?? first.id, + url, + }; + const reason = first.detail || res.statusText || 'no details'; + + if (res.status === 401 || res.status === 403) { + if (res.status === 401) tokens.invalidate(); + throw new TidalAuthError(`TIDAL denied access (${res.status}): ${reason}`, details); + } + if (res.status === 429 || res.status >= 500) { + const error = new TidalError(`TIDAL is ${res.status === 429 ? 'rate limiting us' : 'having problems'} (${res.status}): ${reason}`, { + ...details, + retryable: true, + }); + error.retryAfterMs = parseRetryAfter(res.headers.get('retry-after')); + throw error; + } + throw new TidalError(`TIDAL request failed (${res.status}): ${reason}`, details); + } + + async function get(path, query) { + const url = buildUrl(baseUrl, path, query); + let refreshedToken = false; + return withRetry( + async () => { + try { + return await attempt(url); + } catch (error) { + // An expired or revoked token: fetch a fresh one and try once more. + if (error instanceof TidalAuthError && error.upstreamStatus === 401 && !refreshedToken) { + refreshedToken = true; + return attempt(url); + } + throw error; + } + }, + { + ...retryOptions, + onRetry: ({ error, attempt: n, delay }) => + logger?.warn({ err: error, attempt: n, delayMs: Math.round(delay) }, 'Retrying TIDAL request'), + }, + ); + } + + /** Yields every page of a paginated collection. */ + async function* paginate(path, query, { maxPages = 50 } = {}) { + const seen = new Set(); + let cursor; + for (let page = 1; page <= maxPages; page++) { + const doc = await get(path, cursor ? { ...query, 'page[cursor]': cursor } : query); + yield doc; + cursor = nextCursor(doc); + if (!cursor) return; + if (seen.has(cursor)) throw new TidalError('TIDAL returned the same page cursor twice', { url: buildUrl(baseUrl, path, query) }); + seen.add(cursor); + } + logger?.warn({ path, maxPages }, 'Stopped paging TIDAL results at the page limit; some playlists may be missing'); + } + + return { get, paginate }; +} diff --git a/src/tidal/mock.js b/src/tidal/mock.js new file mode 100644 index 00000000..1b7c3b2b --- /dev/null +++ b/src/tidal/mock.js @@ -0,0 +1,95 @@ +// Demo data for local development and tests (TIDAL_MOCK=1). Serves responses +// shaped like TIDAL's JSON:API, so the real client and normalisation run. + +const GENRES = ['rock', 'electronic', 'jazz', 'ambient', 'hip hop', 'soul', 'folk', 'techno', 'post-punk', 'disco']; +const ARTISTS = ['Björk', 'Radiohead', 'Talking Heads', 'Nina Simone', 'Aphex Twin', 'Kate Bush', 'Can', 'Sade', 'Dvořák', 'AC/DC']; +const WORDS = ['Night', 'Drive', 'Static', 'Bloom', 'Low Light', 'Tidal', 'Morning', 'Glass', 'Fever', 'Slow Motion', 'Deep Cuts', 'Echoes', 'Sundown', 'Neon', 'Weather']; +const PALETTE = ['#e4572e', '#29335c', '#f3a712', '#a8c686', '#669bbc', '#8e3b46', '#4c956c', '#c0a9b0', '#2d6a4f', '#ff006e', '#3a86ff', '#8338ec']; +const DAY = 86_400_000; + +const pick = (list, i) => list[i % list.length]; +const uuid = (i) => `00000000-0000-4000-8000-${String(i).padStart(12, '0')}`; + +function buildPlaylists(count, now) { + return Array.from({ length: count }, (_, i) => { + const single = i % 3 === 0; + const tag = single ? pick(ARTISTS, i) : pick(GENRES, i * 7); + const name = `${pick(WORDS, i * 5)} ${pick(WORDS, i * 11 + 3)} (${tag})`; + const tracks = 12 + ((i * 37) % 80); + return { + id: uuid(i + 1), + type: 'playlists', + attributes: { + name: i === 4 ? 'Untitled mix without a tag' : name, + description: single + ? `A deep dive through the back catalogue of ${tag}, from the hits to the B-sides.` + : `Weekly selection of ${tag} — new finds & old favourites, sequenced for start-to-finish listening.`, + accessType: i % 25 === 24 ? 'PRIVATE' : 'PUBLIC', + bounded: true, + createdAt: new Date(now - (i * 9 + 2) * DAY).toISOString(), + lastModifiedAt: new Date(now - i * 4 * DAY).toISOString(), + duration: `PT${Math.floor((tracks * 4) / 60)}H${(tracks * 4) % 60}M${i % 60}S`, + numberOfItems: tracks, + numberOfTrackItems: tracks, + numberOfFollowers: (i * 13) % 140, + playlistType: 'USER', + externalLinks: [{ href: `https://tidal.com/browse/playlist/${uuid(i + 1)}`, meta: { type: 'TIDAL_SHARING' } }], + }, + relationships: { coverArt: { data: i === 9 ? [] : [{ id: `art-${i + 1}`, type: 'artworks' }], links: { self: '' } } }, + }; + }); +} + +const buildArtwork = (i) => ({ + id: `art-${i}`, + type: 'artworks', + attributes: { + mediaType: 'IMAGE', + files: [160, 320, 640, 1080].map((width) => ({ + href: `/__mock/art/${i}.svg?w=${width}`, + meta: { width, height: width }, + })), + visualMetadata: { selectedPaletteColor: pick(PALETTE, i), status: 'OK' }, + }, +}); + +const json = (body, status = 200, headers = {}) => + new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/vnd.api+json', ...headers } }); + +export function createMockFetch({ count = 150, pageSize = 20, latencyMs = 120, now = Date.now() } = {}) { + const playlists = buildPlaylists(count, now); + const delay = () => new Promise((resolve) => setTimeout(resolve, latencyMs)); + + return async function mockFetch(input) { + await delay(); + const url = new URL(typeof input === 'string' ? input : input.url); + + if (url.pathname.endsWith('/oauth2/token')) return json({ access_token: 'mock-token', token_type: 'Bearer', expires_in: 86_400 }); + + if (url.pathname.endsWith('/playlists')) { + const start = Number(url.searchParams.get('page[cursor]') || 0); + const page = playlists.slice(start, start + pageSize); + const next = start + pageSize < playlists.length ? String(start + pageSize) : undefined; + const included = page.flatMap((p) => p.relationships.coverArt.data).map((ref) => buildArtwork(Number(ref.id.slice(4)))); + return json({ data: page, included, links: { self: url.pathname, ...(next && { next: `/playlists?page[cursor]=${next}`, meta: { nextCursor: next } }) } }); + } + + if (url.pathname.endsWith('/artworks')) { + const ids = (url.searchParams.get('filter[id]') || '').split(',').filter(Boolean); + return json({ data: ids.map((id) => buildArtwork(Number(id.slice(4)))), links: { self: url.pathname } }); + } + + return json({ errors: [{ status: '404', detail: 'Not found in mock' }] }, 404); + }; +} + +/** Express handler drawing a simple generative cover for mock artwork. */ +export function mockArtworkHandler(req, res) { + const i = Number.parseInt(req.params.seed, 10) || 0; + const a = pick(PALETTE, i); + const b = pick(PALETTE, i * 5 + 3); + const rings = Array.from({ length: 6 }, (_, n) => ``).join(''); + res.type('image/svg+xml').set('Cache-Control', 'public, max-age=86400').send( + `${rings}No. ${i}`, + ); +} diff --git a/src/tidal/normalise.js b/src/tidal/normalise.js new file mode 100644 index 00000000..4ea83a65 --- /dev/null +++ b/src/tidal/normalise.js @@ -0,0 +1,116 @@ +import { createHash } from 'node:crypto'; + +// Trailing "(…)" holds the artist (single-artist playlists) or genre (mixes). +const TITLE_WITH_TAG = /^(.*\S)\s*\(\s*([^()]*?)\s*\)\s*$/; +const ISO_DURATION = /^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/; +const HEX_COLOUR = /^#?([0-9a-f]{6}|[0-9a-f]{3})$/i; +const ENTITIES = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", '#39': "'", nbsp: ' ' }; + +const MIN_ART_WIDTH = 100; +const MAX_ART_WIDTH = 1280; + +export function parseTitle(name) { + const clean = String(name ?? '').replace(/\s+/g, ' ').trim(); + const match = clean.match(TITLE_WITH_TAG); + if (!match || !match[2]) return { title: clean, tag: null }; + return { title: match[1], tag: match[2] }; +} + +/** "PT1H2M3S" → 3723 (seconds), or null when missing/invalid. */ +export function parseDuration(iso) { + const match = typeof iso === 'string' ? iso.match(ISO_DURATION) : null; + if (!match) return null; + const [, d = 0, h = 0, m = 0, s = 0] = match; + return Math.round(Number(d) * 86_400 + Number(h) * 3600 + Number(m) * 60 + Number(s)); +} + +export function cleanText(value) { + if (typeof value !== 'string') return ''; + return value + .replace(/&(amp|lt|gt|quot|apos|#39|nbsp);/g, (_, entity) => ENTITIES[entity]) + .replace(/[ \t]+/g, ' ') + .replace(/\n{3,}/g, '\n\n') + .trim(); +} + +const toIsoDate = (value) => { + const time = Date.parse(value); + return Number.isFinite(time) ? new Date(time).toISOString() : null; +}; + +const isHttpsOn = (href, domain) => { + try { + const url = new URL(href); + return url.protocol === 'https:' && (url.hostname === domain || url.hostname.endsWith(`.${domain}`)); + } catch { + return false; + } +}; + +// HTTPS only; root-relative paths are same-origin (used by mock mode). +const isAllowedImageUrl = (href) => typeof href === 'string' && (href.startsWith('https://') || /^\/(?!\/)/.test(href)); + +/** Artwork resource → { color, sources: [[url, width], …] } sorted by width, or null. */ +export function pickArtwork(artwork) { + const attributes = artwork?.attributes; + if (!attributes || (attributes.mediaType && attributes.mediaType !== 'IMAGE')) return null; + + const byWidth = new Map(); + for (const file of attributes.files ?? []) { + const width = Number(file?.meta?.width); + if (!isAllowedImageUrl(file?.href) || !(width > 0)) continue; + if (!byWidth.has(width)) byWidth.set(width, file.href); + } + const all = [...byWidth.entries()].sort((a, b) => a[0] - b[0]); + if (!all.length) return null; + + const inRange = all.filter(([width]) => width >= MIN_ART_WIDTH && width <= MAX_ART_WIDTH); + const sources = (inRange.length ? inRange : [all[0]]).map(([width, url]) => [url, width]); + + const colour = attributes.visualMetadata?.selectedPaletteColor; + const match = typeof colour === 'string' ? colour.trim().match(HEX_COLOUR) : null; + return { color: match ? `#${match[1].toLowerCase()}` : null, sources }; +} + +/** Short, stable hash of a record's content. Changes whenever anything visible changes. */ +export function revision(record) { + return createHash('sha256').update(JSON.stringify(record)).digest('base64url').slice(0, 12); +} + +/** + * TIDAL playlist resource → the compact record sent to browsers. + * Returns null for anything that is not public, so private and unlisted + * playlists can never leak, whichever credentials fetched them. + */ +export function normalisePlaylist(resource, artworksById = new Map()) { + const attributes = resource?.attributes; + if (typeof resource?.id !== 'string' || !attributes) return null; + if (attributes.accessType !== 'PUBLIC') return null; + + const { title, tag } = parseTitle(attributes.name); + if (!title) return null; + + const share = attributes.externalLinks?.find((link) => link?.meta?.type === 'TIDAL_SHARING')?.href; + const coverArtId = resource.relationships?.coverArt?.data?.[0]?.id; + const count = (value) => (Number.isInteger(value) && value >= 0 ? value : null); + + const record = { + id: resource.id, + title, + tag, + description: cleanText(attributes.description), + tracks: count(attributes.numberOfTrackItems) ?? count(attributes.numberOfItems), + duration: parseDuration(attributes.duration), + followers: count(attributes.numberOfFollowers), + createdAt: toIsoDate(attributes.createdAt), + updatedAt: toIsoDate(attributes.lastModifiedAt), + url: isHttpsOn(share, 'tidal.com') ? share : `https://tidal.com/playlist/${encodeURIComponent(resource.id)}`, + art: pickArtwork(artworksById.get(coverArtId)), + }; + return { ...record, rev: revision(record) }; +} + +/** Newest first; undated playlists last; ties broken by title. */ +export function compareNewest(a, b) { + return (b.createdAt ?? '').localeCompare(a.createdAt ?? '') || a.title.localeCompare(b.title); +} diff --git a/src/tidal/playlists.js b/src/tidal/playlists.js new file mode 100644 index 00000000..02cd4bf6 --- /dev/null +++ b/src/tidal/playlists.js @@ -0,0 +1,61 @@ +import { TidalAuthError, TidalError } from '../errors.js'; +import { compareNewest, normalisePlaylist } from './normalise.js'; + +const ARTWORK_BATCH = 20; + +const chunk = (items, size) => Array.from({ length: Math.ceil(items.length / size) }, (_, i) => items.slice(i * size, (i + 1) * size)); + +/** + * Fetches every public playlist owned by `ownerId`, with cover art, in as few + * requests as TIDAL allows (one per page of results, rather than one per playlist). + */ +export async function fetchPublicPlaylists({ client, ownerId, countryCode, authMode, logger }) { + const resources = new Map(); + const artworks = new Map(); + + try { + for await (const doc of client.paginate('/playlists', { 'filter[owners.id]': ownerId, include: 'coverArt', countryCode })) { + if (!Array.isArray(doc?.data)) { + throw new TidalError('Unexpected response from TIDAL: /playlists returned no data array'); + } + for (const resource of doc.data) if (resource?.type === 'playlists') resources.set(resource.id, resource); + for (const item of doc.included ?? []) if (item?.type === 'artworks') artworks.set(item.id, item); + } + } catch (error) { + if (error instanceof TidalAuthError && authMode === 'client') { + error.message += + ' — TIDAL may only allow reading playlists on behalf of a signed-in user. Run `npm run tidal:login` once and set TIDAL_REFRESH_TOKEN.'; + } + throw error; + } + + // Artwork TIDAL referenced but did not include: fetch it in batches. Not fatal. + const missing = [...resources.values()] + .map((resource) => resource.relationships?.coverArt?.data?.[0]?.id) + .filter((id) => id && !artworks.has(id)); + for (const ids of chunk([...new Set(missing)], ARTWORK_BATCH)) { + try { + const doc = await client.get('/artworks', { 'filter[id]': ids, countryCode }); + for (const item of doc?.data ?? []) artworks.set(item.id, item); + } catch (err) { + logger?.warn({ err, count: ids.length }, 'Could not fetch some playlist artwork; showing placeholders'); + } + } + + const records = []; + let hidden = 0; + for (const resource of resources.values()) { + const record = normalisePlaylist(resource, artworks); + if (record) records.push(record); + else hidden++; + } + + if (!records.length && hidden) { + logger?.warn({ hidden }, 'TIDAL returned playlists but none are marked public (accessType PUBLIC); none will be shown'); + } + const withoutArt = records.filter((record) => !record.art).length; + if (withoutArt) logger?.warn({ withoutArt }, 'Some playlists have no usable artwork'); + logger?.info({ public: records.length, hidden }, 'Fetched playlists from TIDAL'); + + return records.sort(compareNewest); +} diff --git a/src/tidal/retry.js b/src/tidal/retry.js new file mode 100644 index 00000000..2d61c9df --- /dev/null +++ b/src/tidal/retry.js @@ -0,0 +1,31 @@ +export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + +const MAX_RETRY_AFTER_MS = 30_000; + +/** Parses a Retry-After header (seconds or HTTP date) into milliseconds. */ +export function parseRetryAfter(value, now = Date.now()) { + if (!value) return undefined; + const seconds = Number(value); + const ms = Number.isFinite(seconds) ? seconds * 1000 : Date.parse(value) - now; + return Number.isFinite(ms) ? Math.max(0, ms) : undefined; +} + +/** + * Runs `fn`, retrying failures marked `retryable` with exponential backoff and + * jitter. Honours a server-provided `retryAfterMs`, but gives up rather than + * stall a request when the server asks for a very long wait. + */ +export async function withRetry(fn, { retries = 3, baseDelayMs = 500, maxDelayMs = 8000, wait = sleep, random = Math.random, onRetry } = {}) { + for (let attempt = 0; ; attempt++) { + try { + return await fn(attempt); + } catch (error) { + if (attempt >= retries || error?.retryable !== true) throw error; + if (error.retryAfterMs > MAX_RETRY_AFTER_MS) throw error; + const backoff = Math.min(maxDelayMs, baseDelayMs * 2 ** attempt * (0.8 + random() * 0.2)); + const delay = error.retryAfterMs ?? backoff; + onRetry?.({ error, attempt: attempt + 1, delay }); + await wait(delay); + } + } +} diff --git a/views/error.ejs b/views/error.ejs new file mode 100644 index 00000000..9e0c9ea1 --- /dev/null +++ b/views/error.ejs @@ -0,0 +1,17 @@ + + + + + + <%= status === 404 ? 'Page not found' : 'Something went wrong' %> — SoundSelections + + + +
+

<%= status === 404 ? 'Page not found' : 'Something went wrong' %>

+

<%= message %>

+

Browse the playlists

+

Reference: <%= requestId %>

+
+ + diff --git a/views/index.ejs b/views/index.ejs index 005fe4b0..6404e2b4 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -1,128 +1,160 @@ - - - - + + - - - - Sound​Selections — by Beere - - - - - - + + + SoundSelections — by Beere + + + + + - - - - - - - - - - - + + + + + + + + + + <% if (preloadArt) { %> + + <% } %> + <% modules.forEach((href) => { %> + + <% }) %> + + + - - - - -
- -
- -
-

Loading... Sometimes this can take a while - still learning to code!

-
+
+
+

Loading playlists…

+ +
+

-
- -
+ + -
- -
-
+ - +
    + <% for (let i = 0; i < 12; i++) { %><% } %> +
-
-

Weekly curated playlists by Beere - since 2019 ©

-
+ +
+
+ -
-