Compare commits
2 Commits
b1c1a8d318
...
abb1621a60
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abb1621a60 | ||
|
|
46888c0220 |
@ -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;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "3.3.77",
|
"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": {
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user