Compare commits
3 Commits
ab87e65e18
...
deno-rewri
| Author | SHA1 | Date | |
|---|---|---|---|
|
445f522fa8
|
|||
|
bec0a3b72f
|
|||
|
|
d17c78fa68 |
@@ -11,4 +11,11 @@ data/*
|
|||||||
*.wav
|
*.wav
|
||||||
*.m4a
|
*.m4a
|
||||||
*.ogg
|
*.ogg
|
||||||
*.flac
|
*.flac
|
||||||
|
|
||||||
|
**/data/*.mp3
|
||||||
|
**/data/*.wav
|
||||||
|
**/data/*.m4a
|
||||||
|
**/data/*.opus
|
||||||
|
**/data/*.ogg
|
||||||
|
**/data/*.flac
|
||||||
@@ -165,6 +165,7 @@ jobs:
|
|||||||
echo "Building $IMAGE_FULL with tags: $TAG_ARGS"
|
echo "Building $IMAGE_FULL with tags: $TAG_ARGS"
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform linux/amd64 \
|
--platform linux/amd64 \
|
||||||
|
--target production \
|
||||||
-f "$DOCKERFILE" \
|
-f "$DOCKERFILE" \
|
||||||
$TAG_ARGS \
|
$TAG_ARGS \
|
||||||
--cache-from type=registry,ref="$IMAGE_FULL:buildcache" \
|
--cache-from type=registry,ref="$IMAGE_FULL:buildcache" \
|
||||||
|
|||||||
57
Dockerfile
57
Dockerfile
@@ -1,23 +1,52 @@
|
|||||||
# Lightweight production image for the Hitstar Node app
|
# Multi-stage Dockerfile for Hitstar Deno Server
|
||||||
FROM node:22-alpine
|
# Supports both development and production environments
|
||||||
|
|
||||||
|
# Base stage with common dependencies
|
||||||
|
FROM denoland/deno:latest AS base
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies
|
# Copy all source files first for dependency resolution
|
||||||
COPY package*.json ./
|
COPY src/server-deno/ .
|
||||||
# Use npm ci when a lockfile is present, otherwise fallback to npm install without throwing an error
|
|
||||||
RUN if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then \
|
|
||||||
npm ci --omit=dev; \
|
|
||||||
else \
|
|
||||||
npm install --omit=dev; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy app source (media lives outside via volume)
|
# Cache all dependencies based on deno.json imports
|
||||||
COPY . .
|
RUN deno cache main.ts
|
||||||
|
|
||||||
ENV NODE_ENV=production \
|
# Development stage
|
||||||
|
FROM base AS development
|
||||||
|
|
||||||
|
ENV DENO_ENV=development \
|
||||||
PORT=5173
|
PORT=5173
|
||||||
|
|
||||||
EXPOSE 5173
|
EXPOSE 5173
|
||||||
|
|
||||||
CMD ["node", "src/server/index.js", "--host", "0.0.0.0"]
|
# Copy all source files
|
||||||
|
COPY src/server-deno/ .
|
||||||
|
|
||||||
|
# Run with watch mode and all necessary permissions
|
||||||
|
CMD ["deno", "run", \
|
||||||
|
"--allow-net", \
|
||||||
|
"--allow-read", \
|
||||||
|
"--allow-env", \
|
||||||
|
"--allow-write", \
|
||||||
|
"--watch", \
|
||||||
|
"main.ts"]
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM base AS production
|
||||||
|
|
||||||
|
ENV DENO_ENV=production \
|
||||||
|
PORT=5173
|
||||||
|
|
||||||
|
EXPOSE 5173
|
||||||
|
|
||||||
|
# Copy only necessary source files for production
|
||||||
|
COPY src/server-deno/ .
|
||||||
|
|
||||||
|
# Run optimized production server
|
||||||
|
CMD ["deno", "run", \
|
||||||
|
"--allow-net", \
|
||||||
|
"--allow-read=/app/data,/app/public", \
|
||||||
|
"--allow-env", \
|
||||||
|
"--allow-write=/app/data", \
|
||||||
|
"main.ts"]
|
||||||
|
|||||||
2162
data/hitster_default/years.json
Normal file
2162
data/hitster_default/years.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,24 @@
|
|||||||
services:
|
services:
|
||||||
|
# Production service
|
||||||
hitstar:
|
hitstar:
|
||||||
build: .
|
build:
|
||||||
image: hitstar-webapp:latest
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
target: production
|
||||||
|
image: hitstar-deno:prod
|
||||||
container_name: hitstar
|
container_name: hitstar
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- DENO_ENV=production
|
||||||
- PORT=5173
|
- PORT=5173
|
||||||
ports:
|
ports:
|
||||||
- "5173:5173"
|
- "5173:5173"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data:rw
|
- ./data:/app/data:ro
|
||||||
restart: unless-stopped
|
- ./src/server-deno/public:/app/public:ro
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- hitstar-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
hitstar-network:
|
||||||
|
driver: bridge
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 288 KiB |
@@ -122,8 +122,8 @@
|
|||||||
"mbid": null
|
"mbid": null
|
||||||
},
|
},
|
||||||
"Bill Haley & His Comets - (We're Gonna) Rock Around The Clock (Single Version).opus": {
|
"Bill Haley & His Comets - (We're Gonna) Rock Around The Clock (Single Version).opus": {
|
||||||
"year": 2014,
|
"year": 1955,
|
||||||
"date": "2014-09-19",
|
"date": "1955",
|
||||||
"title": "(We're Gonna) Rock Around The Clock (Single Version)",
|
"title": "(We're Gonna) Rock Around The Clock (Single Version)",
|
||||||
"artist": "Bill Haley & His Comets",
|
"artist": "Bill Haley & His Comets",
|
||||||
"mbid": "5e17cc2d-368d-4abb-b22c-71b08d6cfef9"
|
"mbid": "5e17cc2d-368d-4abb-b22c-71b08d6cfef9"
|
||||||
@@ -136,8 +136,8 @@
|
|||||||
"mbid": "732b4543-1820-4cb6-b7cb-25c0356f1f5b"
|
"mbid": "732b4543-1820-4cb6-b7cb-25c0356f1f5b"
|
||||||
},
|
},
|
||||||
"Bill Medley - (I've Had) The Time Of My Life (From Dirty Dancing Soundtrack).opus": {
|
"Bill Medley - (I've Had) The Time Of My Life (From Dirty Dancing Soundtrack).opus": {
|
||||||
"year": 2024,
|
"year": 1987,
|
||||||
"date": "2024",
|
"date": "1987",
|
||||||
"title": "(I've Had) The Time Of My Life (From \"Dirty Dancing\" Soundtrack)",
|
"title": "(I've Had) The Time Of My Life (From \"Dirty Dancing\" Soundtrack)",
|
||||||
"artist": "Bill Medley, Jennifer Warnes",
|
"artist": "Bill Medley, Jennifer Warnes",
|
||||||
"mbid": "3da1ab83-49aa-4b69-a6e9-9566f3c3f5fa"
|
"mbid": "3da1ab83-49aa-4b69-a6e9-9566f3c3f5fa"
|
||||||
@@ -444,8 +444,8 @@
|
|||||||
"mbid": "c3c3b281-5943-4c7d-bd1c-69d877277714"
|
"mbid": "c3c3b281-5943-4c7d-bd1c-69d877277714"
|
||||||
},
|
},
|
||||||
"Danny and The Juniors - At The Hop.opus": {
|
"Danny and The Juniors - At The Hop.opus": {
|
||||||
"year": 1986,
|
"year": 1957,
|
||||||
"date": "1986",
|
"date": "1957",
|
||||||
"title": "At The Hop",
|
"title": "At The Hop",
|
||||||
"artist": "Danny and The Juniors",
|
"artist": "Danny and The Juniors",
|
||||||
"mbid": "8e980a28-f25b-495e-94be-b19b56f6019c"
|
"mbid": "8e980a28-f25b-495e-94be-b19b56f6019c"
|
||||||
@@ -816,7 +816,7 @@
|
|||||||
},
|
},
|
||||||
"Haddaway - What Is Love (7 Mix).opus": {
|
"Haddaway - What Is Love (7 Mix).opus": {
|
||||||
"year": 1993,
|
"year": 1993,
|
||||||
"date": "1993-01-18",
|
"date": "1993",
|
||||||
"title": "What Is Love (7\" Mix)",
|
"title": "What Is Love (7\" Mix)",
|
||||||
"artist": "Haddaway",
|
"artist": "Haddaway",
|
||||||
"mbid": "2970d12e-5eb9-45c9-8eac-38ce11efc18f"
|
"mbid": "2970d12e-5eb9-45c9-8eac-38ce11efc18f"
|
||||||
@@ -1123,8 +1123,8 @@
|
|||||||
"mbid": "a393ce94-3cbc-4723-97de-7a270bb7b606"
|
"mbid": "a393ce94-3cbc-4723-97de-7a270bb7b606"
|
||||||
},
|
},
|
||||||
"Little Eva - The Locomotion.opus": {
|
"Little Eva - The Locomotion.opus": {
|
||||||
"year": 1992,
|
"year": 1962,
|
||||||
"date": "1992",
|
"date": "1962",
|
||||||
"title": "The Locomotion",
|
"title": "The Locomotion",
|
||||||
"artist": "Little Eva",
|
"artist": "Little Eva",
|
||||||
"mbid": "77077947-1945-421a-bdb7-fd057a9ec546"
|
"mbid": "77077947-1945-421a-bdb7-fd057a9ec546"
|
||||||
@@ -1151,8 +1151,8 @@
|
|||||||
"mbid": "87e36ab4-6914-44ab-b740-7abb37678040"
|
"mbid": "87e36ab4-6914-44ab-b740-7abb37678040"
|
||||||
},
|
},
|
||||||
"Lynyrd Skynyrd - Sweet Home Alabama.opus": {
|
"Lynyrd Skynyrd - Sweet Home Alabama.opus": {
|
||||||
"year": 1976,
|
"year": 1974,
|
||||||
"date": "1976-09",
|
"date": "1974",
|
||||||
"title": "Sweet Home Alabama",
|
"title": "Sweet Home Alabama",
|
||||||
"artist": "Lynyrd Skynyrd",
|
"artist": "Lynyrd Skynyrd",
|
||||||
"mbid": "8392991c-3929-4bf9-a8fb-461bb9aca76d"
|
"mbid": "8392991c-3929-4bf9-a8fb-461bb9aca76d"
|
||||||
@@ -1627,8 +1627,8 @@
|
|||||||
"mbid": null
|
"mbid": null
|
||||||
},
|
},
|
||||||
"Rufus - Ain't Nobody.opus": {
|
"Rufus - Ain't Nobody.opus": {
|
||||||
"year": null,
|
"year": 1983,
|
||||||
"date": null,
|
"date": "1983",
|
||||||
"title": "Ain't Nobody",
|
"title": "Ain't Nobody",
|
||||||
"artist": "Rufus, Chaka Khan",
|
"artist": "Rufus, Chaka Khan",
|
||||||
"mbid": null
|
"mbid": null
|
||||||
@@ -1830,8 +1830,8 @@
|
|||||||
"mbid": null
|
"mbid": null
|
||||||
},
|
},
|
||||||
"The Chordettes - Lollipop.opus": {
|
"The Chordettes - Lollipop.opus": {
|
||||||
"year": 1987,
|
"year": 1959,
|
||||||
"date": "1987",
|
"date": "1959",
|
||||||
"title": "Lollipop",
|
"title": "Lollipop",
|
||||||
"artist": "The Chordettes",
|
"artist": "The Chordettes",
|
||||||
"mbid": "ed626d61-415e-4a4c-bcc0-89805243ab8b"
|
"mbid": "ed626d61-415e-4a4c-bcc0-89805243ab8b"
|
||||||
@@ -2012,8 +2012,8 @@
|
|||||||
"mbid": "4d89c734-db46-4418-86c0-3f00814412bd"
|
"mbid": "4d89c734-db46-4418-86c0-3f00814412bd"
|
||||||
},
|
},
|
||||||
"T'pau - China In Your Hand (Single Version).opus": {
|
"T'pau - China In Your Hand (Single Version).opus": {
|
||||||
"year": 2009,
|
"year": 1987,
|
||||||
"date": "2009-06-08",
|
"date": "1987",
|
||||||
"title": "China In Your Hand (Single Version)",
|
"title": "China In Your Hand (Single Version)",
|
||||||
"artist": "T'pau",
|
"artist": "T'pau",
|
||||||
"mbid": "56a5d0fc-a0c3-4e07-91b5-0c8c77b43ab2"
|
"mbid": "56a5d0fc-a0c3-4e07-91b5-0c8c77b43ab2"
|
||||||
|
|||||||
@@ -204,7 +204,9 @@ export class AudioStreamingService {
|
|||||||
* Set common caching headers
|
* Set common caching headers
|
||||||
*/
|
*/
|
||||||
private setCommonHeaders(ctx: Context): void {
|
private setCommonHeaders(ctx: Context): void {
|
||||||
ctx.response.headers.set('Cache-Control', 'no-store');
|
// Allow caching of audio content to prevent redundant range requests
|
||||||
|
// The token system already provides security
|
||||||
|
ctx.response.headers.set('Cache-Control', 'public, max-age=3600');
|
||||||
ctx.response.headers.set('Accept-Ranges', 'bytes');
|
ctx.response.headers.set('Accept-Ranges', 'bytes');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export class HttpServer {
|
|||||||
ctx.response.headers.set('Access-Control-Allow-Origin', this.config.corsOrigin);
|
ctx.response.headers.set('Access-Control-Allow-Origin', this.config.corsOrigin);
|
||||||
ctx.response.headers.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
ctx.response.headers.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
||||||
ctx.response.headers.set('Access-Control-Allow-Headers', 'Content-Type, Range');
|
ctx.response.headers.set('Access-Control-Allow-Headers', 'Content-Type, Range');
|
||||||
|
ctx.response.headers.set('Access-Control-Expose-Headers', 'Content-Range, Content-Length, Accept-Ranges');
|
||||||
|
|
||||||
if (ctx.request.method === 'OPTIONS') {
|
if (ctx.request.method === 'OPTIONS') {
|
||||||
ctx.response.status = 204;
|
ctx.response.status = 204;
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ export function handlePlayTrack(msg) {
|
|||||||
try {
|
try {
|
||||||
$audio.preload = 'auto';
|
$audio.preload = 'auto';
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
|
// Reset audio state before setting new source
|
||||||
|
try {
|
||||||
|
$audio.pause();
|
||||||
|
$audio.currentTime = 0;
|
||||||
|
} catch {}
|
||||||
|
|
||||||
$audio.src = t.url;
|
$audio.src = t.url;
|
||||||
const pf = document.getElementById('progressFill');
|
const pf = document.getElementById('progressFill');
|
||||||
if (pf) pf.style.width = '0%';
|
if (pf) pf.style.width = '0%';
|
||||||
@@ -93,7 +100,7 @@ export function handlePlayTrack(msg) {
|
|||||||
const localStart = now + offsetMs;
|
const localStart = now + offsetMs;
|
||||||
const delay = Math.max(0, localStart - now);
|
const delay = Math.max(0, localStart - now);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$audio.currentTime = 0;
|
// Don't reset currentTime again - it's already 0 from above
|
||||||
$audio.play().catch(() => {});
|
$audio.play().catch(() => {});
|
||||||
const disc = document.getElementById('recordDisc');
|
const disc = document.getElementById('recordDisc');
|
||||||
if (disc) disc.classList.add('spin-record');
|
if (disc) disc.classList.add('spin-record');
|
||||||
|
|||||||
2160
tmp_tracks.json
2160
tmp_tracks.json
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user