diff --git a/azure-pipelines.yml b/.azure-devops/azure-pipelines.devel-build.yml similarity index 94% rename from azure-pipelines.yml rename to .azure-devops/azure-pipelines.devel-build.yml index ee0170b..351b831 100644 --- a/azure-pipelines.yml +++ b/.azure-devops/azure-pipelines.devel-build.yml @@ -5,6 +5,7 @@ trigger: - main +- devel variables: YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn @@ -32,5 +33,4 @@ steps: yarn displayName: 'Install NPM Packages' - script: | - GH_TOKEN=$(GH_TOKEN) yarn dist -m -w -l - \ No newline at end of file + GH_TOKEN=$(GH_TOKEN) yarn compile diff --git a/azure-pipelines.release-build.yml b/.azure-devops/azure-pipelines.release-build.yml similarity index 100% rename from azure-pipelines.release-build.yml rename to .azure-devops/azure-pipelines.release-build.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 64f7c5b..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2.1 - -orbs: - python: circleci/python@0.2.1 - aws-cli: circleci/aws-cli@1.0.0 - node: circleci/node@4.7.0 - -jobs: - checkout: - docker: - - image: node:14 - steps: - - checkout - - node/install: - install-yarn: true - - run: yarn - - run: yarn dist - - -workflows: - main: - jobs: - - checkout \ No newline at end of file diff --git a/build/icon.icns b/build/icon.icns new file mode 100644 index 0000000..0cbf123 Binary files /dev/null and b/build/icon.icns differ diff --git a/build/icon.ico b/build/icon.ico new file mode 100644 index 0000000..cc7f5ce Binary files /dev/null and b/build/icon.ico differ diff --git a/build/icon.png b/build/icon.png new file mode 100644 index 0000000..61181ab Binary files /dev/null and b/build/icon.png differ diff --git a/package.json b/package.json index 2e01377..fa42d42 100644 --- a/package.json +++ b/package.json @@ -13,14 +13,15 @@ }, "electronWebpack": { "renderer": { - "template": "src/renderer/index.html" + "template": "src/renderer/index.html", + "webpackConfig": "webpack.renderer.additions.js" } }, "dependencies": { "source-map-support": "0.5.19" }, "devDependencies": { - "copy-webpack-plugin": "^9.0.1", + "copy-webpack-plugin": "6.3.2", "electron": "^13.1.8", "electron-builder": "^22.10.5", "electron-webpack": "^2.8.2", diff --git a/src/main/services/identity-provider-session.ts b/src/main/services/identity-provider-session.ts index 9cddc40..c73de14 100644 --- a/src/main/services/identity-provider-session.ts +++ b/src/main/services/identity-provider-session.ts @@ -35,10 +35,16 @@ export class IdentityProviderSession { return await this._extractCookies(loginWindow.browserWindow); } + + public applyLastCookieSet(cookies: Cookie[]) { + this._cookies.splice(0, this._cookies.length); + + this._cookies.push(...cookies); + } //#endregion //#region Private Methods - async _extractCookies(window: BrowserWindow) { + private async _extractCookies(window: BrowserWindow) { const cookies = await window.webContents.session.cookies.get({}); const idpCookies = cookies.filter(x => this._idpChecks.some(regex => regex.test(x.domain || ''))); this._cookies.push(...idpCookies); diff --git a/src/main/window/start-page.window.ts b/src/main/window/start-page.window.ts index dc04f0b..11a7a21 100644 --- a/src/main/window/start-page.window.ts +++ b/src/main/window/start-page.window.ts @@ -46,6 +46,7 @@ export class StartPageWindow extends BaseWindow { } this.browserWindow.webContents.send('login-succeeded', true); + this.browserWindow.webContents.send('saveCookies', this._identityProviderSession.cookies); } @ipcMainTarget() @@ -64,6 +65,13 @@ export class StartPageWindow extends BaseWindow { this._awsConsoleConfiguration.favoriteServices = favoriteServices; } + @ipcMainTarget() + public async applyPersistedCookies(cookies: Cookie[]): Promise { + console.log(`Applied ${cookies.length} cookies from last session`); + this._identityProviderSession.applyLastCookieSet(cookies); + this.browserWindow.webContents.send('login-succeeded', true); + } + @ipcMainTarget() public async chooseFavoriteServices(baseUrl: string): Promise { const awsEnvironmentWindow = new AwsEnvironmentWindow( diff --git a/src/renderer/assets/pro-tip.png b/src/renderer/assets/pro-tip.png new file mode 100644 index 0000000..3c85699 Binary files /dev/null and b/src/renderer/assets/pro-tip.png differ diff --git a/src/renderer/index.html b/src/renderer/index.html index fb7a64a..ba183e9 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -45,6 +45,10 @@ box-shadow: 0 0 0 1px #00a1c9; } + .pro-tip { + max-width: 50%; + margin: 0 auto; + } body { background: whitesmoke; @@ -74,6 +78,18 @@ border-color: transparent; } + pre { + display: inline-block; + margin: 0; + line-height: 1; + vertical-align: middle; + border: 1px #ccc solid; + padding: 5px; + border-radius: 3px; + margin: 0 5px; + color: #fb8d59; + } + .btn { transition: none; border-radius: 2px; @@ -180,6 +196,25 @@
Favorite Services!
+
+
+
+
+
Pro Tip!
+
+
+
You are using a Mac System? You can enable tabbed windows and set them as default, to have all environments attached to this window as tabs.
+
Just visit
Mac OS System Preferences
>
General
+
And set
Prefer Tabs
to
Always
+
+ +
+ +
+
+
+
+
\ No newline at end of file diff --git a/src/renderer/index.js b/src/renderer/index.js index fcc65bb..b08f265 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -20,6 +20,10 @@ const { ipcRenderer } = require('electron'); ipcRenderer.send('openAwsEnvironment', baseUrl) } + function applyPersistedCookies(cookies) { + ipcRenderer.send('applyPersistedCookies', cookies) + } + function chooseFavoriteServices(baseUrl) { ipcRenderer.send('chooseFavoriteServices', baseUrl) } @@ -60,8 +64,18 @@ const { ipcRenderer } = require('electron'); favoritesList = favoritesList || []; } + function loadPersistedCookies() { + const persistedCookies = localStorage.getItem('loginCookies'); + if (!persistedCookies) { + return; + } + + applyPersistedCookies(JSON.parse(persistedCookies)); + } + function main() { loadPersistedFavoritesList(updateFavoritesList); + loadPersistedCookies(); const baseUrl = document.getElementById('awsSsoBaseUrl'); baseUrl.value = localStorage.getItem('awsSsoBaseUrl'); @@ -96,6 +110,10 @@ const { ipcRenderer } = require('electron'); alert.remove(); }); + + ipcRenderer.on('saveCookies', (event, cookies) => { + localStorage.setItem('loginCookies', JSON.stringify(cookies.map(x => ({ ...x })))); + }) } main(); diff --git a/webpack.config.js b/webpack.renderer.additions.js similarity index 51% rename from webpack.config.js rename to webpack.renderer.additions.js index 0aa1234..f0bca5b 100644 --- a/webpack.config.js +++ b/webpack.renderer.additions.js @@ -1,15 +1,18 @@ const CopyPlugin = require("copy-webpack-plugin"); module.exports = { - target: "electron-main", - entry: { - main: "./src/main/index.js" + module: { + rules: [{ + test: /\.png$/, + use: 'raw-loader' + }], + }, plugins: [ new CopyPlugin({ patterns: [ - { from: "./src/main/index.html", to: "./index.html" }, + { from: "./src/renderer/assets", to: "./assets/" }, ], }) ] -}; \ No newline at end of file +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 94af38b..846c12b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -968,6 +968,14 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@npmcli/move-file@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-1.1.2.tgz#1a82c3e372f7cae9253eb66d72543d6b8685c674" + integrity sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg== + dependencies: + mkdirp "^1.0.4" + rimraf "^3.0.2" + "@sindresorhus/is@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" @@ -1956,6 +1964,29 @@ cacache@^13.0.1: ssri "^7.0.0" unique-filename "^1.1.1" +cacache@^15.0.5: + version "15.2.0" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.2.0.tgz#73af75f77c58e72d8c630a7a2858cb18ef523389" + integrity sha512-uKoJSHmnrqXgthDFx/IU6ED/5xd+NNGe+Bb+kLZy7Ku4P+BaiWEUflAKPZ7eAzsYGcsAGASJZsybXp+quEcHTw== + dependencies: + "@npmcli/move-file" "^1.0.1" + chownr "^2.0.0" + fs-minipass "^2.0.0" + glob "^7.1.4" + infer-owner "^1.0.4" + lru-cache "^6.0.0" + minipass "^3.1.1" + minipass-collect "^1.0.2" + minipass-flush "^1.0.5" + minipass-pipeline "^1.2.2" + mkdirp "^1.0.3" + p-map "^4.0.0" + promise-inflight "^1.0.1" + rimraf "^3.0.2" + ssri "^8.0.1" + tar "^6.0.2" + unique-filename "^1.1.1" + cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" @@ -2071,6 +2102,11 @@ chownr@^1.1.1, chownr@^1.1.2: resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== +chownr@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" + integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== + chrome-trace-event@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" @@ -2358,18 +2394,22 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -copy-webpack-plugin@^9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-9.0.1.tgz#b71d21991599f61a4ee00ba79087b8ba279bbb59" - integrity sha512-14gHKKdYIxF84jCEgPgYXCPpldbwpxxLbCmA7LReY7gvbaT555DgeBWBgBZM116tv/fO6RRJrsivBqRyRlukhw== +copy-webpack-plugin@6.3.2: + version "6.3.2" + resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-6.3.2.tgz#0e920a6c181a5052aa6e2861b164bda03f83afeb" + integrity sha512-MgJ1uouLIbDg4ST1GzqrGQyKoXY5iPqi6fghFqarijam7FQcBa/r6Rg0VkoIuzx75Xq8iAMghyOueMkWUQ5OaA== dependencies: - fast-glob "^3.2.5" - glob-parent "^6.0.0" - globby "^11.0.3" + cacache "^15.0.5" + fast-glob "^3.2.4" + find-cache-dir "^3.3.1" + glob-parent "^5.1.1" + globby "^11.0.1" + loader-utils "^2.0.0" normalize-path "^3.0.0" - p-limit "^3.1.0" + p-limit "^3.0.2" schema-utils "^3.0.0" - serialize-javascript "^6.0.0" + serialize-javascript "^5.0.1" + webpack-sources "^1.4.3" core-js-compat@^3.14.0, core-js-compat@^3.16.0: version "3.16.1" @@ -3274,7 +3314,7 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.1.1, fast-glob@^3.2.5: +fast-glob@^3.1.1, fast-glob@^3.2.4: version "3.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== @@ -3579,20 +3619,13 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob-parent@^5.1.2, glob-parent@~5.1.2: +glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" -glob-parent@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.1.tgz#42054f685eb6a44e7a7d189a96efa40a54971aa7" - integrity sha512-kEVjS71mQazDBHKcsq4E9u/vUzaLcw1A8EtUeydawvIWQCJM0qQ08G1H7/XTjFUulla6XQiDOG6MXSaG0HDKog== - dependencies: - is-glob "^4.0.1" - glob@^7.0.3, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.7" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" @@ -3683,7 +3716,7 @@ globalthis@^1.0.1: dependencies: define-properties "^1.1.3" -globby@^11.0.3: +globby@^11.0.1: version "11.0.4" resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg== @@ -4913,6 +4946,14 @@ minipass@^3.0.0, minipass@^3.1.1: dependencies: yallist "^4.0.0" +minizlib@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" + integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== + dependencies: + minipass "^3.0.0" + yallist "^4.0.0" + mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" @@ -4944,6 +4985,11 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.4, mkdirp@^0.5.5: dependencies: minimist "^1.2.5" +mkdirp@^1.0.3, mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -5257,7 +5303,7 @@ p-limit@^2.0.0, p-limit@^2.2.0, p-limit@^2.3.0: dependencies: p-try "^2.0.0" -p-limit@^3.1.0: +p-limit@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== @@ -5290,6 +5336,13 @@ p-map@^3.0.0: dependencies: aggregate-error "^3.0.0" +p-map@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" + integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== + dependencies: + aggregate-error "^3.0.0" + p-retry@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-3.0.1.tgz#316b4c8893e2c8dc1cfa891f406c4b422bebf328" @@ -6008,7 +6061,7 @@ rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.3, rimraf@^2.7.1: dependencies: glob "^7.1.3" -rimraf@^3.0.0: +rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== @@ -6189,10 +6242,10 @@ serialize-javascript@^4.0.0: dependencies: randombytes "^2.1.0" -serialize-javascript@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== +serialize-javascript@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== dependencies: randombytes "^2.1.0" @@ -6469,6 +6522,13 @@ ssri@^7.0.0: figgy-pudding "^3.5.1" minipass "^3.1.1" +ssri@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/ssri/-/ssri-8.0.1.tgz#638e4e439e2ffbd2cd289776d5ca457c4f51a2af" + integrity sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ== + dependencies: + minipass "^3.1.1" + stat-mode@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stat-mode/-/stat-mode-1.0.0.tgz#68b55cb61ea639ff57136f36b216a291800d1465" @@ -6664,6 +6724,18 @@ tapable@^2.0.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.0.tgz#5c373d281d9c672848213d0e037d1c4165ab426b" integrity sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw== +tar@^6.0.2: + version "6.1.8" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.8.tgz#4fc50cfe56511c538ce15b71e05eebe66530cbd4" + integrity sha512-sb9b0cp855NbkMJcskdSYA7b11Q8JsX4qe4pyUAfHp+Y6jBjJeek2ZVlwEfWayshEIwlIzXx0Fain3QG9JPm2A== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^3.0.0" + minizlib "^2.1.1" + mkdirp "^1.0.3" + yallist "^4.0.0" + temp-file@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/temp-file/-/temp-file-3.4.0.tgz#766ea28911c683996c248ef1a20eea04d51652c7"