build webextension mappings from online file

This commit is contained in:
overdodactyl 2018-04-14 13:42:02 -06:00
parent b2d8d84370
commit b7c53aa54f
1 changed files with 15 additions and 24 deletions

View File

@ -2,39 +2,30 @@
### UUID finder for Mac ### UUID finder for Mac
## author: @overdodactyl ## author: @overdodactyl
## version: 1.0 ## version: 1.1
declare -A styled=( ["brief@mozdev.org"]="brief" ## Get current mappings from online repo
["CookieAutoDelete@kennydo.com"]="cookie_autodelete" webextension_mappings="https://raw.githubusercontent.com/overdodactyl/ShadowFox/master/scripts/webextension_mappings.txt"
["{174b2d58-b983-4501-ab4b-07e71203cb43}"]="dark_mode" web_ex=$(curl -s ${webextension_mappings})
["jid1-BoFifL9Vbdl2zQ@jetpack"]="decentraleyes"
["@testpilot-containers"]="multi_account_containers"
["https-everywhere@eff.org"]="https_everywhere"
["multipletab@piro.sakura.ne.jp"]="multiple_tab_handler"
["neaturl@hugsmile.eu"]="neat_url"
["{73a6fe31-595d-460b-a920-fcc0f8843232}"]="noscript"
["{1b1e6108-2d88-4f0f-a338-01f9dbcccd6f}"]="request_control"
["skipredirect@sblask"]="skip_redirect"
["{b3e677f4-1150-4387-8629-da738260a48e}"]="smart_https"
["{e225ac78-5e83-484b-a16b-b6ed0924212f}"]="tab_suspender"
["treestyletab@piro.sakura.ne.jp"]="tree_style_tab"
["tridactyl.vim@cmcaine.co.uk"]="tridactyl"
["uBlock0@raymondhill.net"]="ublock_origin"
["uBO-Scope@raymondhill.net"]="ubo_scope"
["uMatrix@raymondhill.net"]="umatrix"
["vim-vixen@i-beam.org"]="vim_vixen"
["{aecec67f-0d10-4fa7-b7c7-609a2db280cf}"]="violentmonkey"
["smart-referer@meh.paranoid.pk"]="smart_referer"
)
## declare directory
declare -A styled=()
## Generate dictionaries from file
while IFS="|" read -r webex_name webex_id; do
styled["$webex_id"]+="$webex_name"
done <"webextensions.txt"
## Get installed extesnsions from prefs.js
line=$(sed -n -e 's/^user_pref("extensions.webextensions.uuids", "{\(.*\).*}");/\1/p' ../prefs.js) line=$(sed -n -e 's/^user_pref("extensions.webextensions.uuids", "{\(.*\).*}");/\1/p' ../prefs.js)
## Write to internal_UUIDs
IFS=',' read -ra EXTS <<< "$line" IFS=',' read -ra EXTS <<< "$line"
for i in "${EXTS[@]}"; do for i in "${EXTS[@]}"; do
id=$(echo $i | sed -n 's/.*"\(.*\)\\":.*/\1/p') id=$(echo $i | sed -n 's/.*"\(.*\)\\":.*/\1/p')
uuid=$(echo $i | sed -n 's/.*"\(.*\)\\".*/\1/p') uuid=$(echo $i | sed -n 's/.*"\(.*\)\\".*/\1/p')
if [[ -n "${styled[$id]}" ]] if [[ -n "${styled[$id]}" ]]
then then
echo "${styled[$id]}_UUID=$uuid" >> 'ShadowFox_customization/internal_UUIDs.txt' echo "${styled[$id]}_UUID=$uuid" >> 'ShadowFox_customization/internal_UUIDs.txt'
fi; fi;
done done