#!/bin/bash
# Fixes broken Google-based Franz recipes by changing user-agent per recipe
# "This browser or app may not be secure. Learn more. Try using a different browser"
FRANZ_OR_FERDI=Ferdi
MAC_OSX_PATH="$HOME/Library/Application Support/$FRANZ_OR_FERDI/recipes"
find "$MAC_OSX_PATH" -type d \( \
-name "hangouts" -o \
-name "hangoutschat" -o \
-name "gmail" -o \
-name "googlecalendar" -o \
-name "ex-google-voice" -o \
-name "googlekeep" \) \
-exec sh -c 'echo "module.exports = Franz =>\n  class F extends Franz {\n    overrideUserAgent() {\n      return \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0\";\n    }\n  };\n" > "$1"/index.js' sh {} \;
