more statuses & made posts linkable

This commit is contained in:
0x01fe 2024-06-24 16:05:04 -05:00
parent 471b223881
commit 11d54f4480
4 changed files with 38 additions and 5 deletions

View File

@ -86,9 +86,6 @@ def get_status() -> str:
selected_key = keys[random.randint(0, len(keys) - 1)] selected_key = keys[random.randint(0, len(keys) - 1)]
section: list = statuses[selected_key] section: list = statuses[selected_key]
print(selected_key)
print(section)
selected_status = section[random.randint(0, len(section) - 1)] selected_status = section[random.randint(0, len(section) - 1)]
return f'<div title="{selected_key}">{markdown.markdown(selected_status)}</div>' return f'<div title="{selected_key}">{markdown.markdown(selected_status)}</div>'
@ -109,6 +106,16 @@ def index():
return flask.render_template('index.html', posts=post_bodies, status=status) return flask.render_template('index.html', posts=post_bodies, status=status)
# Posts
@app.route('/post/<string:post_name>')
def post(post_name: str):
for post in get_posts():
if post.title.replace(' ', '-') == post_name:
return flask.render_template('index.html', posts=[post.body], status=get_status())
flask.abort(404)
# Games Page # Games Page
@app.route('/games/') @app.route('/games/')
def games(): def games():
@ -260,7 +267,6 @@ def album_square(user_id, rows : int):
if __name__ == "__main__": if __name__ == "__main__":
statuses = read_status_file() statuses = read_status_file()
print(statuses)
if DEV: if DEV:
app.run(port=PORT) app.run(port=PORT)

View File

@ -8,6 +8,8 @@ class Post:
date : datetime.datetime date : datetime.datetime
body : str body : str
file : str file : str
title : str
url : str
def __init__(self, file_path): def __init__(self, file_path):
self.file = file_path self.file = file_path
@ -17,9 +19,11 @@ class Post:
self.category = lines[1].split(":")[1].strip() self.category = lines[1].split(":")[1].strip()
self.author = lines[2].split(":")[1].strip() self.author = lines[2].split(":")[1].strip()
self.title = lines[6][2:-1]
self.url = '/post/' + self.title.replace(' ', '-')
date = lines[3].split(":")[1].strip() date = lines[3].split(":")[1].strip()
self.date = datetime.datetime.strptime(date, "%d-%m-%Y") self.date = datetime.datetime.strptime(date, "%d-%m-%Y")
self.body = markdown.markdown(''.join(lines[6:])) self.body = markdown.markdown(f'# [{self.title}]({self.url})\n' + ''.join(lines[7:]))

View File

@ -14,7 +14,10 @@ As long as there is delusion, there is hope
It's 510. It's 510.
Catchy Right? Catchy Right?
## TV / Movie Quotes
# Monogatari
I don't know everything, I only know what I know.
## Song Lyrics ## Song Lyrics
@ -90,3 +93,20 @@ Don't miss a moment of this experiment
If you're going to replace me // At least have the audacity to kill me thoroughly If you're going to replace me // At least have the audacity to kill me thoroughly
What's the color of the electric sheep you see? What's the color of the electric sheep you see?
Maybe we're all cold machines Maybe we're all cold machines
# Change by King Gizzard & The Lizard Wizard
We're changing pace // Higher stakes
So called heroes wearing fake capes
Buildings that you know // People come and go // Are a certain way
And then you get the news that obliterates your view // Amputate your truths // The signifiance has changed
Hospital inane // Meaningless and grey // But lie within the walls and the signifiance will change
What would it take for us to change the game? // Maybe our existence is signifiance in vain
# Candles by King Gizzard & The Lizard Wizard
This little man is too hot to handle // Set the funeral on fire with the candles
Praying to the gods at the top of a mountian // Better throwing all your pennies in a fountian
My little heart, as cold as a morgue // Let the weight of it drop like an iceberg
# Presumptuous by King Gizzard & The Lizard Wizard
Eggshell, landmine, stepping stones // Kindred spirits at a crossroads
The world we built is on a tilt // Bottled up inside and filled with guilt

View File

@ -2,6 +2,9 @@
<html lang="en"> <html lang="en">
<body> <body>
<a href="/">home</a> <a href="/">home</a>
<p>
This is just a little page where I post stuff I write. I was kind of unsure if I wanted this stuff out here but I think to those who know me it could serve as an interesting view into some thoughts that I don't often express elsewhere.
</p>
<br> <br>
<br> <br>
{% for work in works %} {% for work in works %}