mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Make ShareX link download a sharex file if you're logged in
This commit is contained in:
parent
48883d7728
commit
d367bc27fa
@ -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 = "{ \
|
||||
\"Name\": \"" + location.hostname + "\", \
|
||||
\"DestinationType\": \"ImageUploader, FileUploader\", \
|
||||
\"RequestType\": \"POST\", \
|
||||
\"RequestURL\": \"" + location.origin + "/api/upload\", \
|
||||
\"FileFormName\": \"files[]\", \
|
||||
\"Headers\": { \
|
||||
\"token\": \" " + upload.token + "\" \
|
||||
}, \
|
||||
\"ResponseType\": \"Text\", \
|
||||
\"URL\": \"$json:files[0].url$\", \
|
||||
\"ThumbnailURL\": \"$json:files[0].url$\" \
|
||||
}";
|
||||
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