commit 88951c8e39cb39b5d66ad3927ed650986f097e16 Author: ammaratef45 Date: Mon Sep 8 15:18:37 2025 +0000 Add forcessl.sh diff --git a/forcessl.sh b/forcessl.sh new file mode 100644 index 0000000..38801d9 --- /dev/null +++ b/forcessl.sh @@ -0,0 +1,31 @@ +#!/bin/zsh + +# set -x +set -e + +dir=~/.abra/recipes +for r in `ls $dir`; do + cd "$dir/$r" + # check if recipe has SSLForceHost label + # skip if it's a commented line + # skip .swp binary file (found in radicale and I don't know what is it for) + if res=$(grep -r "SSLForceHost" . 2>/dev/null \ + | grep -v "#-" | grep -v "# -" \ + | grep -v ".swp"); then + branch=$(git branch --format '%(refname:short)' --list main master | head -n 1) + current_dir="${PWD##*/}" + git checkout $branch + git pull --rebase + yes | git branch -D forceSsl + git checkout -b forceSsl + for file in `echo $res | cut -d ":" -f 1`; do + # I use macos and BSD versions of tools like sed look weird :( + sed -i '' -e "s/headers.SSLForceHost=true/redirectscheme.scheme=https/" $file + sed -i '' -e "s/headers.SSLHost=.*/redirectscheme.permanent=true\"/" $file + done + git add $file + git commit -m "[mass update] fix supporting multiple domains while enforcing ssl" + git push --set-upstream origin forceSsl + echo "https://git.coopcloud.tech/coop-cloud/$current_dir/pulls/new/forceSsl" + fi +done \ No newline at end of file