mirror of
https://github.com/p-stream/simple-proxy.git
synced 2026-01-11 20:10:35 +00:00
add a way to disable m3u8 proxying
This commit is contained in:
parent
6937fddb92
commit
0356b766ba
2 changed files with 14 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue