diff --git a/templates/themes/default-v2/channel.html b/templates/themes/default-v2/channel.html index 32b66ee..165e962 100644 --- a/templates/themes/default-v2/channel.html +++ b/templates/themes/default-v2/channel.html @@ -1,7 +1,15 @@ -

{{.subscribe}}

+

Channel "{{.subscribe}}"

{{.err}} -{{start ?sub}}Subscribe to {{.uploader}}!
{{end ?sub}} -{{start ?unsub}}Unsubscribe from {{.uploader}}!
{{end ?unsub}} +{{start ?sub}}Subscribe to {{.subscribe}}!

{{end ?sub}} +{{start ?unsub}}Unsubscribe from {{.subscribe}}!

{{end ?unsub}} +{{start ?login}}Log in to subscribe to this channel!

{{end ?login}} +{{start ?suberror}}Couldn't fetch Channel ID... :/ ((un-)subscribe buttons have been hidden for this reason)

{{end ?suberror}} +
{{start _videos}} -
{{.title}}

+
+ +
+ {{.title}}
+
{{end _videos}} +
diff --git a/webroot/channel.shs b/webroot/channel.shs index 3a2a88e..6a3a992 100644 --- a/webroot/channel.shs +++ b/webroot/channel.shs @@ -17,6 +17,24 @@ else return fi +if [[ "${get_data[id]}" ]]; then + if [[ "${cookies[sh_session]}" != '' ]]; then + if [[ $(grep $(session_get_username "${cookies[sh_session]}") storage/subscribed | grep "${strings[channel_id]}") == '' ]]; then + strings[?sub]=true + strings[channel_id]="${get_data[id]}" + else + strings[?unsub]=true + strings[channel_id]="${get_data[id]}" + fi + else + strings[?login]=true + #strings[login_r]=$(sed -s 's/?/___/' <<< "${r[url]}") + strings[login_r]="channel.shs___id=${get_data[id]}" + fi +else + strings[?suberror]=true +fi + title=$(jq -r '.title' <<< $data) if [[ ${cfg[template]} != 'retro' ]]; then @@ -29,7 +47,7 @@ IFS=$'\n' video_title=($(jq -r 'if .entries[].channel_follower_count != null then .entries[].entries[] else .entries[] end | .title' <<< $data)) video_id=($(jq -r 'if .entries[].channel_follower_count != null then .entries[].entries[] else .entries[] end | .id' <<< $data)) -strings[subscribe]="$(html_encode "$title")" +strings[subscribe]="$(html_encode "$title" | sed -E "s/ - Videos//g")" nested_declare meow declare -A nyaa @@ -44,7 +62,7 @@ strings[_videos]+="meow" nested_get meow 0 strings[err]='' if [[ "${res[id]}" == '' ]]; then - strings[err]="Failed to fetch videos?" + strings[err]="Failed to fetch videos... :c" fi render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/channel.html"