From dc016e361ee1058c9dbb6ac1e1895525db5076a5 Mon Sep 17 00:00:00 2001 From: Dominika Liberda Date: Mon, 1 Mar 2021 23:53:15 +0100 Subject: [PATCH] + better header --- templates/header.shs | 7 ++++++- templates/themes/default/elements/top.t | 4 ++++ templates/themes/default/index.t | 4 ---- templates/themes/default/watch.t | 4 ---- templates/themes/default/watch_flash.t | 28 ------------------------- webroot/channel.shs | 1 + webroot/fav.shs | 1 + webroot/feed.shs | 1 + webroot/login.shs | 2 ++ webroot/playlist.shs | 1 + webroot/search.shs | 1 + webroot/subscribe.shs | 1 + webroot/watch.shs | 4 ++++ 13 files changed, 22 insertions(+), 37 deletions(-) create mode 100644 templates/themes/default/elements/top.t delete mode 100644 templates/themes/default/watch_flash.t diff --git a/templates/header.shs b/templates/header.shs index ed1fd05..9bff60e 100644 --- a/templates/header.shs +++ b/templates/header.shs @@ -1,7 +1,12 @@ #!/bin/bash +# TODO: move this to a *real* template +# we'll need to figure out conditional templates first tho + if ! session_verify "${cookies[sh_session]}"; then echo "Log in | Register" else - echo "Logged in as ${cookies[username]} | Log out" + echo "Logged in as ${cookies[username]} | Log out | Main | Your feed | Your favourites" fi + +render _ "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.t" diff --git a/templates/themes/default/elements/top.t b/templates/themes/default/elements/top.t new file mode 100644 index 0000000..c361eae --- /dev/null +++ b/templates/themes/default/elements/top.t @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/themes/default/index.t b/templates/themes/default/index.t index 0e6857c..efbc262 100644 --- a/templates/themes/default/index.t +++ b/templates/themes/default/index.t @@ -1,7 +1,3 @@ -
- - -

All user's favourites:

{{.favourites}} diff --git a/templates/themes/default/watch.t b/templates/themes/default/watch.t index 7e6b82e..b882d9c 100644 --- a/templates/themes/default/watch.t +++ b/templates/themes/default/watch.t @@ -1,7 +1,3 @@ -
- - -

{{.player}}

{{.title}}

diff --git a/templates/themes/default/watch_flash.t b/templates/themes/default/watch_flash.t deleted file mode 100644 index 7e6b82e..0000000 --- a/templates/themes/default/watch_flash.t +++ /dev/null @@ -1,28 +0,0 @@ -
- - -
-

-{{.player}} -

{{.title}}

-
-
- Uploaded by {{.uploader}} on {{.upload_date}} -
-
- {{.view_count}} views
- {{.like_count}} likes, {{.dislike_count}} dislikes.
- {{.fav}} - {{.sub}} -

-
-
-Description:
{{.description}}
-
-

Recommended

-
-{{.recommended}} -

Comments

-{{.comments_list}} -{{.playlist}} - diff --git a/webroot/channel.shs b/webroot/channel.shs index d7f7cbe..b9181bb 100644 --- a/webroot/channel.shs +++ b/webroot/channel.shs @@ -31,4 +31,5 @@ for (( i=0; i<${#video_id[@]}; i++ )); do strings[videos]+="
${video_title[$i]}

" done +source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.t" diff --git a/webroot/fav.shs b/webroot/fav.shs index 2d1440e..c48b6a0 100644 --- a/webroot/fav.shs +++ b/webroot/fav.shs @@ -23,4 +23,5 @@ for i in $(tac storage/faves | grep -P "^$(session_get_username ${cookies[sh_ses strings[fav]+="

${array[@]:2:999}

"; done +source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/fav.t" diff --git a/webroot/feed.shs b/webroot/feed.shs index c7953e5..95b9e6b 100644 --- a/webroot/feed.shs +++ b/webroot/feed.shs @@ -28,4 +28,5 @@ else strings[feed]="gtfo" fi +source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/feed.t" diff --git a/webroot/login.shs b/webroot/login.shs index 99bd2e9..ce53c56 100755 --- a/webroot/login.shs +++ b/webroot/login.shs @@ -18,6 +18,8 @@ source templates/head.sh if [[ $status == 1 && $reason != '' ]]; then strings[reason]="$reason" +else + strings[reason]="" fi render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/login.t" diff --git a/webroot/playlist.shs b/webroot/playlist.shs index b07c750..456b132 100644 --- a/webroot/playlist.shs +++ b/webroot/playlist.shs @@ -22,4 +22,5 @@ for (( i=0; i<${#video_id[@]}; i++ )); do strings[playlist]+="
${video_title[$i]}

" done +source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/playlist.t" diff --git a/webroot/search.shs b/webroot/search.shs index a8be51a..73e9ba6 100755 --- a/webroot/search.shs +++ b/webroot/search.shs @@ -35,4 +35,5 @@ else echo "search for something will 'ya?" fi +source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/search.t" diff --git a/webroot/subscribe.shs b/webroot/subscribe.shs index 0053dfb..5dee1fb 100644 --- a/webroot/subscribe.shs +++ b/webroot/subscribe.shs @@ -27,4 +27,5 @@ done unset IFS +source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/subscribe.t" diff --git a/webroot/watch.shs b/webroot/watch.shs index 0669200..debb382 100755 --- a/webroot/watch.shs +++ b/webroot/watch.shs @@ -7,6 +7,9 @@ if [[ "${get_data[v]}" ]]; then strings[uploader]='MyMusicGroup' strings[title]='█▬█ █ ▀█▀ Jeden Osiem L - Jak Zapomnieć (Oficjalny Teledysk)' url='https://sakamoto.pl/tmp/videoplayback_.webm' + if [[ "${r[host]}" == "${cfg[flash_host]}" ]]; then + url='//f.sakamoto.pl/videoplayback_.flv' + fi if [[ ${cfg[template]} == 'default' ]]; then meta[title]="${strings[title]}" source templates/head.sh @@ -132,6 +135,7 @@ if [[ "${get_data[v]}" ]]; then done fi + source "${cfg[namespace]}/templates/header.shs" render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/watch.t" else source templates/head.sh