redesigned and revised /channel page
- added (un-)subscribe button (and error handling when no channel ID is given) - changed the view from a weird list to a 3-column grid on maximum width - fixed behaviour where it sometimes would attach " - Videos" to channel namemerge-requests/6/head
parent
0590bc8a26
commit
64f49a3461
|
@ -1,7 +1,15 @@
|
|||
<h1>{{.subscribe}}</h1>
|
||||
<h1>Channel "{{.subscribe}}"</h1>
|
||||
{{.err}}
|
||||
{{start ?sub}}<a href='subscribe.shs?id={{.channel_id}}' target='_blank'>Subscribe to {{.uploader}}!</a><br>{{end ?sub}}
|
||||
{{start ?unsub}}<a href='unsubscribe.shs?id={{.channel_id}}' target='_blank'>Unsubscribe from {{.uploader}}!</a><br>{{end ?unsub}}
|
||||
{{start ?sub}}<a href='/subscribe.shs?id={{.channel_id}}' target='_blank'>Subscribe to {{.subscribe}}!</a><br><br>{{end ?sub}}
|
||||
{{start ?unsub}}<a href='/unsubscribe.shs?id={{.channel_id}}' target='_blank' style="color:#d00;">Unsubscribe from {{.subscribe}}!</a><br><br>{{end ?unsub}}
|
||||
{{start ?login}}<b><a href='/login.shs?r={{.login_r}}'>Log in</a> to subscribe to this channel!</b><br><br>{{end ?login}}
|
||||
{{start ?suberror}}<b>Couldn't fetch Channel ID... :/</b> ((un-)subscribe buttons have been hidden for this reason)<br><br>{{end ?suberror}}
|
||||
<div style='display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'>
|
||||
{{start _videos}}
|
||||
<a href='/watch?v={{.id}}'><img src='http://i.ytimg.com/vi/{{.id}}/mqdefault.jpg'><br>{{.title}}</a><br>
|
||||
<div>
|
||||
<a href='watch?v={{.id}}'>
|
||||
<img src='https://i.ytimg.com/vi/{{.id}}/mqdefault.jpg'><br>
|
||||
<b>{{.title}}</b></a>
|
||||
</div>
|
||||
{{end _videos}}
|
||||
</div>
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue