summaryrefslogtreecommitdiffstats
path: root/core/modules/kiosk-slxbrowser/data/opt/openslx/scripts/kiosk-launch.d/00-slxbrowser
blob: ea9d2e4c1f564c7c490898bbaeaa8afe99618e4a (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
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# ^ sourced!

command -v slxbrowser || return 0

OPTS=()

# Ignore SSL errors
[ -n "$SLX_BROWSER_INSECURE" ] && [ "$SLX_BROWSER_INSECURE" -gt 0 ] && OPTS+=("--insecure")
# On inactivity, reload every X seconds
[ -n "$SLX_BROWSER_RELOAD_SECS" ] && [ "$SLX_BROWSER_RELOAD_SECS" -gt 0 ] && OPTS+=("--reload-interval" "$SLX_BROWSER_RELOAD_SECS")

if [ -n "$SLX_BROWSER_BLACKLIST" ]; then
	# Turn into file with one entry per line
	bl="$( mktemp )"
	sed -r 's/\s+/\n/g' <<<"$SLX_BROWSER_BLACKLIST" > "$bl"
	OPTS+=("--blacklist" "$bl")
	# Async, clean up file after slxbrowser read it
	( sleep 4; rm -f -- "$bl" ) &
fi
if [ -n "$SLX_BROWSER_WHITELIST" ]; then
	wl="$( mktemp )"
	sed -r 's/\s+/\n/g' <<<"$SLX_BROWSER_WHITELIST" > "$wl"
	OPTS+=("--whitelist" "$wl")
	( sleep 4; rm -f -- "$wl" ) &
fi

if [ -z "${SLX_AUTOLOGIN%OFF}" ]; then
	OPTS+=("--maximized")
else
	OPTS+=("--fullscreen")
fi

if [ -n "$SLX_BROWSER_ZOOM" ]; then
	OPTS+=( "--zoom" "$SLX_BROWSER_ZOOM" )
fi

# HACK: give whatever enough time to whatever it does properly
sleep 1

exec slxbrowser "${OPTS[@]}" "$SLX_BROWSER_URL"