summaryrefslogtreecommitdiffstats
path: root/core/modules/kiosk-slxbrowser/data/opt/openslx/scripts/kiosk-launch.d/00-slxbrowser
blob: 6d844b977c8dc01ff580ece8991ac7796fb18180 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# ^ sourced!

command -v slxbrowser || return 0

export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin

OPTS=

# Ignore SSL errors
[ -n "$SLX_BROWSER_INSECURE" ] && [ "$SLX_BROWSER_INSECURE" -gt 0 ] && OPTS="$OPTS --insecure"
# On inactivity, reload every X seconds
[ -n "$SLX_BROWSER_RELOAD_SECS" ] && [ "$SLX_BROWSER_RELOAD_SECS" -gt 0 ] && OPTS="$OPTS --reload-interval $SLX_BROWSER_RELOAD_SECS"
# If set, is a space separated list of URLs or hosts
if [ -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 blacklist
	if [ -n "$SLX_BROWSER_IS_WHITELIST" ] && [ "$SLX_BROWSER_IS_WHITELIST" -gt 0 ]; then
		OPTS="$OPTS --whitelist $LIST"
	else
		OPTS="$OPTS --blacklist $LIST"
	fi
	# Async, clean up file after slxbrowser read it
	( sleep 5; rm -f -- "$LIST" ) &
fi

exec slxbrowser $OPTS --fullscreen "$SLX_BROWSER_URL"