aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorjahoti <jahoti@tilde.team>2021-07-04 00:00:00 +0000
committerjahoti <jahoti@tilde.team>2021-07-04 00:00:00 +0000
commit2059fab6c01a0793e8a82f80d9518ed2bd6d1e29 (patch)
tree2785bcac60568bb6d9ff68b959c6735baf76ea81 /build.sh
parentd0ae39390fba3822aed4a498aafcdfa61289448b (diff)
downloadbrowser-extension-2059fab6c01a0793e8a82f80d9518ed2bd6d1e29.tar.gz
browser-extension-2059fab6c01a0793e8a82f80d9518ed2bd6d1e29.zip
Revamp default settings
Default settings are now provided in the same format as data exported from the extension, incorporating them into the main program as part of the build process. Also, modify their contents; the apparently non-functional FSF stuff is gone, replaced with fixes for BandCamp, WorldCat, and SumOfUs.
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index 9fe81c3..f38b5e0 100755
--- a/build.sh
+++ b/build.sh
@@ -271,7 +271,17 @@ s^_CONTENTSCRIPTS_^$CONTENTSCRIPTS^" \
(() => {
$(map_get IMPORTCODES $FILEKEY)
-"; cat $FILE; echo "
+";
+
+# A hack to insert the contents of default_settings.json at the appropriate location in background/main.js
+if [ "$FILE" = "background/main.js" ]; then
+ # Uses an internal sed expression to escape and indent the JSON file for use in the external sed expression
+ sed 's/^ `DEFAULT SETTINGS`$/'"$(sed -E 's/([\\\&\/])/\\\1/g; s/^/ /; s/$/\\/' < default_settings.json) "/g < "$FILE"
+else
+ cat $FILE
+fi
+
+echo "
$(map_get EXPORTCODES $FILEKEY)
})();") > $BUILDDIR/$FILE