mirror of
https://github.com/Inside4ndroid/TMDB-Embed-API.git
synced 2026-10-22 09:35:11 +00:00
Merge pull request #57 from venxm14/main
Fix bugs related to ENABLE_PROXY and Proxy URL handling
This commit is contained in:
@@ -11,6 +11,7 @@ const { resolveImdbId } = require('./utils/tmdb');
|
|||||||
const { applyFilters } = require('./utils/streamFilters');
|
const { applyFilters } = require('./utils/streamFilters');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
app.set('trust proxy', 1);
|
||||||
|
|
||||||
// Conditionally mount proxy routes early so downstream handlers can use them
|
// Conditionally mount proxy routes early so downstream handlers can use them
|
||||||
if (config.enableProxy) {
|
if (config.enableProxy) {
|
||||||
|
|||||||
@@ -95,7 +95,9 @@ function extractOriginalUrl(proxyUrl) {
|
|||||||
while (decoded.includes('%2F')) {
|
while (decoded.includes('%2F')) {
|
||||||
try { decoded = decodeURIComponent(decoded); } catch { break; }
|
try { decoded = decodeURIComponent(decoded); } catch { break; }
|
||||||
}
|
}
|
||||||
return decoded;
|
if (decoded.startsWith('http://') || decoded.startsWith('https://')) return decoded;
|
||||||
|
// If it's just a path (like Vidlink /proxy/wiwii/...), keep the full original URL
|
||||||
|
return proxyUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (url.searchParams.has('url')) return decodeURIComponent(url.searchParams.get('url'));
|
if (url.searchParams.has('url')) return decodeURIComponent(url.searchParams.get('url'));
|
||||||
|
|||||||
+2
-1
@@ -173,7 +173,8 @@ function loadConfig() {
|
|||||||
showboxCacheDir: process.env.SHOWBOX_CACHE_DIR || null,
|
showboxCacheDir: process.env.SHOWBOX_CACHE_DIR || null,
|
||||||
// Proxy/env paths removed; always direct connections
|
// Proxy/env paths removed; always direct connections
|
||||||
disableUrlValidation: process.env.DISABLE_URL_VALIDATION,
|
disableUrlValidation: process.env.DISABLE_URL_VALIDATION,
|
||||||
disable4khdhubUrlValidation: process.env.DISABLE_4KHDHUB_URL_VALIDATION
|
disable4khdhubUrlValidation: process.env.DISABLE_4KHDHUB_URL_VALIDATION,
|
||||||
|
enableProxy: process.env.ENABLE_PROXY
|
||||||
};
|
};
|
||||||
|
|
||||||
// Dynamic provider enable flags from env
|
// Dynamic provider enable flags from env
|
||||||
|
|||||||
Reference in New Issue
Block a user