From d22af9734e5e9a345674012f7cd26603f93dd7cc Mon Sep 17 00:00:00 2001 From: 0x01fe Date: Mon, 11 Mar 2024 15:30:26 -0500 Subject: [PATCH] css changes --- app/resources/status.text | 28 ++++++++++++++++++++++++++++ app/static/index_style.css | 4 ++++ app/templates/index.html | 2 +- app/website.py | 25 +++++++++++++++++++++---- config.ini | 3 +++ 5 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 app/resources/status.text diff --git a/app/resources/status.text b/app/resources/status.text new file mode 100644 index 0000000..a00b8ec --- /dev/null +++ b/app/resources/status.text @@ -0,0 +1,28 @@ +Catchy Right? +Everybody's lazy when they're tired +As long as there is delusion, there is hope +It's 510. +Mindful of the weary inkling that is lurking +Mortal traffic lights signaling when to stay or go +Cyber surgeon, Javascript person +Bone-dried swamplands swallow me +House of dust, land of bone +I ate dirt, I drank stone +Come on, snake, punish me +Drip, drip from the tap, don't slip on the drip +His name really is Tim. +Just wait until you see the 1 in 1000 message. +I'm open to suggestions on how to improve the look of the website +Open the curtains +Don't miss a moment of this experiment +Needles +Sally forth Rocinante! +The multitude tightens its hold. +It's amazing what you'll find face to face +It's not hard to go the distance, When you finally get involved face to face +A tourist in a dream, A visitor, it seems, A half-forgotten song, Where do I belong? +What do you mean ... You can't see it? +I don't believe you, your eyes deceive you, better check yourself in +You will say I'm crazy, I will go on my way 'cause it's what I need +I'd cross a thousand seas just to prove I'm not mad +I thoguht I saw a statue blink, and a bird with no head, Land on a golden thread, I rub my eyes, What am I saying? There's nothing there \ No newline at end of file diff --git a/app/static/index_style.css b/app/static/index_style.css index e769f78..ba2680c 100644 --- a/app/static/index_style.css +++ b/app/static/index_style.css @@ -100,12 +100,16 @@ a:hover { border-radius: 10px; padding: 10pt; + padding-left: 20pt; + padding-right: 20pt; margin: 10pt; margin-left: 20pt; margin-right: 20pt; background-color: #C9D6DF; + + line-height: 1.25em; } .post p { diff --git a/app/templates/index.html b/app/templates/index.html index f697cd3..e23ece6 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -8,7 +8,7 @@

0x01fe.net

-

Catchy Right‽

+

{{ status }}

diff --git a/app/website.py b/app/website.py index 86c2cc5..e0976ba 100644 --- a/app/website.py +++ b/app/website.py @@ -1,5 +1,6 @@ import glob import configparser +import random import flask @@ -7,12 +8,14 @@ from post import Post app = flask.Flask(__name__, static_url_path='', static_folder='static') +CONFIG_PATH = "../config.ini" config = configparser.ConfigParser() -config.read("config.ini") +config.read(CONFIG_PATH) POSTS_FOLDER = config['POSTS']['POSTS_FOLDER'] +STATUS_FILE = config['STATUS']['STATUS_FILE'] -def get_posts() -> list[Post]: +def get_posts(category_filter : str | None = None) -> list[Post]: post_files= glob.glob(f'{POSTS_FOLDER}/*') post_files.remove(f'{POSTS_FOLDER}\\POST_TEMPLATE.md') @@ -20,7 +23,10 @@ def get_posts() -> list[Post]: for post_file in post_files: post = Post(post_file) - posts.append(post) + if not category_filter: + posts.append(post) + elif category_filter == post.category: + posts.append(post) # Order Posts by Date ordered_posts = [] @@ -36,6 +42,14 @@ def get_posts() -> list[Post]: return reversed(ordered_posts) +def get_status() -> str: + with open(STATUS_FILE, 'r') as file: + statuses = file.readlines() + + status = random.randint(0, len(statuses) - 1) + + return statuses[status] + @app.route('/') def index(): @@ -46,7 +60,10 @@ def index(): for post in posts: post_bodies.append(post.body) - return flask.render_template('index.html', posts=post_bodies) + # Get status + status = get_status() + + return flask.render_template('index.html', posts=post_bodies, status=status) if __name__ == "__main__": diff --git a/config.ini b/config.ini index 1d1d915..63cc0da 100644 --- a/config.ini +++ b/config.ini @@ -1,5 +1,8 @@ [POSTS] posts_folder=./posts +[STATUS] +status_file=./resources/status.text + [NETWORK] PORT=1111