diff --git a/Data/Favicons/anonfiles.com.ico b/Data/Favicons/anonfiles.com.ico deleted file mode 100644 index afdfbd91..00000000 Binary files a/Data/Favicons/anonfiles.com.ico and /dev/null differ diff --git a/Data/Favicons/multi-up.com.ico b/Data/Favicons/multi-up.com.ico deleted file mode 100644 index 3bea3651..00000000 Binary files a/Data/Favicons/multi-up.com.ico and /dev/null differ diff --git a/Data/Scripts/anonfiles.com.nut b/Data/Scripts/anonfiles.com.nut deleted file mode 100644 index 9adbb4d3..00000000 --- a/Data/Scripts/anonfiles.com.nut +++ /dev/null @@ -1,48 +0,0 @@ - -function UploadFile(FileName, options) { - local apiKey = ServerParams.getParam("apiKey"); - local login = ServerParams.getParam("Login"); - if ( login != "" && apiKey == "") { - WriteLog("error", "anonfiles.com: You must set API Key in server settings for uploading into account."); - return 0; - } - local name = ExtractFileName(FileName); - local mime = GetFileMimeType(name); - local url = "https://api.anonfiles.com/upload"; - if (apiKey != "") { - url += "?token=" + apiKey; - } - nm.setUrl(url); - nm.addQueryParamFile("file", FileName, name, mime); - nm.doUploadMultipartData(); - if (nm.responseCode() == 200) { - local sJSON = nm.responseBody(); - local t = ParseJSON(sJSON); - if (t != null) { - if (t.status) { - //options.setDirectUrl(t.data.file.url.full); - options.setViewUrl(t.data.file.url.short); - return 1; - } else { - local msg = ""; - if ( "error" in t) { - msg = t.error.message; - } - WriteLog("error", "anonfiles.com: Upload failed. Error: " + msg); - } - - } else { - WriteLog("error", "anonfiles.com: Failed to parse server's answer aj json."); - } - - } else { - WriteLog("error", "anonfiles.com: Failed to upload. Server status code: " + nm.responseCode()); - } - return 0; -} - -function GetServerParamList() { - return { - apiKey = "API Key", - }; -} \ No newline at end of file diff --git a/Data/Scripts/file.coffee.nut b/Data/Scripts/file.coffee.nut index af9bfdaf..6e24a176 100644 --- a/Data/Scripts/file.coffee.nut +++ b/Data/Scripts/file.coffee.nut @@ -9,10 +9,10 @@ function UploadFile(FileName, options) { local sJSON = nm.responseBody(); local t = ParseJSON(sJSON); if (t != null) { - if (t.success) { + if ("success" in t && t.success) { options.setDirectUrl(t.url); return 1; - } else { + } else if ("message" in t) { WriteLog("error", "[file.coffee] " + t.message); } } diff --git a/Data/servers.xml b/Data/servers.xml index a48f4c39..a25e7ea0 100644 --- a/Data/servers.xml +++ b/Data/servers.xml @@ -54,12 +54,6 @@ - - - - - - @@ -233,12 +227,6 @@ - - - - - - diff --git a/Source/Core/Upload/Tests/UploadEngineListTest.cpp b/Source/Core/Upload/Tests/UploadEngineListTest.cpp index a13db1a9..de4660fe 100644 --- a/Source/Core/Upload/Tests/UploadEngineListTest.cpp +++ b/Source/Core/Upload/Tests/UploadEngineListTest.cpp @@ -32,7 +32,7 @@ TEST_F(UploadEngineListTest, loadFromFile) engineData = list.byName("fastpic.ru"); ASSERT_TRUE(engineData != nullptr); EXPECT_EQ("fastpic.ru", engineData->Name); - EXPECT_EQ(5000000, engineData->MaxFileSize); + EXPECT_EQ(10737418240, engineData->MaxFileSize); EXPECT_EQ(true, engineData->Debug); EXPECT_EQ(0, engineData->NeedAuthorization); EXPECT_EQ("", engineData->PluginName); diff --git a/Source/Core/UploadEngineList.cpp b/Source/Core/UploadEngineList.cpp index c7325030..1b41831e 100644 --- a/Source/Core/UploadEngineList.cpp +++ b/Source/Core/UploadEngineList.cpp @@ -141,7 +141,13 @@ bool CUploadEngineList::loadFromFile(const std::string& filename, ServerSettings UE.MaxThreads = 1; } bool fileHost = cur.AttributeBool("FileHost"); - UE.MaxFileSize = cur.AttributeInt("MaxFileSize"); + std::string maxFileSize = cur.Attribute("MaxFileSize"); + if (!maxFileSize.empty()) { + try { + UE.MaxFileSize = std::stoll(maxFileSize); + } catch (const std::exception&) { + } + } std::string typeString = cur.Attribute("Type"); @@ -281,7 +287,7 @@ bool CUploadEngineList::loadFromFile(const std::string& filename, ServerSettings return true; } -bool CUploadEngineList::compareEngines(const std::unique_ptr& elem1, std::unique_ptr& elem2) +bool CUploadEngineList::compareEngines(const std::unique_ptr& elem1, const std::unique_ptr& elem2) { return IuStringUtils::stricmp(elem1->Name.c_str(), elem2->Name.c_str()) < 0; } diff --git a/Source/Core/UploadEngineList.h b/Source/Core/UploadEngineList.h index c59402c1..ca64988b 100644 --- a/Source/Core/UploadEngineList.h +++ b/Source/Core/UploadEngineList.h @@ -39,7 +39,7 @@ class CUploadEngineList: public CUploadEngineListBase int m_ActionNumOfRetries; private: DISALLOW_COPY_AND_ASSIGN(CUploadEngineList); - bool static compareEngines(const std::unique_ptr& elem1, std::unique_ptr& elem2); + bool static compareEngines(const std::unique_ptr& elem1, const std::unique_ptr& elem2); }; -#endif // IU_CORE_UPLOADENGINELIST_H \ No newline at end of file +#endif // IU_CORE_UPLOADENGINELIST_H diff --git a/Source/Tests/TestData/servers.xml b/Source/Tests/TestData/servers.xml index a257fc21..5395272d 100644 --- a/Source/Tests/TestData/servers.xml +++ b/Source/Tests/TestData/servers.xml @@ -8,7 +8,7 @@ - +