summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2020-01-13 10:59:21 +0100
committerJonathan Bauer2020-01-13 10:59:21 +0100
commit4ee4c8c3b3ebea1da2530d7487f8876c73c7c106 (patch)
treed9d5bbf6ac1cb2691262f25823e9fd7d3604dfd7
parent[run-virt/pam-slx-plug] Always spawn pwdaemon, and one instance only (diff)
downloadmltk-4ee4c8c3b3ebea1da2530d7487f8876c73c7c106.tar.gz
mltk-4ee4c8c3b3ebea1da2530d7487f8876c73c7c106.tar.xz
mltk-4ee4c8c3b3ebea1da2530d7487f8876c73c7c106.zip
[kiosk-chromium] support url-encoded bookmarks
-rw-r--r--core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium b/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium
index 226b274b..67ebfcb8 100644
--- a/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium
+++ b/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium
@@ -9,12 +9,21 @@ if [ "$(whoami)" = "demo" ]; then
mkdir -p "$HOME/.config/chromium/Default"
fi
+# Helper to decode URL-encoded strings
+# e.g. urldecode http%3A%2F%2Ffoobar.com -> http://foobar.com
+urldecode() {
+ : "${*//+/ }"; echo -e "${_//%/\\x}"
+}
+
# Helper to json'ize bookmarks given as arguments in the form:
# <name>,<url> -> e.g. Google,https://www.google.com
json_bookmarks() {
local cur=0
+ local name url
while [ $# -ne 0 ]; do
- jq --null-input --join-output --compact-output --arg id "$(( cur++ ))" --arg name "${1%%,*}" --arg url "${1#*,}" \
+ name="${1%%,*}"
+ url="$(urldecode ${1#*,})"
+ jq --null-input --join-output --compact-output --arg id "$(( cur++ ))" --arg name "$name" --arg url "$url" \
'{"id": $id, "type": "url", "name": $name, "url": $url}'
shift
[ $# -ne 0 ] && printf ","