Beginning of malware warning
This commit is contained in:
@@ -30,7 +30,45 @@ var Toolbar = {
|
||||
}
|
||||
},
|
||||
download: function () {
|
||||
document.getElementById("download_frame").src = "/api/file/" + Viewer.currentFile + "?download";
|
||||
var triggerDL = function(){
|
||||
document.getElementById("download_frame").src = "/api/file/" + Viewer.currentFile + "?download";
|
||||
}
|
||||
|
||||
if (captchaKey === "a"){
|
||||
// If the server doesn't support captcha there's no use in checking
|
||||
// availability
|
||||
triggerDL();
|
||||
return;
|
||||
}
|
||||
|
||||
$.getJSON(
|
||||
apiEndpoint + "/file/" + Viewer.currentFile + "/availability"
|
||||
).done(function(data){
|
||||
if(data.success === true){
|
||||
// Downloading is allowed, start the download
|
||||
triggerDL();
|
||||
}
|
||||
}).fail(function(data){
|
||||
console.log(data);
|
||||
if(data.responseJSON.success === false) {
|
||||
var popupDiv = document.getElementById("captcha_popup");
|
||||
|
||||
if(data.responseJSON.value === "file_rate_limited_captcha_required") {
|
||||
popupDiv.innerHTML = '<div class="highlight_light border_top border_bottom">Rate limiting enabled!</div>'+
|
||||
data.responseJSON.message;
|
||||
}else if(data.responseJSON.value === "virus_detected_captcha_required"){
|
||||
popupDiv.innerHTML = '<div class="highlight_light border_top border_bottom">Malware warning!</div>'+
|
||||
data.responseJSON.message+
|
||||
"<hr/>Malware type: " + data.responseJSON.extra;
|
||||
}
|
||||
|
||||
popupDiv.style.opacity = "1";
|
||||
popupDiv.style.visibility = "visible";
|
||||
}else{
|
||||
// No JSON, try download anyway
|
||||
triggerDL();
|
||||
}
|
||||
});
|
||||
},
|
||||
downloadList: function(){
|
||||
if(!Viewer.isList){
|
||||
|
@@ -208,6 +208,24 @@ body{
|
||||
box-shadow: var(--shadow_color) 0px 0px 50px;
|
||||
z-index: 100;
|
||||
}
|
||||
.captcha_popup{
|
||||
position: fixed;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
transition: visibility 1s, opacity 1s, left 1s;
|
||||
background-color: var(--background_color);
|
||||
height: auto;
|
||||
width: 500px;
|
||||
max-width: 100%;
|
||||
top: 50px;
|
||||
left: 50%;
|
||||
margin-left: -200px;
|
||||
padding: 0 10px;
|
||||
box-sizing: border-box;
|
||||
text-align: left;
|
||||
box-shadow: var(--shadow_color) 0px 0px 50px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
table {width: auto !important;}
|
||||
table > tbody > tr {border: none !important;}
|
||||
|
Reference in New Issue
Block a user