From b3f4bbe7c34a5e0f21ea205f09f3e04eaafa1413 Mon Sep 17 00:00:00 2001 From: Carlos Quintana Date: Fri, 17 Jun 2022 12:43:30 +0200 Subject: [PATCH 1/3] Add login with proton to extension --- .github/workflows/release.yaml | 7 +++++++ package.json | 1 + scripts/generateBuildConfig.js | 13 +++++++++++++ src/images/proton.svg | 19 +++++++++++++++++++ src/popup/Utils.js | 6 ++++++ src/popup/buildConfig.json | 6 ++++++ src/popup/components/Login.vue | 30 ++++++++++++++++++++++++++++++ 7 files changed, 82 insertions(+) create mode 100644 scripts/generateBuildConfig.js create mode 100644 src/images/proton.svg create mode 100644 src/popup/buildConfig.json diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index fad4514..bad1b9d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -110,6 +110,13 @@ jobs: echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV echo "release version: $RELEASE_VERSION" + - name: Generate buildConfig + shell: bash + env: + ENABLE_LOGIN_WITH_PROTON: false + run: | + npm run generate:buildconfig + - name: Build lite version if: ${{ matrix.variant }} == 'lite' shell: bash diff --git a/package.json b/package.json index fca5e0c..97b6eed 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "build:beta": "cross-env NODE_ENV=production BETA=1 webpack", "build:dev": "cross-env NODE_ENV=development BETA=1 webpack", "build-zip": "node scripts/build-zip.js", + "generate:buildconfig": "node scripts/generateBuildConfig.js", "watch": "npm run build -- --watch", "watch:dev": "cross-env HMR=true npm run build:dev -- --watch", "start": "cross-env HMR=true npm run build:dev -- --watch" diff --git a/scripts/generateBuildConfig.js b/scripts/generateBuildConfig.js new file mode 100644 index 0000000..bead752 --- /dev/null +++ b/scripts/generateBuildConfig.js @@ -0,0 +1,13 @@ +const fs = require('fs'); +const path = require('path'); + +const PATH = path.join(__dirname, '../src', 'popup', 'buildConfig.json'); + +const config = { + features: { + loginWithProtonEnabled: process.env.ENABLE_LOGIN_WITH_PROTON === 'true' + }, + buildTime: new Date().getTime() +}; + +fs.writeFileSync(PATH, JSON.stringify(config, null, 2)); \ No newline at end of file diff --git a/src/images/proton.svg b/src/images/proton.svg new file mode 100644 index 0000000..1236b3f --- /dev/null +++ b/src/images/proton.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/popup/Utils.js b/src/popup/Utils.js index b4e2b94..f283dcc 100644 --- a/src/popup/Utils.js +++ b/src/popup/Utils.js @@ -1,4 +1,6 @@ const browser = require("webextension-polyfill"); +const buildConfig = require("./buildConfig.json"); + let toasted = null; class Utils { @@ -82,6 +84,10 @@ class Utils { static cloneObject(obj) { return JSON.parse(JSON.stringify(obj)); } + + static getBuildConfig() { + return buildConfig; + } } export default Utils; diff --git a/src/popup/buildConfig.json b/src/popup/buildConfig.json new file mode 100644 index 0000000..4516a4e --- /dev/null +++ b/src/popup/buildConfig.json @@ -0,0 +1,6 @@ +{ + "features": { + "loginWithProtonEnabled": false + }, + "buildTime": 1655462531232 +} \ No newline at end of file diff --git a/src/popup/components/Login.vue b/src/popup/components/Login.vue index a9e1f85..24d6100 100644 --- a/src/popup/components/Login.vue +++ b/src/popup/components/Login.vue @@ -48,6 +48,20 @@ Sign in with API Key + + +
+
or
+ + + + Login with Proton + +
@@ -97,6 +111,8 @@ export default { mfaCode: "", isShowMfa: false, apiUrl: "", + loginWithProtonEnabled: + Utils.getBuildConfig().features.loginWithProtonEnabled, }; }, async mounted() { @@ -171,3 +187,17 @@ export default { computed: {}, }; + + From f1f365e48b04de52bfce131af5c202c0c2ad869d Mon Sep 17 00:00:00 2001 From: Carlos Quintana Date: Fri, 17 Jun 2022 13:19:30 +0200 Subject: [PATCH 2/3] UI tweaks --- src/popup/components/Login.vue | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/popup/components/Login.vue b/src/popup/components/Login.vue index 24d6100..ae9212c 100644 --- a/src/popup/components/Login.vue +++ b/src/popup/components/Login.vue @@ -33,22 +33,6 @@ - - -
- -
-
or
@@ -62,6 +46,22 @@ Login with Proton
+ +
+ +
+ +
+ Don't have an account yet? + + Sign Up + +
From a9582503f640dda123da7b07df161baa9d4a16d0 Mon Sep 17 00:00:00 2001 From: Carlos Quintana Date: Fri, 17 Jun 2022 15:25:39 +0200 Subject: [PATCH 3/3] Fix hover color --- src/popup/components/Login.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/popup/components/Login.vue b/src/popup/components/Login.vue index ae9212c..1656d5a 100644 --- a/src/popup/components/Login.vue +++ b/src/popup/components/Login.vue @@ -195,7 +195,7 @@ export default { color: #6d4aff; } .proton-button:hover { - background-color: #6d4aff; + background-color: #1b1340; } .text-gray { color: #868e96;