From 6650857a095da90a3534e26bbc9a669728e569fe Mon Sep 17 00:00:00 2001 From: sn0wcat Date: Wed, 26 Aug 2020 16:57:55 +0200 Subject: [PATCH] chore: removed gateway and southgate feat: emptyStateSimple.svg chore: cleaned up --- index.html | 9 +++++++++ manifest.json | 2 +- package.json | 2 +- scripts.ts | 15 +++++++-------- vendor/assets/images/emptyStateSimple.svg | 1 + 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 vendor/assets/images/emptyStateSimple.svg diff --git a/index.html b/index.html index 899d5d7..b00e143 100644 --- a/index.html +++ b/index.html @@ -190,6 +190,15 @@

target="_new" >opensource.mindsphere.io +
+ v.1.0.3 diff --git a/manifest.json b/manifest.json index 4d78b61..7cd757a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "MindSphere Authentication Helper Extension", - "version": "1.0.2", + "version": "1.0.3", "description": "Borrow the SESSION and XSTF-TOKEN cookie from MindSphere for local development and command line tools.", "author": "@sn0wcat", "permissions": ["cookies", "https://*.mindsphere.io/*", "https://*.mindsphere-in.cn/*"], diff --git a/package.json b/package.json index 356d202..72ea1ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mindsphere-auth-helper", - "version": "1.0.2", + "version": "1.0.3", "description": "MindSphere Authorization Helper (chrome extension)", "main": "index.html", "scripts": { diff --git a/scripts.ts b/scripts.ts index cf15b6b..f72e594 100644 --- a/scripts.ts +++ b/scripts.ts @@ -2,7 +2,7 @@ class CookieCache { private cookies: Record> = {}; public AddCookie(cookie: chrome.cookies.Cookie): void { const domain = cookie.domain; - console.log(domain); + // console.log(domain); if (!this.cookies[domain]) { this.cookies[domain] = []; } @@ -55,7 +55,7 @@ function bindLogout() { }); [...new Set(mindsphereInstances)].forEach((domain, index) => { - console.log(domain, index); + // console.log(domain, index); logoutDiv.innerHTML += mustache(template, { index, domain, @@ -90,17 +90,15 @@ function bindList() { const cookies = cache.GetCookie(domain); const sessionCookie = cookies.filter((x) => x.name === "SESSION")[0]; - const session = sessionCookie?.value || ""; const sessionShort = `${session.substr(0, 15)}...`; - let color = "accentBlueDark"; - const now = new Date().getTime(); - - color = sessionCookie.expirationDate < now ? "accentBlueDark" : "accentRedDark"; - color = sessionCookie.expirationDate + 5 * 60 * 60 < now ? "accentYellowDark" : color; const xsrftokenCookie = cookies.filter((x) => x.name === "XSRF-TOKEN")[0]; const xsrftoken = xsrftokenCookie?.value || ""; const xsrftokenShort = `${xsrftoken.substr(0, 15)}...`; + + if (session === "" || xsrftoken === "") { + return; + } const cmd = btoa( `set "MDSP_HOST=${domain}" & set "MDSP_SESSION=${session}" & set "MDSP_XSRF_TOKEN=${xsrftoken}"` ); @@ -111,6 +109,7 @@ function bindList() { `$Env:MDSP_HOST="${domain}"; $Env:MDSP_SESSION="${session}"; $Env:MDSP_XSRF_TOKEN="${xsrftoken}"` ); + const color = "accentBlueDark"; const sessionraw = btoa(`${session}`); const xsrftokenraw = btoa(`${xsrftoken}`); diff --git a/vendor/assets/images/emptyStateSimple.svg b/vendor/assets/images/emptyStateSimple.svg new file mode 100644 index 0000000..ac5feec --- /dev/null +++ b/vendor/assets/images/emptyStateSimple.svg @@ -0,0 +1 @@ + \ No newline at end of file