From ec3692d9e3312b7d2d9f28f04d34b608b273b6ea Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Tue, 2 Dec 2025 18:39:45 -0700 Subject: [PATCH] Switch cache control to ENABLE_CACHE env variable Changed caching logic to use ENABLE_CACHE (disabled by default) instead of DISABLE_CACHE. Updated documentation and bumped version to 2.2.4 for clarity and consistency. --- README.md | 2 +- package.json | 2 +- src/routes/m3u8-proxy.ts | 4 ++-- src/routes/ts-proxy.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c2f593c..92e503b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Read the docs at https://docs.pstream.org/proxy/introduction - bypass CORS - always allows browser to send requests through it - secure it with turnstile - prevent bots from using your proxy - parse and bypass m3u8 stream restrictions - make sure the IP is not blocked by the CDN, may need to be on a VPS. - - Caching of tls segments (disable with DISABLE_CACHE=true in .env) + - Caching of tls segments (enable with ENABLE_CACHE=true in .env, disabled by default) > [!WARNING] > Turnstile integration only works properly with cloudflare workers as platform diff --git a/package.json b/package.json index c9d75ac..d6e3b8b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "simple-proxy", "private": true, - "version": "2.2.3", + "version": "2.2.4", "scripts": { "prepare": "nitropack prepare", "dev": "nitropack dev", diff --git a/src/routes/m3u8-proxy.ts b/src/routes/m3u8-proxy.ts index 1373c03..0fcd808 100644 --- a/src/routes/m3u8-proxy.ts +++ b/src/routes/m3u8-proxy.ts @@ -1,7 +1,7 @@ import { setResponseHeaders } from 'h3'; -// Check if caching is disabled via environment variable -const isCacheDisabled = () => process.env.DISABLE_CACHE === 'true'; +// Check if caching is enabled via environment variable (disabled by default) +const isCacheDisabled = () => process.env.ENABLE_CACHE !== 'true'; function parseURL(req_url: string, baseUrl?: string) { if (baseUrl) { diff --git a/src/routes/ts-proxy.ts b/src/routes/ts-proxy.ts index bfc93dd..615d298 100644 --- a/src/routes/ts-proxy.ts +++ b/src/routes/ts-proxy.ts @@ -1,8 +1,8 @@ import { setResponseHeaders } from 'h3'; import { getCachedSegment } from './m3u8-proxy'; -// Check if caching is disabled via environment variable -const isCacheDisabled = () => process.env.DISABLE_CACHE === 'true'; +// Check if caching is enabled via environment variable (disabled by default) +const isCacheDisabled = () => process.env.ENABLE_CACHE !== 'true'; export default defineEventHandler(async (event) => { // Handle CORS preflight requests