Skip to content

Commit

Permalink
chore: removed gateway and southgate
Browse files Browse the repository at this point in the history
feat: emptyStateSimple.svg
chore: cleaned up
  • Loading branch information
sn0wcat committed Aug 26, 2020
1 parent 7d439dd commit 6650857
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ <h2 class="emptyState__title">
target="_new"
>opensource.mindsphere.io <i class="fa fa-external-link"></i
></a>
<br />
<a
class="has-color-forced-gray250"
style="text-decoration: none;"
title="chrome web store"
href="https://chrome.google.com/webstore/detail/mindsphere-authentication/licndiiilobojikmhmmcgdbpmnmdeoee"
target="_new"
>v.1.0.3 <i class="fa fa-chrome"></i
></a>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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/*"],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
15 changes: 7 additions & 8 deletions scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class CookieCache {
private cookies: Record<string, Array<chrome.cookies.Cookie>> = {};
public AddCookie(cookie: chrome.cookies.Cookie): void {
const domain = cookie.domain;
console.log(domain);
// console.log(domain);
if (!this.cookies[domain]) {
this.cookies[domain] = [];
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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}"`
);
Expand All @@ -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}`);

Expand Down
1 change: 1 addition & 0 deletions vendor/assets/images/emptyStateSimple.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6650857

Please sign in to comment.