's'
This commit is contained in:
50
scripts/linux/launch_browser.sh
Normal file
50
scripts/linux/launch_browser.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
CONFIG_DIR="$ROOT_DIR/config"
|
||||
|
||||
[ -f "$CONFIG_DIR/system-stack.env" ] && set -a && . "$CONFIG_DIR/system-stack.env" && set +a
|
||||
[ -f "$CONFIG_DIR/hardware.env" ] && set -a && . "$CONFIG_DIR/hardware.env" && set +a
|
||||
|
||||
browser_bin="$(
|
||||
command -v chromium 2>/dev/null \
|
||||
|| command -v chromium-browser 2>/dev/null \
|
||||
|| command -v google-chrome 2>/dev/null \
|
||||
|| true
|
||||
)"
|
||||
|
||||
if [ -z "$browser_bin" ]; then
|
||||
echo "MESSAGE=Chromium or Google Chrome is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
profile_dir="${BROWSER_PROFILE_DIR:-$HOME/.local/share/live-browser/profile}"
|
||||
start_url="${BROWSER_START_URL:-https://www.tiktok.com/live}"
|
||||
locale="${BROWSER_LOCALE:-zh-CN}"
|
||||
debug_port="${BROWSER_REMOTE_DEBUG_PORT:-9222}"
|
||||
|
||||
mkdir -p "$profile_dir"
|
||||
|
||||
args=(
|
||||
"--user-data-dir=$profile_dir"
|
||||
"--password-store=basic"
|
||||
"--lang=$locale"
|
||||
"--no-first-run"
|
||||
"--restore-last-session"
|
||||
"--remote-debugging-port=$debug_port"
|
||||
"--start-maximized"
|
||||
"--ozone-platform-hint=auto"
|
||||
)
|
||||
|
||||
if [ "${LIVE_BROWSER_HWACCEL:-auto}" = "disabled" ]; then
|
||||
args+=("--disable-gpu")
|
||||
fi
|
||||
|
||||
if [ -n "${BROWSER_EXTRA_FLAGS:-}" ]; then
|
||||
# shellcheck disable=SC2206
|
||||
extra_flags=(${BROWSER_EXTRA_FLAGS})
|
||||
args+=("${extra_flags[@]}")
|
||||
fi
|
||||
|
||||
exec "$browser_bin" "${args[@]}" "$start_url"
|
||||
Reference in New Issue
Block a user