Skip to content

Commit

Permalink
Added lostpix.com, getapic.me; Fixed mediafire.com #77
Browse files Browse the repository at this point in the history
Also fixed json function in servers.xml
  • Loading branch information
zenden2k committed Mar 24, 2024
1 parent 28ea9f3 commit c4574a6
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 7 deletions.
Binary file added Data/Favicons/getapic.me.ico
Binary file not shown.
Binary file added Data/Favicons/lostpix.com.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion Data/Scripts/fastpic.nut
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function UploadFile(FileName, options) {
nm.setUrl("https://fastpic.ru/upload?api=1");
nm.setUrl("https://fastpic.org/upload?api=1");
//nm.addQueryHeader("User-Agent","FPUploader");
nm.addQueryParam("method", "file");
nm.addQueryParamFile("file1", FileName, ExtractFileName(FileName), "");
Expand Down
11 changes: 9 additions & 2 deletions Data/Scripts/mediafire.nut
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const CURLOPT_POSTFIELDSIZE = 60;

function min(a,b) {
return a < b ? a : b;
}
Expand Down Expand Up @@ -178,8 +180,10 @@ function _ChunkedUpload(sessionToken, folderId, FileName, fileNameBase, fileSize
nm.addQueryHeader("X-Unit-Hash", chunkHash);
nm.addQueryHeader("X-Unit-Size", chunk);
nm.addQueryHeader("X-Unit-Id", i);
nm.setChunkOffset(i * chunkSize);
nm.setChunkOffset(offset);
nm.setChunkSize(currentChunk);
nm.setMethod("POST");
nm.setCurlOptionInt(CURLOPT_POSTFIELDSIZE, currentChunk);
nm.doUpload(FileName, "");

if (nm.responseCode() == 200) {
Expand Down Expand Up @@ -230,6 +234,7 @@ function UploadFile(FileName, options) {
local sessionToken = Sync.getValue("sessionToken");
local fileSize = GetFileSize(FileName);
local fileNameBase = ExtractFileName(FileName);
local mimeType = GetFileMimeType(FileName);

local folderId = options.getFolderID();
if (folderId == "") {
Expand All @@ -246,8 +251,10 @@ function UploadFile(FileName, options) {
nm.addQueryHeader("X-Filename", fileNameBase);
nm.addQueryHeader("X-Filesize", fileSize);
nm.addQueryHeader("X-Filehash", fileHash);
nm.addQueryHeader("Content-Type", "application/octet-stream");
nm.setReferer("https://app.mediafire.com/");

nm.setMethod("POST");
nm.setCurlOptionInt(CURLOPT_POSTFIELDSIZE, fileSize);
nm.doUpload(FileName, "");

if (nm.responseCode() == 200) {
Expand Down
26 changes: 26 additions & 0 deletions Data/servers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,32 @@
</Actions>
<Result ImageUrlTemplate="stub"/>
</Server>
<Server Name="lostpix.com" MaxFileSize="10485760">
<Actions>
<Action Type="upload" Url="https://lostpix.com/" PostParams="action=upload;width=$(_FILENAME);local_uploadfile[]=%filename%;web_uploadfile=;thumb=true;thumb_width=$(_THUMBWIDTH);thumb_height=;texttype=dimensions" RegExp="\[img\](.*?)\[([\s\S]*?)\[url=(.*?)\]\[img\](.*?)\[" AssignVars="Image:0;View:2;Thumb:3;"/>
</Actions>
<Result ImageUrlTemplate="$(Image)" ThumbUrlTemplate="$(Thumb)" DownloadUrlTemplate="$(View)" />
</Server>
<Server Name="getapic.me" Debug="0" Authorize="1">
<Actions>
<Action Type="login" Url="https://getapic.me/login/auth" PostParams="next=;email=$(_LOGIN);password=$(_PASSWORD);"
CustomHeaders="X-Requested-With:XMLHttpRequest" OnlyOnce="1"
>
<Call Function="json" Arg1="result.success" AssignVars="Success:0;"/>
<RegExp Data="$(Success)" Pattern="True" AssignVars=""/>
</Action>
<Action Type="get" Url="https://getapic.me/" RegExp="session\]'\)\.val\('(.+?)'" AssignVars="Session:0" OnlyOnce="0">
<RegExp Pattern="suid\]'\)\.val\('(.+?)'" AssignVars="Suid:0"/>
</Action>
<Action Type="upload" Url="https://getapic.me/upload" CustomHeaders="X-Requested-With:XMLHttpRequest" Referer="https://getapic.me/"
PostParams="getpreviewsize=$(_THUMBWIDTH);getpreviewalt=;getreduceimage=320;needreduce=0;upload_quality=100;upload_angle=0;upload_resizeside=width;gettypeofdownload=N;session=$(Session);suid=$(Suid);file[]=%filename%;"
>
<Call Function="json" Arg1="result.data.url" AssignVars="ResultsPage:0;"/>
</Action>
<Action Type="get" Url="$(ResultsPage)" RegExp="\[IMG\](.*?)\[([\s\S]*?)\[URL=(.*?)\]\[IMG\](.*?)\[" AssignVars="Image:0;View:2;Thumb:3;"/>
</Actions>
<Result ImageUrlTemplate="$(Image)" ThumbUrlTemplate="$(Thumb)" DownloadUrlTemplate="$(View)" />
</Server>
<!-- 429 Too Many Requests
<Server Name="pasteboard.co" MaxThreads="1">
<Actions>
Expand Down
2 changes: 1 addition & 1 deletion Docs/ru_RU/advanced.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ <h2>Создание плагинов</h2>
<p>
<a href="../api/html/index.html">Scripting API reference</a><p>
<a href="http://www.squirrel-lang.org/doc/squirrel3.html" target="_blank">Документация языка Squirrel</a><br>
<a href="http://www.squirrel-lang.org/doc/sqstdlib3.html" target="_blank">Документация стандартной библиотеки языка Squirrel</a>
<a href="http://www.squirrel-lang.org/doc/sqstdlib3.pdf" target="_blank">Документация стандартной библиотеки языка Squirrel (PDF)</a>
</p>

</div>
Expand Down
12 changes: 9 additions & 3 deletions Source/Core/Upload/DefaultUploadEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ bool CDefaultUploadEngine::DoUploadAction(UploadAction& Action, bool bUpload)
return ReadServerResponse(Action);
}
catch (std::exception& ex) {
std::cerr<<ex.what()<<std::endl;
LOG(ERROR) << ex.what() << std::endl;
return false;
}
}
Expand Down Expand Up @@ -334,9 +334,15 @@ bool CDefaultUploadEngine::ParseAnswer(UploadAction& Action, const std::string&
reader.parse(*data, root, false);
Json::Path jsonPath(ReplaceVars(actionRegExp.getArg(1)), Json::PathArgument());
std::string result;
const auto& resolved = jsonPath.resolve(root);
if (resolved.isString()) {
result = resolved.asCString();
} else {
std::stringstream sstr;
sstr << resolved;
result = sstr.str();
}

result = jsonPath.resolve(root).asCString();
const Json::Value& resolved = jsonPath.resolve(root);
if (!resolved.isNull()) {
assignVars(actionRegExp, [&result](int index) -> std::string {
if (index == 0) {
Expand Down

0 comments on commit c4574a6

Please sign in to comment.