diff --git a/GUI/lib/js/index.js b/GUI/lib/js/index.js index 646c169ccc1b3aa35a9a75756b3f65a07e0c7adb..49cf39e84f181b479f705abb43bbde2b37306241 100644 --- a/GUI/lib/js/index.js +++ b/GUI/lib/js/index.js @@ -9,7 +9,7 @@ $(document).ready(function(){ }); }); -var tsa_api = 'http://tsaapi.pp.bfa.local/api/tsa/'; +var tsa_api = 'https://tsaapi.bfa.ar/api/tsa/'; var loader_gif = 'lib/images/ajax-loader.gif'; var ots_api = ''; var deadline_date = new Date('2018-09-03 00:00:00'); @@ -100,7 +100,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){ @@ -115,7 +115,7 @@ function verify_bfa(ots){ message = '<span class="glyphicon ' + icon + '"></span> ' + response.messages; if(!pending){ - message += ' - ots definitivo:' + response.permanent_ots; + message += ' - ots definitivo:' + response.permanent_rd; } $('#response').html(message); @@ -138,4 +138,31 @@ function verify_bfa(ots){ function verify_ots(){ +} + + + + +/* + Verifica un documento automáticamente si se reciben los datos por URL + + @param <string>file_hash: El hash del archivo a verificar + @param <string>rd: El recibo (provisorio o definitivo), + obtenido al momento de hacer stamp + + Ejemplo: https://tsagui.bfa.ar/#tab_3?file_hash=a2e8855f8409045c261970fee2cc162bacba6c9bdf250aa362024386e929d3e7&rd=MXgtYTJlODg1NWY4NDA5MDQ1YzI2MTk3MGZlZTJjYzE2MmJhY2JhNmM5YmRmMjUwYWEzNjIwMjQzODZlOTI5ZDNlNy0zMTg5ZjFhNmU5ZjVmZmQ5ZWIzOTRlZmI5ZDMxNzJmNDk5MDI4ZGU0NmZjMjJiN2QwMGNlZjViYWZhMmYyMDIxMDEtMHgxMDVjYWY0YjAwMzYyMTE1NjRhZThkNGM1NTY3MGQ2NmE0Y2I5ZThlMWNlNGRlN2Y2MGZiMjAzYzI2ZjI0ZDlhLTQxMDA1Nw== +*/ +var url = new URL(window.location.href); +var file_hash = url.searchParams.get("file_hash"); +var rd = url.searchParams.get("rd"); + +console.log('file_hash: ' + file_hash); +console.log('rd: ' + rd); + +if(typeof file_hash != "undefined" && typeof rd != "undefined" + && file_hash != '' && rd != '' + && file_hash != null && rd != null){ + var ots = {"file_hash" : file_hash, "rd": rd}; + console.log(ots); + verify_bfa(ots); } \ No newline at end of file