Switch cache control to ENABLE_CACHE env variable
Some checks failed
Linting and Testing / Run Linters (push) Has been cancelled
Linting and Testing / Build project (push) Has been cancelled
Linting and Testing / Build docker (push) Has been cancelled
Docker Publish / build (push) Has been cancelled
Release / Release (push) Has been cancelled

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.
This commit is contained in:
Pas 2025-12-02 18:39:45 -07:00
parent f7d3c4f485
commit ec3692d9e3
4 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -1,7 +1,7 @@
{
"name": "simple-proxy",
"private": true,
"version": "2.2.3",
"version": "2.2.4",
"scripts": {
"prepare": "nitropack prepare",
"dev": "nitropack dev",

View file

@ -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) {

View file

@ -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