mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-13 16:06:21 +00:00
Merge pull request #58 from ScruffyRules/sharex
Make ShareX link download a sharex file if you're logged in
This commit is contained in:
commit
0a4729d2bd
@ -82,7 +82,7 @@
|
||||
|
||||
<h3 class="subtitle"><a href="/auth" id="loginLinkText"></a></h3>
|
||||
<h3 id="links">
|
||||
<a href="https://github.com/kanadeko/loli-safe" target="_blank" class="is-danger">View on GitHub</a><span>|</span><a href="https://lolisafe.moe/sharex.txt">ShareX</a><span>|</span><a href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj" target="_blank" class="is-danger">Chrome extension</a><span>|</span><a href="/faq" class="is-danger">FAQ</a><span>|</span><a href="/auth" target="_blank" class="is-danger">Dashboard</a>
|
||||
<a href="https://github.com/kanadeko/loli-safe" target="_blank" class="is-danger">View on GitHub</a><span>|</span><a id="ShareX" href="https://lolisafe.moe/sharex.txt">ShareX</a><span>|</span><a href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj" target="_blank" class="is-danger">Chrome extension</a><span>|</span><a href="/faq" class="is-danger">FAQ</a><span>|</span><a href="/auth" target="_blank" class="is-danger">Dashboard</a>
|
||||
</h3>
|
||||
|
||||
</div>
|
||||
|
@ -172,6 +172,29 @@ upload.prepareDropzone = function(){
|
||||
|
||||
});
|
||||
|
||||
upload.prepareShareX();
|
||||
}
|
||||
|
||||
upload.prepareShareX = function(){
|
||||
if (upload.token) {
|
||||
var sharex_element = document.getElementById("ShareX");
|
||||
var sharex_file = "{\r\n\
|
||||
\"Name\": \"" + location.hostname + "\",\r\n\
|
||||
\"DestinationType\": \"ImageUploader, FileUploader\",\r\n\
|
||||
\"RequestType\": \"POST\",\r\n\
|
||||
\"RequestURL\": \"" + location.origin + "/api/upload\",\r\n\
|
||||
\"FileFormName\": \"files[]\",\r\n\
|
||||
\"Headers\": {\r\n\
|
||||
\"token\": \" " + upload.token + "\"\r\n\
|
||||
},\r\n\
|
||||
\"ResponseType\": \"Text\",\r\n\
|
||||
\"URL\": \"$json:files[0].url$\",\r\n\
|
||||
\"ThumbnailURL\": \"$json:files[0].url$\"\r\n\
|
||||
}";
|
||||
var sharex_blob = new Blob([sharex_file], {type: "application/octet-binary"});
|
||||
sharex_element.setAttribute("href", URL.createObjectURL(sharex_blob))
|
||||
sharex_element.setAttribute("download", location.hostname + ".sxcu");
|
||||
}
|
||||
}
|
||||
|
||||
//Handle image paste event
|
||||
|
Loading…
Reference in New Issue
Block a user