4ddf2f784a
-finally fixed favourites page for good -made favourites and feed pages look Neater™ -maybe broke the search results page idk lmao
41 lines
1.1 KiB
Bash
41 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
declare -A strings
|
|
|
|
nested_declare info
|
|
|
|
if session_verify "${cookies[sh_session]}" && [[ "${get_data[v]}" != '' ]]; then
|
|
title=$(yt-dlp --cookies ${cfg[_cookies]} -e "https://youtube.com/watch?v=${get_data[v]}")
|
|
if [[ $(grep -F "$title" storage/faves | grep "$(echo ${cookies[username]} | sed -E "s/\r//")") == '' ]]; then
|
|
echo "$(session_get_username ${cookies[sh_session]}):${get_data[v]}:$title" >> storage/faves
|
|
fi
|
|
_info="<span style='color:#f80'>You just liked $title!</span>"
|
|
fi
|
|
|
|
if [[ ${cfg[template]} != 'retro' ]]; then
|
|
#source templates/head.sh
|
|
source "${cfg[namespace]}/templates/header.shs"
|
|
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=':'
|
|
array=($i)
|
|
if [[ ${array[1]} == '' ]]; then
|
|
break
|
|
fi
|
|
|
|
fav_[id]="${array[1]}"
|
|
fav_[name]="${array[@]:2:9999}"
|
|
nested_add fav fav_
|
|
done
|
|
|
|
[[ ${fav_[id]} != '' ]] && strings[?fav]=true
|
|
strings[_fav]="fav"
|
|
strings[_info]="info"
|
|
|
|
render strings "${cfg[namespace]}/templates/themes/${cfg[template]}/fav.html"
|