Skip to content
Snippets Groups Projects
Commit f193ce97 authored by Patricio Kumagae's avatar Patricio Kumagae
Browse files

Cambios en la extensión del archivo

parent 518f841e
No related branches found
No related tags found
No related merge requests found
......@@ -22,10 +22,7 @@ function allowDrop(e) {
}
function stamp(e){
e.preventDefault();
/*$('#ots_div').html('<img src="' + loader_gif + '">');
$('#ots_div').show();*/
e.preventDefault();
var file = e.dataTransfer.items[0].getAsFile();
......@@ -48,7 +45,7 @@ function stamp(e){
success: function(response){
var ots = ' {"file_hash": "' + file_hash + '", "ots": "' + response.temporay_ots + '"}';
var ots = ' {"file_hash": "' + file_hash + '", "rd": "' + response.temporay_ots + '"}';
var saveData = (function () {
......@@ -66,8 +63,8 @@ function stamp(e){
};
}());
var data = response.temporay_ots
fileName = file.name + ".ots.temp";
var data = response.temporay_rd
fileName = file.name + ".rd.temp";
saveData(data, fileName);
......@@ -76,32 +73,6 @@ function stamp(e){
}
}
function verify(json_ots){
try{
var ots = JSON.parse(json_ots);
}
catch(err){
$('#response').html('<span class="glyphicon glyphicon-remove text-danger"></span> Parámetros inválidos');
return;
}
if(deadline_date<current_date){
verify_bfa(ots);
}
else{
a=2;
}
}
function verify_bfa(ots){
var pending = false;
......@@ -110,7 +81,7 @@ function verify_bfa(ots){
$.ajax({
url: tsa_api + "verify/",
type: "POST",
data: {"file_hash" : ots.file_hash, "ots": ots.ots},
data: {"file_hash" : ots.file_hash, "rd": ots.rd},
dataType: "json",
success: function(response){
......@@ -130,27 +101,30 @@ function verify_bfa(ots){
$('#response').html(message);
var saveData = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (data, fileName) {
var json = JSON.stringify(data),
blob = new Blob([json], {type: "octet/stream"}),
url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
};
}());
var data = response.permanent_ots;
fileName = $('#hidden_original_file_name').val() + ".ots";
if($('#ots_info').html().includes('.temp')){
saveData(data, fileName);
}
if(!pending){
var saveData = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (data, fileName) {
var json = JSON.stringify(data),
blob = new Blob([json], {type: "octet/stream"}),
url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
};
}());
var data = response.permanent_rd;
fileName = $('#hidden_original_file_name').val() + ".rd";
if($('#ots_info').html().includes('.temp')){
saveData(data, fileName);
}
}
},
error:function(jqXHR, textStatus, errorThrown){
......@@ -210,7 +184,7 @@ function drop_ots(e){
$('#ots_info').html(file.name);
var ots = {"file_hash": file_hash, "ots": file_contents}
var ots = {"file_hash": file_hash, "rd": file_contents}
verify_bfa(ots);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment