- got rid of all legacy render_unsafe calls
This commit is contained in:
parent
fb6aef0ba6
commit
ca5baf50e3
|
@ -20,4 +20,4 @@ else
|
|||
strings_[query_nice]=''
|
||||
fi
|
||||
|
||||
render strings_ "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.t"
|
||||
render strings_ "${cfg[namespace]}/templates/themes/default/elements/top.html"
|
||||
|
|
4
templates/themes/default/elements/item.html
Normal file
4
templates/themes/default/elements/item.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
<a href='/watch?v=${.id}'>
|
||||
<img src='https://i.ytimg.com/vi/${.id}/mqdefault.jpg'><br>${.title}
|
||||
</a> | ${.runtime} seconds | ${.views} views<br>
|
||||
Uploaded by <a href='/channel/${.channel_id}'>${.channel}</a><br>
|
|
@ -1,2 +1,14 @@
|
|||
<a href='./'><--- back to main</a><br><h1>Your favourites</h1>
|
||||
<h1>Your favourites</h1>
|
||||
{{.fav}}
|
||||
{{start ?fav}}
|
||||
{{start _fav}}
|
||||
<div>
|
||||
<a href='watch?v={{.id}}'>
|
||||
<img src='https://i.ytimg.com/vi/{{.id}}/mqdefault.jpg'><br>
|
||||
<b>{{.name}}</b>
|
||||
</a><br>
|
||||
</div>
|
||||
{{end _fav}}
|
||||
{{else ?fav}}
|
||||
Meow? no faves?
|
||||
{{end ?fav}}
|
||||
|
|
|
@ -1 +1,13 @@
|
|||
{{.feed}}
|
||||
{{start ?feed}}
|
||||
{{start _feed}}
|
||||
<div class='video-image-container'>
|
||||
<a href='watch?v={{.id}}'>
|
||||
<div class='video-image' style='background-image: url(http://i.ytimg.com/vi/{{.id}}/mqdefault.jpg)'></div>
|
||||
{{.title}}
|
||||
</a>
|
||||
{{.date}}
|
||||
</div>
|
||||
{{end _feed}}
|
||||
{{else ?feed}}
|
||||
Eh. something went wrong. Check if you're logged in and if you <a href="/subscribe.shs">subscribe</a> to anyone :p
|
||||
{{end ?feed}}
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
{{.playlist}}
|
||||
{{start _playlist}}
|
||||
<a href='watch?v={{.id}}&playlist={{.playlist}}")'>
|
||||
<img src='https://i.ytimg.com/vi/{{.id}}/mqdefault.jpg'><br>
|
||||
{{.title}}
|
||||
</a><br>
|
||||
{{end _playlist}}
|
||||
|
|
|
@ -1,2 +1,10 @@
|
|||
<a href='./'><--- back to main</a><br><h1>Channels you subscribe to</h1>
|
||||
{{.subscribe}}
|
||||
<h1>Channels you subscribe to</h1>
|
||||
{{start ?sub}}
|
||||
{{start _sub}}
|
||||
<div>
|
||||
<a href='channel.shs?id={{.id}}'>{{.name}}</a><br>
|
||||
</div>
|
||||
{{end _sub}}
|
||||
{{else ?sub}}
|
||||
Meow? no subs 🥺?
|
||||
{{end ?sub}}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<b>{{.like_count}}</b> likes<br>
|
||||
|
||||
{{start ?fav}}<a href='fav.shs?v={{.id}}' target='_blank'>Add to favourites</a><br>{{end ?fav}}
|
||||
{{start ?unfav}}<a href='unfav.shs?v={{.id}}' target='_blank'>Remove from favourites</a><br>{{end ?unfav}}
|
||||
{{start ?unfav}}<a href='unfav.shs?v={{.id}}' target='_blank'>Remove from favourites</a><br>{{else ?unfav}}{{end ?unfav}}
|
||||
{{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 ?login}}<b><a href='/login.shs?r={{.r}}'>Log in</a> to add this video to your favourites and/or subscribe to this channel!</b><br>{{end ?login}}
|
||||
|
|
|
@ -1 +1,13 @@
|
|||
{{.feed}}
|
||||
{{start ?feed}}
|
||||
{{start _feed}}
|
||||
<div class='video-image-container'>
|
||||
<a href='watch?v=${video_id[$i]}'>
|
||||
<div class='video-image' style='background-image: url(http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg)'></div>
|
||||
${video_title[$i]}
|
||||
</a>
|
||||
$(date -d "@${video_date[$i]}" "+%H:%M, %d %h %Y")
|
||||
</div>
|
||||
{{end _feed}}
|
||||
{{else ?feed}}
|
||||
Eh. something went wrong, maybe you're not logged in?
|
||||
{{end ?feed}}
|
||||
|
|
|
@ -13,6 +13,9 @@ if [[ ${cfg[template]} == 'default' ]]; then
|
|||
source templates/head.sh
|
||||
fi
|
||||
|
||||
nested_declare fav
|
||||
declare -A fav_
|
||||
|
||||
IFS=$'\n'
|
||||
for i in $(tac storage/faves | grep -P "^$(session_get_username ${cookies[sh_session]}):"); do
|
||||
IFS=':'
|
||||
|
@ -20,12 +23,15 @@ for i in $(tac storage/faves | grep -P "^$(session_get_username ${cookies[sh_ses
|
|||
if [[ ${array[1]} == '' ]]; then
|
||||
break
|
||||
fi
|
||||
strings[fav]+="<div><a href='watch?v=${array[1]}'><img src='https://i.ytimg.com/vi/${array[1]}/mqdefault.jpg'><br><b>${array[@]:2:999}</b></a><br></div>";
|
||||
|
||||
fav_[id]="${array[1]}"
|
||||
fav_[name]="${array[@]:2:9999}"
|
||||
nested_add fav fav_
|
||||
done
|
||||
|
||||
if [[ ! ${strings[fav]} ]]; then
|
||||
strings[fav]="You are not logged in or you do not have any favorites"
|
||||
fi
|
||||
[[ ${fav_[id]} != '' ]] && strings[?sub]=true
|
||||
strings[_fav]="fav"
|
||||
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/fav.html"
|
||||
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/fav.html"
|
||||
|
|
|
@ -19,14 +19,22 @@ if session_verify "${cookies[sh_session]}"; then
|
|||
video_uploader+=($(grep -Poh "name>.*?</" <<< "$data" | sed -E 's/name>//;s/<\///' | head -n 1))
|
||||
done <<< "$(cat storage/subscribed | grep -P "^$(session_get_username ${cookies[sh_session]}):")"
|
||||
|
||||
[[ ${#video_id[@]} -gt 0 ]] && strings[?feed]=true
|
||||
|
||||
queue=$(for (( i=0; i<${#video_id[@]}; i++ )); do echo "$i ${video_date[i]}"; done | sort -k2r | awk '{print $1}')
|
||||
|
||||
|
||||
nested_declare feed
|
||||
declare -A feed_
|
||||
while read i; do
|
||||
strings[feed]+="<div class='video-image-container'><a href='watch?v=${video_id[$i]}'><div class='video-image' style='background-image: url(http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg)'></div>${video_title[$i]}</a>$(date -d "@${video_date[$i]}" "+%H:%M, %d %h %Y")</div>"
|
||||
feed_[id]="${video_id[$i]}"
|
||||
feed_[title]="${video_title[$i]}"
|
||||
feed_[date]="$(date -d "@${video_date[$i]}" "+%H:%M, %d %h %Y")"
|
||||
feed_[uploader]="${video_uploader[$i]}"
|
||||
#strings[feed]+="<div class='video-image-container'><a href='watch?v='><div class='video-image' style='background-image: url(http://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg)'></div></a></div>"
|
||||
nested_add feed feed_
|
||||
done <<< "$queue"
|
||||
else
|
||||
strings[feed]="You're not logged in!"
|
||||
strings[_feed]="feed"
|
||||
fi
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/feed.html"
|
||||
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/feed.html"
|
||||
|
|
|
@ -18,13 +18,16 @@ IFS=$'\n'
|
|||
video_title=($(jq -r '.title' <<< $data))
|
||||
video_id=($(jq -r '.id' <<< $data))
|
||||
|
||||
nested_declare list
|
||||
declare -A item
|
||||
for (( i=0; i<${#video_id[@]}; i++ )); do
|
||||
strings[playlist]+="<a href='watch?v=${video_id[$i]}&playlist=$(html_encode "${get_data[list]}")'><img src='https://i.ytimg.com/vi/${video_id[$i]}/mqdefault.jpg'><br>${video_title[$i]}</a><br>"
|
||||
item[id]="${video_id[$i]}"
|
||||
item[playlist]="${get_data[list]}"
|
||||
item[title]="${video_title[$i]}"
|
||||
nested_add list item
|
||||
done
|
||||
|
||||
if [[ ! ${strings[playlist]} ]]; then
|
||||
strings[playlist]="Invalid playlist or playlist does not have videos"
|
||||
fi
|
||||
strings[_playlist]="list"
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/playlist.html"
|
||||
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/playlist.html"
|
||||
|
|
|
@ -13,6 +13,9 @@ if [[ ${cfg[template]} == 'default' ]]; then
|
|||
source templates/head.sh
|
||||
fi
|
||||
|
||||
nested_declare channels
|
||||
declare -A channels_
|
||||
|
||||
IFS=$'\n'
|
||||
for i in $(tac storage/subscribed | grep -P "^$(session_get_username ${cookies[sh_session]}):"); do
|
||||
IFS=':'
|
||||
|
@ -21,10 +24,15 @@ for i in $(tac storage/subscribed | grep -P "^$(session_get_username ${cookies[s
|
|||
if [[ ${array[1]} == '' ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
strings[subscribe]+="<div><a href='channel.shs?id=${array[1]}'>${array[@]:2:9999}</a><br></div>";
|
||||
|
||||
channels_[id]="${array[1]}"
|
||||
channels_[name]="${array[@]:2:9999}"
|
||||
nested_add channels channels_
|
||||
done
|
||||
|
||||
[[ ${channels_[id]} != '' ]] && strings[?sub]=true
|
||||
strings[_sub]="channels"
|
||||
|
||||
unset IFS
|
||||
|
||||
if [[ ! ${strings[subscribe]} ]]; then
|
||||
|
@ -32,4 +40,4 @@ if [[ ! ${strings[subscribe]} ]]; then
|
|||
fi
|
||||
|
||||
source "${cfg[namespace]}/templates/header.shs"
|
||||
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/subscribe.html"
|
||||
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/subscribe.html"
|
||||
|
|
|
@ -138,7 +138,7 @@ if [[ "${get_data[v]}" ]]; then
|
|||
strings[id]="${get_data[v]}"
|
||||
|
||||
#<video id='player' src='$url' controls></video>
|
||||
if [[ ${cookies[sh_session]} ]]; then
|
||||
if [[ "${cookies[sh_session]}" != '' ]]; then
|
||||
if [[ $(grep $(session_get_username "${cookies[sh_session]}") storage/faves | grep "${get_data[v]}") == '' ]]; then
|
||||
strings[?fav]=true
|
||||
else
|
||||
|
@ -166,7 +166,7 @@ if [[ "${get_data[v]}" ]]; then
|
|||
vid="$(cat "temp/${written_id}_https_-_"*"watch"*".dump")"
|
||||
vid_json="$(tr -d '\n' <<< "$vid" | grep -Poh "ytInitialData.*?</script>" | sed 's/ytInitialData = //;s/<\/script>//')"
|
||||
|
||||
strings[recommended]=$()
|
||||
#strings[recommended]=$()
|
||||
|
||||
_jq_to_array '.contents.twoColumnWatchNextResults.secondaryResults.secondaryResults.results[] | .compactAutoplayRenderer.contents[0].compactVideoRenderer, .compactVideoRenderer |
|
||||
if .videoId != null then
|
||||
|
|
Loading…
Reference in a new issue