Files
artcraft/scripts/launch_dev_browser.sh
T
Brandon Thomas fd8452aa5a Make sure gatsby doesn't harm the website dependencies
There will be additional work required to change the build scripts and
invoke Gatsby builds, but this will keep the two hermetically disjoint
and perhaps allow us to introduce the engine and library code in the
near future.
2024-07-29 08:53:13 -04:00

69 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
declare -r entropy=$(xxd -l16 -ps /dev/urandom)
#declare -r CHROME_DIR="${HOME}/.chromeDevTemp"
declare -r chrome_dir="/tmp/chrome/${entropy}"
# See flags available and documentation:
# https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/common/chrome_switches.cc
# https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
# https://peter.sh/experiments/chromium-command-line-switches/
# NB: Creating the directory first seems to block process start.
# Perhaps this is the wrong chmod ownership flags.
#mkdir -p $CHROME_DIR
#--auto-open-devtools-for-tabs="true" \
#--devtools-flags="" \
# TODO(bt): Math to determine better window placement.
launch_linux() {
chromium \
--allow-running-insecure-content \
--disable-features=ChromeLabs \
--disable-site-isolation-trials \
--disable-web-security \
--ignore-certificate-errors \
--install-autogenerated-theme="100,150,255" \
--unsafely-treat-insecure-origin-as-secure="http://devproxy.fakeyou.com:7000" \
--user-data-dir="${chrome_dir}" \
--window-position=1200,300 \
--window-size=1500,1700 \
http://devproxy.fakeyou.com:7000
}
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
# --guest: no Google login screen
open -na "Google Chrome" --args \
--disable-features=ChromeLabs \
--disable-site-isolation-trials \
--disable-web-security \
--ignore-certificate-errors \
--install-autogenerated-theme="100,150,255" \
--unsafely-treat-insecure-origin-as-secure="http://devproxy.fakeyou.com:7001" \
--user-data-dir="${chrome_dir}" \
--window-position=1200,300 \
--window-size=1500,1700 \
--guest \
http://devproxy.fakeyou.com:7001
}
case $OSTYPE in
linux*)
launch_linux
;;
darwin*)
launch_mac
;;
*)
echo "Unknown OS"
;;
esac