From 810d9caa321cece30ae686db7d50b87a81e5b5b3 Mon Sep 17 00:00:00 2001 From: muly Date: Sun, 31 Dec 2023 04:12:44 -0500 Subject: [PATCH] client id added to dev deployment manifest file and also some refactor of the code that prepares the chrome extension for local and dev deployment --- Makefile | 2 +- README.md | 19 +++++++++++++++++++ chrome-exten/manifest.json.tmpl | 4 ++-- scripts/dev_mac_chrome_ext.sh | 8 +++----- scripts/local_mac.sh | 2 +- scripts/local_mac_chrome_ext.sh | 5 +---- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 8a6837d..3f7f83c 100644 --- a/Makefile +++ b/Makefile @@ -21,4 +21,4 @@ prepare_chrome_ext_for_local_deployment: ./scripts/local_mac_chrome_ext.sh 1.1.1 prepare_chrome_ext_for_dev_deployment: - ./scripts/dev_mac_chrome_ext.sh 1.1.1 + ./scripts/dev_mac_chrome_ext.sh 1.1.3 diff --git a/README.md b/README.md index 4ab3b68..8846c88 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,25 @@ root cause: unknown. workaround: generate new client id in gcp console and use the new client id in manifest.json file +## chrome extension: manifest file + +**key:** +- for deployment to gcp: +retrieve the correct key from Chrome Developer Dashboard (https://chrome.google.com) -> open the extension page -> Package tab -> click View public key. + +**client_id:** +- for deployment to gcp: + 1. gcp console: https://console.cloud.google.com/ + 1. APIs & Services + 1. Credentials + 1. OAuth 2.0 Client IDs + 1. copy the `Client ID` under `Chrome client (for chrome store deployment)` + +- for deployment to local: + 1. same steps as above except the last step + 1. copy the `Client ID` under `Chrome client (for local deployment)` + + ## privacy policy dev url: https://smuly-test-ground.ue.r.appspot.com/privacy-policy.html diff --git a/chrome-exten/manifest.json.tmpl b/chrome-exten/manifest.json.tmpl index 823f2bb..90d84ab 100644 --- a/chrome-exten/manifest.json.tmpl +++ b/chrome-exten/manifest.json.tmpl @@ -7,7 +7,7 @@ "default_popup": "signin.html", "default_icon":"logo.png" }, - ${KEY} + "key": "${KEY}", "icons":{ "128":"logo.png" }, @@ -18,7 +18,7 @@ "http://localhost:8006/*" ], "oauth2": { - ${CLIENT_ID} + "client_id": "${CLIENT_ID}", "scopes": ["email"] }, "options_page":"./signin.html" diff --git a/scripts/dev_mac_chrome_ext.sh b/scripts/dev_mac_chrome_ext.sh index bab3602..20c86e7 100755 --- a/scripts/dev_mac_chrome_ext.sh +++ b/scripts/dev_mac_chrome_ext.sh @@ -2,10 +2,8 @@ set -x set -e -export CLIENT_ID="" -# retrieve the correct key from Chrome Developer Dashboard (https://chrome.google.com) -> open the extension page -> Package tab -> click View public key. -export KEY='"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApy7O4tuda2CWVXMgu3EFrrs4qv4IXnt2KQJG3KC404aYG1Hb8nvjwVpIqIdHG0QGQUH3nxIIuGnQtbFJxXzEF9bgWsWTNFe5jzrC9wKxVEjA/W50jMKIcqmypZb4Yi4D9oTHxhKvIyaNnxnljXR99f7Y8kZ3aDq5pduUPsubsWS76IvTX/7wog8KEjB2esF0+GmhRElA1e1MEZIn0iujhd1TlPvkFtouLg3PgC7mOV7Sgzb2SfbD36N+G/ImO6f0mn3b85GQXZ+mMcrbhPG9Q9feHgBpZVdkcwmmWfx4DxU/CoXyLu/989VIf79n7GgoeoL03RtIGK0TCWK8HXbM9wIDAQAB",' -export CHROME_EXT_VERSION=$1 - +source ./secrets/dev.sh +export CHROME_EXT_VERSION=$1 envsubst < chrome-exten/manifest.json.tmpl > chrome-exten/manifest.json zip chrome-exten.zip chrome-exten/* + diff --git a/scripts/local_mac.sh b/scripts/local_mac.sh index 381569b..d91ed8b 100755 --- a/scripts/local_mac.sh +++ b/scripts/local_mac.sh @@ -9,7 +9,7 @@ go get ./... go fmt ./... -source ./secrets/gmail_pwd.sh +source ./secrets/local.sh if [[ -z "$GMAIL_PASSWORD" ]]; then echo "Must provide GMAIL_PASSWORD in environment" 1>&2 exit 1 diff --git a/scripts/local_mac_chrome_ext.sh b/scripts/local_mac_chrome_ext.sh index 26a3fcd..35425de 100755 --- a/scripts/local_mac_chrome_ext.sh +++ b/scripts/local_mac_chrome_ext.sh @@ -2,9 +2,6 @@ set -x set -e -export CLIENT_ID='"client_id": "149500152182-1nlfm111isrv0c8828mg3u16q22l434q.apps.googleusercontent.com",' -# retrieve the correct key from where? -export KEY='"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxk66E7tDSLL2ZqxhrAHpJOXRxmwSxCSSyRSzYjgx6B150ZdyGe1lAQWOkMfN4h1aK679mJaNTXRWllvxRNaZ+qNagZoy+96/57H7Au+RnX7U7NPv79jVxNq1fDI/hFp5tVZ1cGS31gNeZewR5cPvsTkekHSNFZv8isUtyDomwsRJrxrvIj1a1sL2O9w70aWcfZ/m8eu2gOWWtzfpOuB6K79DAUHw0xBOJ4pykgfYOfrDeZqrZbEzT0Y5d1kACTdg/h7WrE1KPWe0lUJfs7yvf7wMdjOEORR5Dl9i2DCq4ugHsYWMeQ8KmMSBqrlCLnAWFJ9hxhYCa9UJC6i7PaYncQIDAQAB",' +source ./secrets/local.sh export CHROME_EXT_VERSION=$1 - envsubst < chrome-exten/manifest.json.tmpl > chrome-exten/manifest.json