diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-02-25 13:58:04 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-02-25 13:58:04 +0100 |
commit | 098e5e504a8383eaff41153d47b3f52e8ac98e90 (patch) | |
tree | 4d6a4de92ddbe6109c2801008ef99be8139da21e | |
parent | 194f23f4d8a874505a5959671dac8a1b9d2c0704 (diff) | |
download | browser-extension-098e5e504a8383eaff41153d47b3f52e8ac98e90.tar.gz browser-extension-098e5e504a8383eaff41153d47b3f52e8ac98e90.zip |
remove unused shell_utils, update upload_amo.sh to still workv1.0-beta1
Even though upload_amo.sh scripts for extension signing is included, we're currently unable to use it because Firefox API keys needed for that require execution of nonfree JS and Jahoti's Mozoid tool is no longer working <https://hydrillabugs.koszko.org/issues/111>
-rw-r--r-- | shell_utils.sh | 53 | ||||
-rwxr-xr-x | upload_amo.sh | 21 |
2 files changed, 21 insertions, 53 deletions
diff --git a/shell_utils.sh b/shell_utils.sh deleted file mode 100644 index 51361f5..0000000 --- a/shell_utils.sh +++ /dev/null @@ -1,53 +0,0 @@ -# This file is part of Haketilo -# -# Copyright (C) 2021, Wojtek Kosior -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the CC0 1.0 Universal License as published by -# the Creative Commons Corporation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# CC0 1.0 Universal License for more details. - -map_set_instr() { - printf "%s__%s='%s'" "$1" "$2" "$3" -} - -map_set() { - eval "$(map_set_instr "$@")" -} - -map_set_export() { - eval "export $(map_set_instr "$@")" -} - -map_get() { - eval "printf %s \"\$$1__$2\"" -} - -map_del_instr() { - printf 'unset %s__%s' "$1" "$2" -} - -map_del() { - eval "$(map_del_instr "$@")" -} - -sanitize() { - printf %s "$1" | tr /.- _ -} - -escape_regex_special() { - printf %s "$1" | sed 's/\([]\.*?{},()[-]\)/\\\1/g' -} - -# Note: We don't actually parse JSON. We extract needed keys with sed regexes -# which does not work in the general case but is sufficient for now. -get_json_key() { - local KEY_REG="$(escape_regex_special "$1")" - printf %s "$2" | - sed 's/\(.*"'"$KEY_REG"'"[[:space:]]*:[[:space:]]*"\([^"]*\)"\)\?.*/\2/' | - grep . | head -1 -} diff --git a/upload_amo.sh b/upload_amo.sh index 71e12ca..3739c9c 100755 --- a/upload_amo.sh +++ b/upload_amo.sh @@ -23,6 +23,27 @@ API_KEY="$2" SECRET="$3" XPI_PATH="$4" +escape_regex_special() { + printf %s "$1" | sed 's/\([]\.*[-]\)/\\\1/g' +} + +# Note: We don't actually parse JSON. We extract needed keys with sed regexes +# which does not work in the general case but is sufficient for now. +_get_json_key() { + local KEY_REG="$(escape_regex_special "$1")" + printf %s "$2" | + awk '{printf "%s", $0}' | + sed 's/^.*\("'"$KEY_REG"'"[[:space:]]*:[[:space:]]*"\([^"]*\)"\).*$/\2/' +} + +get_json_key() { + local JSON="$2" + local VALUE="$(_get_json_key "$@")" + if [ "x$VALUE" != "x$JSON" ]; then + printf %s "$VALUE" + fi +} + base64url() { printf %s "$1" | base64 -w 0 | tr '/+' '_-' | tr -d '=' } |