feat: add app description config

This commit is contained in:
Ayo Ayco 2024-04-25 16:10:58 +02:00
parent 64f6308e86
commit 4ea9637e3a
2 changed files with 10 additions and 6 deletions

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title> <title>{{ app.title }}</title>
<link rel="stylesheet" href="https://webcomponent.io/reset.css" /> <link rel="stylesheet" href="https://webcomponent.io/reset.css" />
<style> <style>
body { body {
@ -102,8 +102,9 @@
</head> </head>
<body> <body>
<header> <header>
<h1>{{ title }}</h1>
<a href="/">go home</a></nav> <a href="/">go home</a></nav>
<h1>{{ app.title }}</h1>
<p>{{ app.description }}</p>
</header> </header>
<main> <main>
<ul> <ul>
@ -181,7 +182,7 @@
</main> </main>
<footer> <footer>
&copy; {{ attribution.year }} {{ attribution.owner }} &copy; {{ attribution.year }} {{ attribution.owner }}
<p>See the <a href="https://ayco.io/sh/threads">source code</a>. Or <a href="/">go home</a>.</p> <p>Powered by <a href="https://ayco.io/sh/threads">/threads</a></p>
</footer> </footer>
</body> </body>
</html> </html>

View file

@ -6,7 +6,10 @@ threads = Blueprint('threads', __name__, template_folder='template')
# TODO: move following to an app config or sqlite ######### # TODO: move following to an app config or sqlite #########
server = 'https://social.ayco.io' server = 'https://social.ayco.io'
thread_ids = ['112319729193615365', '112258065967208438'] thread_ids = ['112319729193615365', '112258065967208438']
title = "Ayo's Threads" app = {
"title":"Ayo's Threads",
"description": "Incubator for thoughts before they become a blog."
}
attribution = { attribution = {
"owner": "Ayo Ayco", "owner": "Ayo Ayco",
"year": "2024" "year": "2024"
@ -16,13 +19,13 @@ attribution = {
@threads.route('/') @threads.route('/')
def home(): def home():
statuses = fetch_statuses() statuses = fetch_statuses()
return render_template('threads.html', threads=statuses, title=title, attribution=attribution) return render_template('threads.html', threads=statuses, app=app, attribution=attribution)
@threads.route('/<path:id>') @threads.route('/<path:id>')
def thread(id): def thread(id):
if id in thread_ids: if id in thread_ids:
status = fetch_thread(id) status = fetch_thread(id)
return render_template('threads.html', threads=[status], title=title, attribution=attribution) return render_template('threads.html', threads=[status], app=app, attribution=attribution)
else: else:
return '<h1>Not Found</h1><p>¯\_(ツ)_/¯</p><a href="/">go home</a>', 404 return '<h1>Not Found</h1><p>¯\_(ツ)_/¯</p><a href="/">go home</a>', 404