From b2f4a4865c6e828c07945243057ab3e4b27ada68 Mon Sep 17 00:00:00 2001 From: Sergey Svistunov Date: Sun, 28 Apr 2024 20:01:03 +0300 Subject: [PATCH] Fixed imgbox.com, disabled transfer.sh hosting --- Data/Scripts/imgbox.nut | 16 ++++++++-------- Data/servers.xml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Data/Scripts/imgbox.nut b/Data/Scripts/imgbox.nut index b200540d..6f74c2e5 100644 --- a/Data/Scripts/imgbox.nut +++ b/Data/Scripts/imgbox.nut @@ -1,7 +1,7 @@ -baseUrl <- "https://imgbox.com"; +const BASE_URL = "https://imgbox.com"; function getRequiredData() { - nm.doGet(baseUrl); + nm.doGet(BASE_URL); local ret = {cookie="",token=""}; local sBody = nm.responseBody(); if (nm.responseCode() == 200) { @@ -24,12 +24,13 @@ function UploadFile(FileName, options) { WriteLog("error", "Can not obtain cookie and token valuest, required by uploading process."); return -1; //error, no cookie, no token :( } - nm.setUrl(baseUrl+"/ajax/token/generate"); + nm.setUrl(BASE_URL+"/ajax/token/generate"); + nm.addQueryHeader("Accept", "application/json, text/javascript, */*; q=0.01"); nm.addQueryHeader("X-CSRF-Token", sCSRFToken); - nm.addQueryHeader("Cookie", "request_method=GET; "+sImgboxCookie); + //nm.addQueryHeader("Cookie", "request_method=GET; "+sImgboxCookie); nm.addQueryHeader("X-Requested-With", "XMLHttpRequest"); - nm.addQueryHeader("Host", "imgbox.com"); - nm.addQueryHeader("Referer", "https://imgbox.com/"); + nm.addQueryHeader("Origin", "https://imgbox.com"); + nm.setReferer("https://imgbox.com/"); nm.doPost(""); local sBody = nm.responseBody(); if (nm.responseCode() != 200) { @@ -44,11 +45,10 @@ function UploadFile(FileName, options) { if (json.ok) { local sTokenId = json.token_id; local sTokenSecret = json.token_secret; - nm.setUrl(baseUrl+"/upload/process"); + nm.setUrl(BASE_URL+"/upload/process"); nm.addQueryHeader("X-CSRF-Token", sCSRFToken); nm.addQueryHeader("Cookie", "request_method=POST; "+sImgboxCookie); nm.addQueryHeader("X-Requested-With", "XMLHttpRequest"); - nm.addQueryHeader("Host", "imgbox.com"); nm.addQueryHeader("Referer", "https://imgbox.com/"); diff --git a/Data/servers.xml b/Data/servers.xml index f4ee498a..431c8ee7 100644 --- a/Data/servers.xml +++ b/Data/servers.xml @@ -336,11 +336,11 @@ - +