From fb6aef0ba60ab62504541053839a8a4e6c7023ba Mon Sep 17 00:00:00 2001 From: Dominique Liberda Date: Wed, 18 Jan 2023 06:08:55 +0100 Subject: [PATCH] * default: update watch for new renderer --- templates/themes/default/index.html | 14 +++++++++++++- templates/themes/default/watch.html | 1 + webroot/index.shs | 16 ++++++++++------ webroot/watch.shs | 6 +++--- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/templates/themes/default/index.html b/templates/themes/default/index.html index efbc262..0dc8038 100644 --- a/templates/themes/default/index.html +++ b/templates/themes/default/index.html @@ -1,4 +1,16 @@

All user's favourites:

-{{.favourites}} +{{start ?favourites}} + {{start _favourites}} +
+ +
+ {{.title}} +
+
Favourited by {{.favourited_by}} +
+ {{end _favourites}} +{{else ?favourites}} + No favourite videos found :( +{{end ?favourites}}
diff --git a/templates/themes/default/watch.html b/templates/themes/default/watch.html index 45b3682..5137efa 100644 --- a/templates/themes/default/watch.html +++ b/templates/themes/default/watch.html @@ -1,3 +1,4 @@ +{{@player}}

{{.title}}

diff --git a/webroot/index.shs b/webroot/index.shs index 211fec2..bf1701a 100755 --- a/webroot/index.shs +++ b/webroot/index.shs @@ -5,19 +5,23 @@ source ${cfg[namespace]}/templates/header.shs declare -A strings if [[ -s storage/faves ]]; then - strings[favourites]="" -else - strings[favourites]="No favorite videos found,
you can do it first! ^w^" + strings[?favourites]=true fi +nested_declare fav +declare -A fav_ IFS=$'\n' for i in $(tac storage/faves); do IFS=':' - array=($i) + array=($i) # please redo me i'm stupid if [[ ${array[1]} == '' ]]; then break fi - strings[favourites]+="

${array[@]:2:999}

Favourited by ${array[0]}
"; + fav_[favourited_by]="${array[0]}" + fav_[id]=${array[1]} + fav_[title]=${array[@]:2:999} + nested_add fav fav_ done -render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/index.html" +strings[_favourites]="fav" +render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/index.html" diff --git a/webroot/watch.shs b/webroot/watch.shs index 39a8caf..5a9e390 100755 --- a/webroot/watch.shs +++ b/webroot/watch.shs @@ -226,9 +226,9 @@ if [[ "${get_data[v]}" ]]; then strings[comments_list]='An error ocurred during fetching comments.' fi -# source "${cfg[namespace]}/templates/header.shs" -# echo "$player_render" - strings[@player]="meow$player_render" + [[ "${cfg[template]}" == "default" ]] && source "${cfg[namespace]}/templates/header.shs" + + strings[@player]="$player_render" strings[@header]="$(cat "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.html")" strings[@footer]="$(cat "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/footer.html")" render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch.html"