Skip to content

Commit

Permalink
Removed dead hostings anonfiles.com, multi-up.com; Fix reading big nu…
Browse files Browse the repository at this point in the history
…mbers in MaxFileSize from servers.xml
  • Loading branch information
zenden2k committed Jan 29, 2024
1 parent f87c0f4 commit 9a40259
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 68 deletions.
Binary file removed Data/Favicons/anonfiles.com.ico
Binary file not shown.
Binary file removed Data/Favicons/multi-up.com.ico
Binary file not shown.
48 changes: 0 additions & 48 deletions Data/Scripts/anonfiles.com.nut

This file was deleted.

4 changes: 2 additions & 2 deletions Data/Scripts/file.coffee.nut
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
12 changes: 0 additions & 12 deletions Data/servers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@
</Actions>
<Result ImageUrlTemplate="stub" ThumbUrlTemplate="stub"/>
</Server>
<Server Name="multi-up.com" FileHost="1">
<Actions>
<Action Type="upload" Url="http://multi-up.com/up.php" PostParams="upload=%filename%;" RegExp='a href=http://multi-up.com/(\d*)' AssignVars="File:0"/>
</Actions>
<Result DownloadUrlTemplate="http://multi-up.com/$(File)"/>
</Server>
<Server Name="sendspace.com" FileHost="1" Debug="0" Authorize="1" Plugin="sendspace" SupportsFolders="1" MaxFileSize="300000000" DefaultForTypes="file">
<Result DownloadUrlTemplate="stub" ImageUrlTemplate="stub" ThumbUrlTemplate="stub"/>
</Server>
Expand Down Expand Up @@ -233,12 +227,6 @@
</Actions>
<Result ImageUrlTemplate="stub"/>
</Server>
<!-- anonfiles.com is blocked in Russia -->
<Server Name="anonfiles.com" Authorize="1" Debug="0" FileHost="1" Plugin="anonfiles.com" NeedPassword="0">
<Actions>
</Actions>
<Result DownloadUrlTemplate="stub" />
</Server>
<Server Name="Google Photos" Debug="0" Authorize="2" Plugin="gphotos" SupportsFolders="1" NeedPassword="0" MaxThreads="1">
<Result ImageUrlTemplate="stub" ThumbUrlTemplate="stub"/>
</Server>
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Upload/Tests/UploadEngineListTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 8 additions & 2 deletions Source/Core/UploadEngineList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -281,7 +287,7 @@ bool CUploadEngineList::loadFromFile(const std::string& filename, ServerSettings
return true;
}

bool CUploadEngineList::compareEngines(const std::unique_ptr<CUploadEngineData>& elem1, std::unique_ptr<CUploadEngineData>& elem2)
bool CUploadEngineList::compareEngines(const std::unique_ptr<CUploadEngineData>& elem1, const std::unique_ptr<CUploadEngineData>& elem2)
{
return IuStringUtils::stricmp(elem1->Name.c_str(), elem2->Name.c_str()) < 0;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/UploadEngineList.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CUploadEngineList: public CUploadEngineListBase
int m_ActionNumOfRetries;
private:
DISALLOW_COPY_AND_ASSIGN(CUploadEngineList);
bool static compareEngines(const std::unique_ptr<CUploadEngineData>& elem1, std::unique_ptr<CUploadEngineData>& elem2);
bool static compareEngines(const std::unique_ptr<CUploadEngineData>& elem1, const std::unique_ptr<CUploadEngineData>& elem2);
};

#endif // IU_CORE_UPLOADENGINELIST_H
#endif // IU_CORE_UPLOADENGINELIST_H
2 changes: 1 addition & 1 deletion Source/Tests/TestData/servers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</Actions>
<Result ImageUrlTemplate="$(Image)" ThumbUrlTemplate="$(Thumb)"/>
</Server>
<Server Name="fastpic.ru" MaxFileSize="5000000" Debug="1" DefaultForTypes="image" MinVersion="1.3.3">
<Server Name="fastpic.ru" MaxFileSize="10737418240" Debug="1" DefaultForTypes="image" MinVersion="1.3.3">
<Actions>
<Action Type="upload" Url="http://fastpic.ru/upload?api=1" PostParams="method=file;file1=%filename%;check_thumb=size;uploading=1;orig_rotate=0;thumb_size=$(_THUMBWIDTH)" RegExp='&lt;imagepath&gt;(.*?)&lt;\/imagepath&gt;([\s\S]*?)&lt;thumbpath&gt;(.*?)&lt;\/thumbpath&gt;' AssignVars="Image:0;Thumb:2">
<RegExp Pattern="&lt;viewurl&gt;(.*?)&lt;\/viewurl&gt;" AssignVars="DownloadUrl:0;"/>
Expand Down

0 comments on commit 9a40259

Please sign in to comment.