#!/bin/bash declare -r CHROME_DIR="${HOME}/.chromeDevTemp" # NB: Creating the directory first seems to block process start. # Perhaps this is the wrong chmod ownership flags. #mkdir -p $CHROME_DIR launch_linux() { chromium \ --disable-web-security \ --ignore-certificate-errors \ --user-data-dir="${CHROME_DIR}" \ https://dev.fakeyou.com } launch_mac() { # See https://stackoverflow.com/a/58658101 # NB: '7001' port is being chosen because something on the system is hogging port 7000. # chrome://flags/#unsafely-treat-insecure-origin-as-secure - allow microphone recording # otherwise getUserMedia() / navigator.mediaDevices will not function open -na "Google Chrome" --args \ --disable-site-isolation-trials \ --disable-web-security \ --ignore-certificate-errors \ --unsafely-treat-insecure-origin-as-secure="http://dev.fakeyou.com:7001" \ --user-data-dir="${CHROME_DIR}" \ http://dev.fakeyou.com:7001 } case $OSTYPE in linux*) launch_linux ;; darwin*) launch_mac ;; *) echo "Unknown OS" ;; esac