diff --git a/templates/themes/default/channel.t b/templates/themes/default/channel.t index e7519e8..9f78dc7 100644 --- a/templates/themes/default/channel.t +++ b/templates/themes/default/channel.t @@ -1,2 +1,5 @@ -{{.subscribe}} -{{.videos}} +

{{.subscribe}}

+{{.err}} +{{start _videos}} +
{{.title}}

+{{end _videos}} diff --git a/webroot/channel.shs b/webroot/channel.shs index e7e15c7..004e789 100644 --- a/webroot/channel.shs +++ b/webroot/channel.shs @@ -28,16 +28,23 @@ IFS=$'\n' video_title=($(jq -r '.entries[].title' <<< $data)) video_id=($(jq -r '.entries[].id' <<< $data)) -#strings[subscribe]="

$title

Subscribe!
" -strings[subscribe]='

'"$(html_encode "$title")'s channel"'

' -echo uwu > /dev/stderr -for (( i=0; i<${#video_id[@]}; i++ )); do - strings[videos]+="
${video_title[$i]}

" -done +strings[subscribe]="$(html_encode "$title")" -if [[ ! ${strings[videos]} ]]; then - strings[videos]="Failed to fetch videos or channel does not have videos" +nested_declare meow +declare -A nyaa +for (( i=0; i<${#video_id[@]}; i++ )); do + nyaa[id]="${video_id[$i]}" + nyaa[title]="${video_title[$i]}" + + nested_add meow nyaa +done +strings[_videos]+="meow" + +nested_get meow 0 +strings[err]='' +if [[ "${res[id]}" == '' ]]; then + strings[err]="Failed to fetch videos?" fi source "${cfg[namespace]}/templates/header.shs" -render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t" +render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t"