aboutsummaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorOmar Rizwan <omar.rizwan@gmail.com>2020-10-29 23:54:40 -0700
committerOmar Rizwan <omar.rizwan@gmail.com>2020-10-29 23:54:40 -0700
commit140bd127dfc379955f28e3477909a65b25e0f928 (patch)
treeef75e137b066d65d37279bb00f2de0b1bf904a17 /install.sh
parentf576b4c324d3c9a9a4fe2fc9ef60dc34427df1bc (diff)
Specify extension id in install.sh & check usage. Improve README.
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/install.sh b/install.sh
index aa13668..04d96e4 100755
--- a/install.sh
+++ b/install.sh
@@ -1,7 +1,14 @@
#!/bin/bash -eux
+if [[ ! ( ( "$1" == "firefox" && "$#" -eq 1 ) ||
+ ( "$1" == "chrome" && "$#" -eq 2 && ${#2} -eq 32) ||
+ ( "$1" == "chromium" && "$#" -eq 2 && ${#2} -eq 32) ) ]]; then
+ echo "Usage: $0 <chrome EXTENSION_ID | chromium EXTENSION_ID | firefox>"
+ exit 2
+fi
+
OS="$(uname -s)"
-BROWSER="$(echo ${1:-chrome} | tr '[:upper:]' '[:lower:]')"
+BROWSER="$(echo $1 | tr '[:upper:]' '[:lower:]')"
# https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#Manifest_location
# https://developer.chrome.com/extensions/nativeMessaging#native-messaging-host-location
@@ -27,6 +34,7 @@ EXE_PATH=$(pwd)/fs/tabfs
case "$BROWSER" in
chrome | chromium)
+ EXTENSION_ID=$2
MANIFEST=$(cat <<EOF
{
"name": "$APP_NAME",
@@ -34,7 +42,7 @@ case "$BROWSER" in
"path": "$EXE_PATH",
"type": "stdio",
"allowed_extensions": ["tabfs@rsnous.com"],
- "allowed_origins": ["chrome-extension://jimpolemfaeckpjijgapgkmolankohgj/"]
+ "allowed_origins": ["chrome-extension://$EXTENSION_ID/"]
}
EOF
);;