From 09ee6a83c7d67419fc64ab113ac0054d87b6c37a Mon Sep 17 00:00:00 2001 From: Daniel Pascual Date: Tue, 25 May 2021 15:57:17 +0200 Subject: [PATCH] Send credentials when fetch html from api --- dist/vt-augment.min.js | 4 ++-- package.json | 2 +- src/vt-augment.js | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dist/vt-augment.min.js b/dist/vt-augment.min.js index 52c081a..4987c96 100644 --- a/dist/vt-augment.min.js +++ b/dist/vt-augment.min.js @@ -81,7 +81,7 @@ Y.prototype.o=function(a){var b=this.g,c=b.querySelector("div.spinner");c||(c=do function Bb(){var a=document.createElement("style");var b=E(new C(D,"\n .vt-augment {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .vt-augment.drawer {\n width: 700px;\n background: white;\n border: 1px solid #e6e6e6;\n text-align: left;\n z-index: 102;\n position: fixed;\n right: 0;\n top: 0;\n height: 100vh;\n box-shadow: -4px 5px 8px -3px rgba(17, 17, 17, .16);\n animation: slideToRight 0.5s 1 forwards;\n transform: translateX(100vw);\n }\n .vt-augment.drawer[opened] {\n animation: slideFromRight 0.2s 1 forwards;\n }\n .vt-augment > .spinner {\n position: absolute;\n z-index: 199;\n top: calc(50% - 50px);\n left: calc(50% - 50px);\n border: 8px solid rgba(0, 0, 0, 0.2);\n border-left-color: white;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n animation: spin 1.2s linear infinite;\n }\n @keyframes spin {\n to { transform: rotate(360deg); }\n }\n @keyframes slideFromRight {\n 0% {\n transform: translateX(100vw);\n }\n 100% {\n transform: translateX(0);\n }\n }\n @keyframes slideToRight {\n 100% {\n transform: translateX(100vw);\n display: none;\n }\n }\n @media screen and (max-width: 700px) {\n .vt-augment.drawer {\n width: 100%;\n }\n }\n"));b= 0===b.length?Ua:new O(b,N);var c=a?new yb(9==a.nodeType?a:a.ownerDocument||a.document):ia||(ia=new yb),d=c.g;if(U&&d.createStyleSheet)d=d.createStyleSheet(),Ab(d,b);else{d=zb(c,"HEAD")[0];if(!d){var e=zb(c,"BODY")[0];d=c.h("HEAD");e.parentNode.insertBefore(d,e)}c=c.h("STYLE");if(null===u)b:{e=t.document;if((e=e.querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&ea.test(e)){u=e;break b}u=""}(e=u)&&c.setAttribute("nonce",e);Ab(c,b);d.appendChild(c)}document.body.appendChild(a)} function Z(a,b,c,d){var e={style:{width:"100%",height:"100%",border:"0"},C:0};Cb(a);a=document.createElement("div");a.style.display="none";if(c)c&&sa(c),d={},d.src=c||null,d.srcdoc=void 0,e=eb(d,{sandbox:""},e),e=db(e),hb(a,e),a.firstChild.removeAttribute("sandbox");else{if(!$a())throw Error("The browser does not support sandboxed iframes.");c={src:null};c.srcdoc=d||null;c.sandbox="";e=eb(c,{},e);e=db(e);hb(a,e);a.firstChild.setAttribute("sandbox","allow-scripts allow-same-origin allow-popups")}b.appendChild(a.removeChild(a.firstChild))} -function Cb(a){(a=a.g.querySelector("iframe"))&&a.parentNode.removeChild(a)}function Eb(a,b){var c=new XMLHttpRequest;c.onreadystatechange=function(){c.readyState===XMLHttpRequest.DONE?200===c.status?a.cache.set(b,c.response):(a.o(!1),a.cache.store.delete(b)):a.o(!1)};c.open("GET",b,!0);c.send()}function Db(a){a=a.split("/").pop();return ta({token:a})}Y.prototype.loading=Y.prototype.o;Y.prototype.closeDrawer=Y.prototype.u;Y.prototype.openDrawer=Y.prototype.A;Y.prototype.preload=Y.prototype.preload; -Y.prototype.load=Y.prototype.load;window.VTAugment=Y; +function Cb(a){(a=a.g.querySelector("iframe"))&&a.parentNode.removeChild(a)}function Eb(a,b){var c=new XMLHttpRequest;c.onreadystatechange=function(){c.readyState===XMLHttpRequest.DONE?200===c.status?a.cache.set(b,c.response):(a.o(!1),a.cache.store.delete(b)):a.o(!1)};c.open("GET",b,!0);c.withCredentials=!0;c.send()}function Db(a){a=a.split("/").pop();return ta({token:a})}Y.prototype.loading=Y.prototype.o;Y.prototype.closeDrawer=Y.prototype.u;Y.prototype.openDrawer=Y.prototype.A; +Y.prototype.preload=Y.prototype.preload;Y.prototype.load=Y.prototype.load;window.VTAugment=Y; }.bind(this))); diff --git a/package.json b/package.json index 7cde7ef..f1e3fae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@virustotal/vt-augment", - "version": "1.5.4", + "version": "1.5.5", "description": "Client library that wraps common patterns when interact with the VirusTotal Augment product", "main": "dist/vt-augment.min.js", "keywords": [ diff --git a/src/vt-augment.js b/src/vt-augment.js index f8d1bc7..1cf1004 100644 --- a/src/vt-augment.js +++ b/src/vt-augment.js @@ -397,6 +397,7 @@ class VTAugment { }; xmlhr.open('GET', url, true); + xmlhr.withCredentials = true; xmlhr.send(); }