#!/bin/bash# ^ sourced!export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin
command -v slxbrowser || return0
OPTS=()# Ignore SSL errors[-n"$SLX_BROWSER_INSECURE"] && ["$SLX_BROWSER_INSECURE"-gt0] && OPTS+=("--insecure")# On inactivity, reload every X seconds[-n"$SLX_BROWSER_RELOAD_SECS"] && ["$SLX_BROWSER_RELOAD_SECS"-gt0] && OPTS+=("--reload-interval""$SLX_BROWSER_RELOAD_SECS")# If set, is a space separated list of URLs or hostsif[-n"$SLX_BROWSER_URLLIST"];then# Turn into file with one entry per line
LIST=$(mktemp)echo"$SLX_BROWSER_URLLIST" | sed-r's/\s+/\n/g'>"$LIST"# Is it a whitelist or blacklistif[-n"$SLX_BROWSER_IS_WHITELIST"] && ["$SLX_BROWSER_IS_WHITELIST"-gt0];then
OPTS+=("--whitelist""$LIST")else
OPTS+=("--blacklist""$LIST")fi# Async, clean up file after slxbrowser read it(sleep5;rm-f --"$LIST") &fiif[-n"$SLX_BROWSER_INTERACTIVE"];then
OPTS+=("--maximized")else
OPTS+=("--fullscreen")fi# HACK: give whatever enough time to whatever it does properlyusleep500000exec slxbrowser "${OPTS[@]}""$SLX_BROWSER_URL"