redid all the css almost

This commit is contained in:
0x01fe 2024-03-14 14:44:33 -05:00
parent af956d09d1
commit ec2a6a7a6d
10 changed files with 368 additions and 334 deletions

View File

@ -1,18 +1,18 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM python:3.12.2-slim-bookworm FROM python:3.12.2-slim-bookworm
RUN apt-get update && apt-get upgrade -y RUN apt-get update && apt-get upgrade -y
RUN useradd -m app RUN useradd -m app
USER app USER app
COPY . . COPY . .
RUN python3 -m pip install --upgrade pip RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install -r requirements.txt RUN python3 -m pip install -r requirements.txt
WORKDIR ./app WORKDIR ./app
CMD ["python3", "-u", "app.py"] CMD ["python3", "-u", "app.py"]

View File

@ -1,9 +1,9 @@
# My-Website # My-Website
Code of the website hosted at https://www.0x01fe.net Code of the website hosted at https://www.0x01fe.net
Could I gitignore the config files? Could I gitignore the config files?
Yes. Yes.
Do I? Do I?
no. no.

View File

@ -1,77 +1,82 @@
import glob import glob
import configparser import configparser
import random import random
import flask import flask
import waitress import waitress
import markdown import markdown
from post import Post from post import Post
app = flask.Flask(__name__, static_url_path='', static_folder='static') app = flask.Flask(__name__, static_url_path='', static_folder='static')
CONFIG_PATH = "./config.ini" CONFIG_PATH = "./config.ini"
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read(CONFIG_PATH) config.read(CONFIG_PATH)
POSTS_FOLDER = config['POSTS']['POSTS_FOLDER'] POSTS_FOLDER = config['POSTS']['POSTS_FOLDER']
STATUS_FILE = config['STATUS']['STATUS_FILE'] STATUS_FILE = config['STATUS']['STATUS_FILE']
PORT = int(config['NETWORK']['PORT']) PORT = int(config['NETWORK']['PORT'])
DEV = int(config['NETWORK']['DEV']) DEV = int(config['NETWORK']['DEV'])
def get_posts(category_filter : str | None = None) -> list[Post]: def get_posts(category_filter : str | None = None) -> list[Post]:
post_files = glob.glob(f'{POSTS_FOLDER}/*') post_files = glob.glob(f'{POSTS_FOLDER}/*')
post_files.remove(f'{POSTS_FOLDER}/POST_TEMPLATE.md') try:
post_files.remove(f'{POSTS_FOLDER}/POST_TEMPLATE.md')
posts: list[Post] = [] except ValueError as e:
for post_file in post_files: print(e)
post = Post(post_file) print(f'Couldn\'t remove the template file probably; {post_files}')
exit()
if not category_filter:
posts.append(post) posts: list[Post] = []
elif category_filter == post.category: for post_file in post_files:
posts.append(post) post = Post(post_file)
# Order Posts by Date if not category_filter:
ordered_posts = [] posts.append(post)
for i in range(len(posts)): elif category_filter == post.category:
posts.append(post)
most_recent = posts[0]
for p in posts: # Order Posts by Date
if p.date < most_recent.date: ordered_posts = []
most_recent = p for i in range(len(posts)):
ordered_posts.append(most_recent) most_recent = posts[0]
posts.remove(most_recent) for p in posts:
if p.date < most_recent.date:
return reversed(ordered_posts) most_recent = p
def get_status() -> str: ordered_posts.append(most_recent)
with open(STATUS_FILE, 'r', encoding='utf-8') as file: posts.remove(most_recent)
statuses = file.readlines()
return reversed(ordered_posts)
status = random.randint(0, len(statuses) - 1)
def get_status() -> str:
return markdown.markdown(statuses[status]) with open(STATUS_FILE, 'r', encoding='utf-8') as file:
statuses = file.readlines()
@app.route('/')
def index(): status = random.randint(0, len(statuses) - 1)
# Get posts return markdown.markdown(statuses[status])
posts = get_posts()
@app.route('/')
post_bodies = [] def index():
for post in posts:
post_bodies.append(post.body) # Get posts
posts = get_posts()
# Get status
status = get_status() post_bodies = []
for post in posts:
return flask.render_template('index.html', posts=post_bodies, status=status) post_bodies.append(post.body)
# Get status
if __name__ == "__main__": status = get_status()
if DEV:
app.run(port=PORT) return flask.render_template('index.html', posts=post_bodies, status=status)
else:
waitress.serve(app, host='0.0.0.0', port=PORT)
if __name__ == "__main__":
if DEV:
app.run(port=PORT)
else:
waitress.serve(app, host='0.0.0.0', port=PORT)

View File

@ -1,8 +1,9 @@
[POSTS] [POSTS]
posts_folder=./posts posts_folder=./posts
[STATUS] [STATUS]
status_file=./resources/status.text status_file=./resources/status.text
[NETWORK] [NETWORK]
PORT=1111 PORT=1111
DEV=1

View File

@ -1,25 +1,25 @@
import markdown import markdown
import datetime import datetime
class Post: class Post:
category : str category : str
author : str author : str
date : datetime.datetime date : datetime.datetime
body : str body : str
file : str file : str
def __init__(self, file_path): def __init__(self, file_path):
self.file = file_path self.file = file_path
with open(file_path, 'r', encoding='utf-8') as file: with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines() lines = file.readlines()
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()
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(''.join(lines[6:]))

View File

@ -1,9 +1,9 @@
# Metadata # Metadata
category: category category: category
author: author author: author
date: date date: date
# POST # POST
## TITLE ## TITLE
### DATE OR SUBTITLE ### DATE OR SUBTITLE
POST TEXT POST TEXT

View File

@ -1,31 +1,31 @@
Catchy Right? Catchy Right?
Everybody's lazy when they're tired Everybody's lazy when they're tired
As long as there is delusion, there is hope As long as there is delusion, there is hope
It's 510. It's 510.
Mindful of the weary inkling that is lurking Mindful of the weary inkling that is lurking
Mortal traffic lights signaling when to stay or go Mortal traffic lights signaling when to stay or go
Cyber surgeon, Javascript person Cyber surgeon, Javascript person
Bone-dried swamplands swallow me Bone-dried swamplands swallow me
House of dust, land of bone House of dust, land of bone
I ate dirt, I drank stone I ate dirt, I drank stone
Come on, snake, punish me Come on, snake, punish me
Drip, drip from the tap, don't slip on the drip Drip, drip from the tap, don't slip on the drip
His name really is Tim. His name really is Tim.
Just wait until you see the 1 in 1000 message. Just wait until you see the 1 in 1000 message.
I'm open to suggestions on how to improve the look of the website I'm open to suggestions on how to improve the look of the website
Open the curtains Open the curtains
Don't miss a moment of this experiment Don't miss a moment of this experiment
Needles Needles
Sally forth Rocinante! Sally forth Rocinante!
The multitude tightens its hold. The multitude tightens its hold.
It's amazing what you'll find face to face 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 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? 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? What do you mean ... You can't see it?
I don't believe you, your eyes deceive you, better check yourself in 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 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'd cross a thousand seas just to prove I'm not mad
I thought 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 I thought 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
Solar Sect of Mystic Wisdom Solar Sect of Mystic Wisdom
~ Nuclear Fusion ~ Nuclear Fusion
Check out [NEUPINK](https://neupink.bandcamp.com/album/swordflower-hills-killer-2)! Check out [NEUPINK](https://neupink.bandcamp.com/album/swordflower-hills-killer-2)!

View File

@ -1,124 +1,152 @@
/* Global Settings */ /* Global Stuff */
@font-face { @import url('https://fonts.googleapis.com/css?family=PT%20Mono:700|PT%20Mono:400');
font-family: ibmplexmono;
src: url(./IBMPlexMono-Regular.woff) format('woff'); body {
} font-family: 'PT Mono';
font-weight: 400;
}
body {
/* font-family: 'Courier New', Courier, monospace; */ h1, h2, h3, h4, h5 {
font-family: ibmplexmono; font-family: 'PT Mono';
} font-weight: 700;
}
a {
color: black; html {
} --text: hsl(224, 83%, 91%);
--background: hsl(224, 31%, 23%);
a:hover { --primary: hsl(229, 81%, 73%);
color: hotpink; --primary10: hsla(209, 61%, 71%, 10%);
} --primary20: hsla(209, 61%, 71%, 20%);
--primary40: hsla(209, 61%, 71%, 40%);
--secondary: hsl(277, 81%, 33%);
--accent: hsl(291, 81%, 60%);
--accent75: hsla(291, 81%, 60%, 75%);
/* Other */ --accent50: hsla(291, 81%, 60%, 50%);
.header { --main-background: var(--primary10);
text-align: center; --borders-style: hidden;
--border-radius: 15px;
margin: 10pt; }
border-style: solid;
border-color: #1E2022; body {
background-color: #F0F5F9; color: var(--text);
border-radius: 20px; background-color: var(--background);
} }
.header h1 { a {
font-family: Arial, Helvetica, sans-serif; color: var(--text);
} }
.header a { a:hover {
text-decoration: none; color: var(--accent);
color: #703be7; }
}
.container {
display: flex; /* Other */
flex-direction: row;
.header {
border-style: solid; text-align: center;
border-color: #1E2022;
background-color: #F0F5F9; margin: 0 30%;
border-radius: 20px; padding: 2em;
}
border-style: var(--borders-style);
.sidebar { border-color: #1E2022;
order: 1; background-color: var(--background);
height: fit-content; border-radius: var(--border-radius);
float: left; }
padding: 20pt; .header a {
padding-bottom: 5em; text-decoration: none;
color: var(--primary);
margin: 15pt; }
border-style: solid; .container {
border-radius: 10px;
border-color: #1E2022; display: flex;
background-color: #C9D6DF; flex-direction: row;
opacity: 0.9; margin: 0px 20%;
/* Text Settings */ border-style: var(--borders-style);
font-weight: bold; border-color: #1E2022;
line-height: 30pt; background-color: var(--main-background);
} border-radius: var(--border-radius);
}
.sidebar a {
text-decoration: none; .sidebar {
} order: 1;
height: fit-content;
float: left;
.dlog {
order: 2; padding: 20pt;
flex: 3;
/* text-align: center; */ margin: 5em 0;
margin-left: 2em;
display: flex;
flex-direction: column; border-style: var(--borders-style);
border-radius: var(--border-radius);
padding: 10pt; border-color: #1E2022;
margin: 15pt; background-color: var(--main-background);
margin-left: 15%;
margin-right: 15%; opacity: 0.9;
border-style: solid; /* Text Settings */
border-radius: 20px; font-weight: bold;
border-color: #1E2022; line-height: 30pt;
background-color: #C9D6DF; }
}
.sidebar a {
.post { text-decoration: none;
/* opacity: 0.9; */ }
border: 2px solid #52616B;
border-radius: 10px; .dlog {
order: 2;
padding: 10pt; flex: 3;
padding-left: 20pt; /* text-align: center; */
padding-right: 20pt;
display: flex;
margin: 10pt; flex-direction: column;
margin-left: 20pt;
margin-right: 20pt; padding: 10pt;
margin: 0 5%;
background-color: #C9D6DF; margin-left: 0;
line-height: 1.25em; border-style: var(--borders-style);
} border-radius: var(--border-radius);
border-color: #1E2022;
.post p { /* background-color: var(--main-background); */
text-indent: 3em; }
}
.post {
border-style: var(--borders-style);
border-radius: var(--border-radius);
padding: 1.5em 2em;
margin: 1em 2em;
/* background-color: var(--main-background); */
}
.post h2 {
text-decoration: underline;
text-decoration-style: solid;
text-decoration-thickness: 0.25em;
text-underline-offset: 6px;
text-decoration-color: var(--accent75);
}
.post h3 {
font-weight: 300;
font-size: 18px;
}
.post p {
line-height: 2.25;
text-indent: 3em;
}

View File

@ -1,31 +1,31 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<header> <header>
<link rel="shortcut icon" href="index_favicon.ico"> <link rel="shortcut icon" href="index_favicon.ico">
<link rel="stylesheet" href="index_style.css"> <link rel="stylesheet" href="index_style.css">
<title>0x01fe.net</title> <title>0x01fe.net</title>
</header> </header>
<body> <body>
<div class="header"> <div class="header">
<h1>0x01fe.net</h1> <h1>0x01fe.net</h1>
<h4>{{ status|safe }}</h4> {{ status|safe }}
</div> </div>
<div class="container"> <div class="container">
<!-- Sidebar --> <!-- Sidebar -->
<div class="sidebar"> <div class="sidebar">
<a href="./">Home</a><br> <a href="./">Home</a><br>
<a href="">Media</a><br> <a href="">Media</a><br>
<a href="">Programming</a><br> <a href="">Programming</a><br>
<a href="">About</a> <a href="">About</a>
</div> </div>
<!-- Main Page --> <!-- Main Page -->
<!-- Get it? D-Log? Like digital log? --> <!-- Get it? D-Log? Like digital log? -->
<div class="dlog"> <div class="dlog">
{% for post in posts %} {% for post in posts %}
<div class="post">{{ post|safe }}</div> <div class="post">{{ post|safe }}</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,4 +1,4 @@
Markdown==3.5.2 Markdown==3.5.2
Flask==2.2.3 Flask==2.2.3
waitress==2.1.2 waitress==2.1.2
Werkzeug==2.2.3 Werkzeug==2.2.3