bashtube/webroot/index.shs

28 lines
564 B
Bash
Executable file

#!/bin/bash
#source templates/head.sh
source ${cfg[namespace]}/templates/header.shs
declare -A strings
if [[ -s storage/faves ]]; then
strings[?favourites]=true
fi
nested_declare fav
declare -A fav_
IFS=$'\n'
for i in $(tac storage/faves); do
IFS=':'
array=($i) # please redo me i'm stupid
if [[ ${array[1]} == '' ]]; then
break
fi
fav_[favourited_by]="${array[0]}"
fav_[id]=${array[1]}
fav_[title]=${array[@]:2:999}
nested_add fav fav_
done
strings[_favourites]="fav"
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/index.html"