add a way to disable m3u8 proxying

This commit is contained in:
Pas 2025-07-22 09:54:55 -06:00
parent 6937fddb92
commit 0356b766ba
2 changed files with 14 additions and 0 deletions

View file

@ -363,6 +363,13 @@ export function handleCacheStats(event: any) {
export default defineEventHandler(async (event) => {
// Handle CORS preflight requests
if (isPreflightRequest(event)) return handleCors(event, {});
if (process.env.DISABLE_M3U8 === 'true') {
return sendError(event, createError({
statusCode: 404,
statusMessage: 'M3U8 proxying is disabled'
}));
}
if (event.path === '/cache-stats') {
return handleCacheStats(event);

View file

@ -7,6 +7,13 @@ const isCacheDisabled = () => process.env.DISABLE_CACHE === 'true';
export default defineEventHandler(async (event) => {
// Handle CORS preflight requests
if (isPreflightRequest(event)) return handleCors(event, {});
if (process.env.DISABLE_M3U8 === 'true') {
return sendError(event, createError({
statusCode: 404,
statusMessage: 'TS proxying is disabled'
}));
}
const url = getQuery(event).url as string;
const headersParam = getQuery(event).headers as string;