Skip to content

Commit

Permalink
feat: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sn0wcat committed Jun 28, 2020
0 parents commit 414bc6e
Show file tree
Hide file tree
Showing 57 changed files with 12,368 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"es2020": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 11
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["dist/*"]
}
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

#Ignores for Typescript and wwwroot project
node_modules
typings

# js stuff (we use typescript)
*.js
*.map
*.d.ts

# dist folder
dist/

*.zip
*.tgz

4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 100,
"singleQuote": false
}
27 changes: 27 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"protocol": "inspector",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${workspaceRoot}/test"
],
"internalConsoleOptions": "openOnSessionStart",
"env": {
"DEBUG": "*,-not_this"
}
}
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/*.js": {
"when": "$(basename).ts"
},
"**/*.js.map": {
"when": "$(basename)"
},
"**/*.d.ts": {
"when": "$(basename).ts"
}
},
"typescript.tsdk": "./node_modules/typescript/lib"
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# MindSphere Authorization Helper Chrome Extension

## Simplify MindSphere Authentication During Development
46 changes: 46 additions & 0 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/** @format */

#_mdspcontent {
margin-top: 25px;
font-size: 21px;
text-align: center;
animation: fadein 2s;
-moz-animation: fadein 2s; /* Firefox */
-webkit-animation: fadein 2s; /* Safari and Chrome */
-o-animation: fadein 2s; /* Opera */
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-moz-keyframes fadein {
/* Firefox */
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes fadein {
/* Safari and Chrome */
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-o-keyframes fadein {
/* Opera */
from {
opacity: 0;
}
to {
opacity: 1;
}
}
Binary file added assets/images/authentication-helper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logo-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logo-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logo-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logo-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/logo-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist.crx
Binary file not shown.
183 changes: 183 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<!-- @format -->

<html>
<head>
<meta charset="UTF-8" />
<link
href="https://static.eu1.mindsphere.io/mdsp-css/v1.3.0/css/mdsp-css.min.css"
rel="stylesheet"
/>
<link
href="https://static.eu1.mindsphere.io/osbar/v4/css/mdspstyles.4.9.1.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="assets/css/styles.css" />
<link rel="stylesheet" href="vendor/font-awesome-4.7.0/css/font-awesome.min.css" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>MindSphere Authorization Helper</title>

<template id="listItem">
<li class="list__item">
<div class="item__content">
<div
class="content__column content__column--primary has-default-width-20 xs-100 sm-66 md-33 lg-20 xl-20"
>
<p title="HOST" class="item__title">
{{domain}}
<a href="https://{{domain}}" title="Reload Application" target="_new">
<i class="fa fa-external-link has-color-accentBlueDark"></i>
</a>
</p>
<p
data="{{session}}"
title="SESSION (Click to Show)"
class="item__title has-color-contextBlue600"
style="cursor: pointer;"
>
{{sessionShort}}
</p>
<p
data="{{xsrftoken}}"
title="XSRF-TOKEN (Click to Show)"
class="item__title has-color-forced-contextGreen600"
style="cursor: pointer;"
>
{{xsrftokenShort}}
</p>
<div class="item__description">
<button
data="{{linux}}"
class="button--primary"
title="Copy Environment Variables for Bash to Clipboard"
>
<i class="fa fa-clipboard has-color-forced-accentBlueDark"></i> Bash
</button>
<button
data="{{cmd}}"
class="button--primary"
title="Copy Environment Variables for CMD to Clipboard"
>
<i class="fa fa-clipboard has-color-accentRedDark"></i> CMD
</button>

<button
data="{{ps}}"
class="button--primary"
title="Copy Environment Variables for PowerShell to Clipboard"
>
<i class="fa fa-clipboard has-color-accentYellowDark"></i> PS
</button>
<button
data="{{sessionraw}}"
class="button--primary"
title="Copy SESSION Cookie to Clipboard"
>
<i class="fa fa-clipboard has-color-contextBlue600"> </i> Session
</button>
<button
data="{{xsrftokenraw}}"
class="button--primary"
title="Copy XSRF-TOKEN Cookie to Clipboard"
>
<i class="fa fa-clipboard has-color-contextGreen600"> </i> Xsrf
</button>
</div>
</div>
</div>
</li>
</template>
</head>

<body>
<osbar-root id="_mdspbar" ng-version="6.0.6">
<mdsp-home-link
><a href="#">
<img
src="assets/images/authentication-helper.png"
style="height: 24px; margin: 6px;"
/> </a
></mdsp-home-link>
<div
data-mdsp-e2e="osbar_dropdownWrapper"
class="_mdsp-dropdownWrapper _mdsp-tenantInfo text"
>
<a data-mdsp-e2e="osbar_dropdownLinkEnabled"
><span class="dropdown-link-enabled">MindSphere Cookies&nbsp;</span></a
>
</div>

<div id="_mdsp-filler"></div>
<mdsp-operator-type>
<div id="_mdsp-operatorType">
<div class="_mdsp-operatorType__innerWrap">
auth
</div>
</div>
</mdsp-operator-type>
</osbar-root>

<div
class="mdsp mdsp-defaults"
id="_mdspcontent"
style="
min-width: 500px;
min-height: 500px;
margin-left: 10px;
margin-right: 10px;
text-align: left;
"
>
<div class="emptyState">
<div class="emptyState__visual">
<i class="fa fa-certificate fa-2x"></i>
</div>

<h2 class="emptyState__title">
You don't have any MindSphere Cookies
</h2>
<div class="emptyState__description">
Please login to your tenant to start borrowing cookies for the development tools.
</div>
</div>
<div class="list" style="text-align: left !important;">
<ul class="list__list" id="cookieList"></ul>
</div>
<div
class="has-color-forced-gray400"
style="margin-top: 5px; font-size: 14px; text-align: right;"
>
<p>
treat the authentication cookies like your credentials<br />and use them only in secure
environments
</p>
<a
class="has-color-forced-gray250"
style="text-decoration: none;"
title="License"
href="https://opensource.mindsphere.io/docs/mindsphere-auth-helper/LICENSE.html"
target="_new"
>
License (MIT) <i class="fa fa-legal"></i
></a>
<a
class="has-color-forced-gray250"
style="text-decoration: none;"
title="Source Code"
href="https://github.com/mindsphere-auth-helper/index.html"
target="_new"
>github <i class="fa fa-github"></i
></a>
<a
class="has-color-forced-gray250"
style="text-decoration: none;"
title="Documentation"
href="https://opensource.mindsphere.io/docs/mindsphere-auth-helper/index.html"
target="_new"
>opensource.mindsphere.io <i class="fa fa-external-link"></i
></a>
</div>
</div>

<script type="module" src="./scripts.js" type="text/javascript"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "MindSphere Authentication Helper Extension",
"version": "1.0.0",
"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/*"],
"icons": {
"16": "assets/images/logo-16.png",
"32": "assets/images/logo-32.png",
"48": "assets/images/logo-48.png",
"128": "assets/images/logo-128.png"
},
"background": {},
"browser_action": {
"default_popup": "index.html",
"default_icon": {
"16": "assets/images/logo-16.png",
"32": "assets/images/logo-32.png",
"48": "assets/images/logo-48.png",
"128": "assets/images/logo-128.png"
}
},
"content_security_policy": "script-src 'self' https://static.eu1.mindsphere.io; object-src 'self'",
"manifest_version": 2
}
Loading

0 comments on commit 414bc6e

Please sign in to comment.