freak/freak/templates/base.html

137 lines
4.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% from "macros/icon.html" import icon with context %}
{% block title %}
<title>{{ app_name }}</title>
{% endblock %}
<!--
Copyright (c) 2025 Sakuragasaki46.
This Service is available "AS IS", with NO WARRANTY, explicit or implied.
Sakuragasaki46 is NOT legally liable for Your use of the Service.
This service is age-restricted; do not access if underage.
More info: https://{{ domain_name }}/terms
-->
<meta name="og:site_name" content="{{ app_name }}" />
<meta name="generator" content="{{ app_name }} {{ app_version }}" />
<meta name="csrf_token" content="{{ csrf_token() }}">
<link rel="stylesheet" href="{{ url_for_css('style') }}" />
{# psa: icons url MUST be supplied by .env via PRIVATE_ASSETS= #}
{% for private_style in private_styles %}
<link rel="stylesheet" href="{{ private_style }}" />
{% endfor %}
<link rel="icon" href="/favicon.ico" />
<script src="{{ jquery_url }}"></script>
</head>
<body {% if current_user.color_theme %} class="{{ theme_classes(current_user.color_theme) }}"{% endif %}>
<header class="header">
<h1><a href="/">{{ app_name }}</a></h1>
<div class="metanav">
<ul>
{% if not g.no_user %}
<li>
<form action="/search" method="POST" class="mini-search-bar">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="search" name="q" placeholder="Search among {{ post_count }} posts…">
<input type="submit" value="Search">
</form>
<a href="/search" aria-label="Search" title="Search">
{{ icon('search') }}
</a>
</li>
{% endif %}
{% if g.no_user %}
<!-- no user -->
{% elif current_user.is_authenticated %}
<li class="nomobile">
<a class="round border-accent" href="{{ url_for('create.create', on=current_guild.name) if current_guild and current_guild.allows_posting(current_user) else '/create/' }}" title="Create a post" aria-label="Create a post">
{{ icon('add') }}
<span>New post</span>
</a>
</li>
{% if current_user.is_administrator %}
<li class="nomobile">
<a href="/admin" title="Admin Tools" aria-label="Admin Tools">
{{ icon('mod') }}
</a>
</li>
{% endif %}
<li><a href="{{ current_user.url() }}" title="{{ current_user.handle() }}'s profile" aria-label="User profile">{{ icon('profile') }}</a>
<div class="header-username">
<strong class="header-username-name">{{ current_user.handle() }}</strong>
<span class="header-username-karma">{{ icon('karma') }} {{ current_user.karma }} karma</span>
</div></li>
<li><a href="/logout" title="Log out" aria-label="Log out">
{{ icon('logout') }}
</a></li>
{% else %}
<li><a href="/login" title="Log in" aria-label="Log in">
{{ icon('logout') }}
</a></li>
<li><a href="/register" title="Create account" aria-label="Create account">
{{ icon('join') }}
</a></li>
{% endif %}
</ul>
</div><!-- .metanav -->
</header>
<main class="content">
{% for message in get_flashed_messages() %}
<div class="flash card">{{ message }}</div>
{% endfor %}
{% block body %}
<div class="content-header">
{% block heading %}{% endblock %}
</div>
<div class="content-container">
<div class="content-nav">
{% block nav %}{% endblock %}
</div>
<div class="content-main">
{% block content %}{% endblock %}
</div>
</div>
{% endblock %}
</main>
<footer class="footer">
<p class="copyright">&copy; 2021-2025 Sakuragasaki46.</p>
<ul class="copyright-about">
<li><a href="/about">About</a></li>
<li><a href="/terms">Terms</a></li>
<li><a href="/privacy">Privacy</a></li>
<li><a href="https://github.com/sakuragasaki46/freak">GitHub</a></li>
</ul>
</footer>
{% if current_user and current_user.is_authenticated %}
<footer class="mobile-nav mobileonly">
<ul>
<li><a href="/" title="Homepage">{{ icon('home') }}</a></li>
<li><a href="/search" title="Search">{{ icon('search') }}</a></li>
<li><a href="/create" title="Create">{{ icon('add') }}</a></li>
<li><a href="{{ current_user.url() }}" title="Messages">{{ icon('message') }}</a></li>
<li><a href="https://trollface.dk" title="Notifications">{{ icon('notification') }}</a></li>
</ul>
</footer>
{% endif %}
<script>
function changeAccentColorTime() {
let hours = (new Date).getHours();
if (hours < 6 || hours >= 19) {
document.body.classList.add('night');
} else {
document.body.classList.remove('night');
}
}
changeAccentColorTime();
setInterval(changeAccentColorTime, 300000);
</script>
<script src="/static/js/lib.js"></script>
{% block scripts %}{% endblock %}
{% for private_script in private_scripts %}
<script src="{{ private_script }}"></script>
{% endfor %}
</body>
</html>