Compare commits
2 Commits
ede5a192ea
...
0fd8dd0634
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fd8dd0634 | ||
|
|
e22784cef8 |
@ -281,7 +281,13 @@ async function apiGet(url, signal) {
|
|||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
});
|
});
|
||||||
const data = await res.json();
|
let data;
|
||||||
|
try {
|
||||||
|
data = await res.json();
|
||||||
|
} catch {
|
||||||
|
const text = await res.text().catch(() => '');
|
||||||
|
throw new Error(`API-Antwort war kein JSON (HTTP ${res.status}): ${(text || '').slice(0, 200)}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (data.status && [401, 403, 429, 500].includes(data.status)) {
|
if (data.status && [401, 403, 429, 500].includes(data.status)) {
|
||||||
throw new Error(data.msg || data.message || JSON.stringify(data));
|
throw new Error(data.msg || data.message || JSON.stringify(data));
|
||||||
@ -300,7 +306,7 @@ async function getUploadServer(hosterName, hosterConfig, apiKey, signal) {
|
|||||||
|
|
||||||
for (let attempt = 1; attempt <= SERVER_RETRY_ATTEMPTS; attempt++) {
|
for (let attempt = 1; attempt <= SERVER_RETRY_ATTEMPTS; attempt++) {
|
||||||
for (const endpoint of hosterConfig.serverEndpoints) {
|
for (const endpoint of hosterConfig.serverEndpoints) {
|
||||||
const url = `${hosterConfig.apiBase}${endpoint}?key=${apiKey}`;
|
const url = `${hosterConfig.apiBase}${endpoint}?key=${encodeURIComponent(apiKey)}`;
|
||||||
try {
|
try {
|
||||||
const data = await apiGet(url, signal);
|
const data = await apiGet(url, signal);
|
||||||
const uploadUrl = extractUploadServerUrl(data, hosterConfig.apiBase);
|
const uploadUrl = extractUploadServerUrl(data, hosterConfig.apiBase);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "2.3.7",
|
"version": "2.3.8",
|
||||||
"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": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user