Compare commits

..

No commits in common. "96d6dfe88044e5fc5c59c05163f7debb80b8f2c1" and "4c0adabfb19ef9134a23e6359d06fa7218950085" have entirely different histories.

3 changed files with 16 additions and 1 deletions

View File

@ -8,6 +8,7 @@ const API_TIMEOUT = 45000; // 45 seconds
const SERVER_RETRY_ATTEMPTS = 6; const SERVER_RETRY_ATTEMPTS = 6;
const SERVER_RETRY_DELAY_MS = 2500; const SERVER_RETRY_DELAY_MS = 2500;
const LAST_UPLOAD_SERVERS = new Map(); const LAST_UPLOAD_SERVERS = new Map();
const TRUNCATED_UPLOAD_HOST = /(^|\.)filemoon$/i;
function appendRawQuery(url, rawQuery) { function appendRawQuery(url, rawQuery) {
const parsed = new URL(url); const parsed = new URL(url);
@ -79,6 +80,7 @@ function normalizeAbsoluteUrl(raw, apiBase) {
try { try {
const parsed = new URL(candidate); const parsed = new URL(candidate);
if (!['http:', 'https:'].includes(parsed.protocol)) return null; if (!['http:', 'https:'].includes(parsed.protocol)) return null;
if (TRUNCATED_UPLOAD_HOST.test(parsed.hostname)) return null;
return parsed.href; return parsed.href;
} catch { } catch {
return null; return null;

View File

@ -1,6 +1,6 @@
{ {
"name": "multi-hoster-uploader", "name": "multi-hoster-uploader",
"version": "3.3.79", "version": "3.3.78",
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously", "description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@ -32,6 +32,19 @@ describe('hosters helpers', () => {
assert.equal(url, 'https://delivery-hydra.voe-network.net/upload/01'); assert.equal(url, 'https://delivery-hydra.voe-network.net/upload/01');
}); });
it('rejects byse truncated upload hosts (TLD dropped) so the lookup retries for a valid server', () => {
assert.equal(__test.extractUploadServerUrl({ result: 'https://s1065.filemoon/upload/01' }, 'https://api.byse.sx'), null);
assert.equal(__test.extractUploadServerUrl({ result: 's1070.filemoon' }, 'https://api.byse.sx'), null);
assert.equal(__test.extractUploadServerUrl({ result: 'https://filemoon/upload/01' }, 'https://api.byse.sx'), null);
});
it('keeps a complete byse upload host (real TLD present) untouched', () => {
assert.equal(
__test.extractUploadServerUrl({ result: 'https://s1065.filemoon.sx/upload/01' }, 'https://api.byse.sx'),
'https://s1065.filemoon.sx/upload/01'
);
});
it('parseDoodstreamResult tolerates null/non-object payload without throwing', () => { it('parseDoodstreamResult tolerates null/non-object payload without throwing', () => {
// Direct callers may bypass uploadFile's normalisation. The parser must // Direct callers may bypass uploadFile's normalisation. The parser must
// never throw on bad input — empty fields are the contract. // never throw on bad input — empty fields are the contract.