2020-07-16 23:10:31 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-02-28 17:43:40 +01:00
|
|
|
declare -A strings
|
|
|
|
|
2020-07-16 23:10:31 +02:00
|
|
|
if session_verify ${cookies[sh_session]} && [[ ${get_data[id]} != '' ]]; then
|
|
|
|
title=$(curl https://www.youtube.com/feeds/videos.xml?channel_id=${get_data[id]} | grep title | head -n 1 | sed -s 's/ <title>//;s/<\/title>//')
|
2021-01-28 22:56:24 +01:00
|
|
|
if [[ $((grep -PF ":$title$" | grep "$(echo ${cookies[username]} | sed -E "s/\r//")") <<< storage/subscribed) == '' ]]; then
|
2020-07-16 23:10:31 +02:00
|
|
|
echo "$(session_get_username ${cookies[sh_session]}):${get_data[id]}:$title" >> storage/subscribed
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-02-28 17:43:40 +01:00
|
|
|
if [[ ${cfg[template]} == 'default' ]]; then
|
|
|
|
source templates/head.sh
|
|
|
|
fi
|
2020-07-16 23:10:31 +02:00
|
|
|
|
|
|
|
IFS=$'\n'
|
2021-01-28 22:56:24 +01:00
|
|
|
for i in $(tac storage/subscribed | grep -P "^$(session_get_username ${cookies[sh_session]}):"); do
|
2020-07-16 23:10:31 +02:00
|
|
|
IFS=':'
|
|
|
|
array=($i)
|
2021-01-28 22:56:24 +01:00
|
|
|
|
2020-07-16 23:10:31 +02:00
|
|
|
if [[ ${array[1]} == '' ]]; then
|
|
|
|
break
|
|
|
|
fi
|
2021-01-28 22:56:24 +01:00
|
|
|
|
2021-02-28 17:43:40 +01:00
|
|
|
strings[subscribe]+="<div><a href='channel.shs?id=${array[1]}'>${array[@]:2:9999}</a><br></div>";
|
2020-07-16 23:10:31 +02:00
|
|
|
done
|
2021-01-28 22:56:24 +01:00
|
|
|
|
|
|
|
unset IFS
|
2021-02-28 17:43:40 +01:00
|
|
|
|
2021-03-14 15:43:17 +01:00
|
|
|
if [[ ! ${strings[subscribe]} ]]; then
|
|
|
|
strings[subscribe]="You are not logged in or you do not have any subscribed channels"
|
|
|
|
fi
|
|
|
|
|
2021-03-01 23:53:15 +01:00
|
|
|
source "${cfg[namespace]}/templates/header.shs"
|
2023-01-18 01:08:05 +01:00
|
|
|
render_unsafe strings "${cfg[namespace]}/templates/themes/${cfg[template]}/subscribe.html"
|