bashtube/templates/header.shs

24 lines
767 B
Plaintext
Raw Normal View History

2021-01-28 22:56:24 +01:00
#!/bin/bash
2021-03-02 18:01:39 +01:00
declare -A strings_
2021-07-06 15:54:55 +02:00
echo "<link rel='shortcut icon' href='/favicon.ico'>
<link rel='stylesheet' href='/css/style.css'><a href='/'><img src='/img/bashtube.png'></a><br>"
2021-03-02 01:09:31 +01:00
2021-03-01 23:53:15 +01:00
# TODO: move this to a *real* template
# we'll need to figure out conditional templates first tho
2021-01-28 22:56:24 +01:00
if ! session_verify "${cookies[sh_session]}"; then
2021-06-18 16:05:15 +02:00
echo "<a href='/login.shs'>Log in</a> | <a href='/register.shs'>Register</a>"
2021-01-28 22:56:24 +01:00
else
2021-03-02 01:09:31 +01:00
echo "Logged in as ${cookies[username]} | <a href='/logout.shs'>Log out</a> | <a href='/feed.shs'>Your feed</a> | <a href='/fav.shs'>Your favourites</a>"
2021-01-28 22:56:24 +01:00
fi
2021-03-01 23:53:15 +01:00
2021-03-02 18:01:39 +01:00
if [[ "$query_nice" != '' ]]; then
strings_[query_nice]="$query_nice"
else
strings_[query_nice]=''
fi
2021-03-02 17:45:29 +01:00
2021-03-02 18:01:39 +01:00
render strings_ "${cfg[namespace]}/templates/themes/${cfg[template]}/elements/top.t"