bashtube/webroot/index.shs

24 lines
635 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]=""
else
strings[favourites]="No favorite videos found,<br>you can do it first! ^w^"
fi
IFS=$'\n'
for i in $(tac storage/faves); do
IFS=':'
array=($i)
if [[ ${array[1]} == '' ]]; then
break
fi
strings[favourites]+="<div><a href='watch?v=${array[1]}'><img src='https://i.ytimg.com/vi/${array[1]}/mqdefault.jpg'><br><b>${array[@]:2:999}</b></a><br>Favourited by ${array[0]}</div>";
done
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/index.t"