Added DEFAULT_MAX_AGE_HOURS constant to proxy route

This commit is contained in:
Trevor Mears
2026-01-07 13:51:05 -08:00
parent 05996985f1
commit 7184a1ba56
+6 -3
View File
@@ -14,6 +14,9 @@ const { spawn } = require('child_process');
const ffmpegPath = require('ffmpeg-static'); const ffmpegPath = require('ffmpeg-static');
const { Readable } = require('stream'); const { Readable } = require('stream');
// Default cache max age in hours
const DEFAULT_MAX_AGE_HOURS = 24;
// Helper to get formatted category list from DB // Helper to get formatted category list from DB
function getCategoriesFromDb(sourceId, type, includeHidden = false) { function getCategoriesFromDb(sourceId, type, includeHidden = false) {
const db = getDb(); const db = getDb();
@@ -678,12 +681,12 @@ router.get('/stream', async (req, res) => {
const contentType = response.headers.get('content-type') || ''; const contentType = response.headers.get('content-type') || '';
res.set('Access-Control-Allow-Origin', '*'); res.set('Access-Control-Allow-Origin', '*');
// Forward range-related headers for video seeking support // Forward range-related headers for video seeking support
const contentLength = response.headers.get('content-length'); const contentLength = response.headers.get('content-length');
const contentRange = response.headers.get('content-range'); const contentRange = response.headers.get('content-range');
const acceptRanges = response.headers.get('accept-ranges'); const acceptRanges = response.headers.get('accept-ranges');
if (contentLength) { if (contentLength) {
res.set('Content-Length', contentLength); res.set('Content-Length', contentLength);
} }
@@ -697,7 +700,7 @@ router.get('/stream', async (req, res) => {
// we can safely assume it supports byte ranges // we can safely assume it supports byte ranges
res.set('Accept-Ranges', 'bytes'); res.set('Accept-Ranges', 'bytes');
} }
// Set status code (206 for partial content when range request was made) // Set status code (206 for partial content when range request was made)
res.status(response.status); res.status(response.status);