redid all the css almost
This commit is contained in:
parent
af956d09d1
commit
ec2a6a7a6d
36
Dockerfile
36
Dockerfile
@ -1,18 +1,18 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM python:3.12.2-slim-bookworm
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
|
||||
RUN useradd -m app
|
||||
|
||||
USER app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN python3 -m pip install --upgrade pip
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
|
||||
WORKDIR ./app
|
||||
|
||||
CMD ["python3", "-u", "app.py"]
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM python:3.12.2-slim-bookworm
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
|
||||
RUN useradd -m app
|
||||
|
||||
USER app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN python3 -m pip install --upgrade pip
|
||||
RUN python3 -m pip install -r requirements.txt
|
||||
|
||||
WORKDIR ./app
|
||||
|
||||
CMD ["python3", "-u", "app.py"]
|
||||
|
||||
18
README.md
18
README.md
@ -1,9 +1,9 @@
|
||||
# My-Website
|
||||
|
||||
Code of the website hosted at https://www.0x01fe.net
|
||||
|
||||
Could I gitignore the config files?
|
||||
Yes.
|
||||
Do I?
|
||||
no.
|
||||
|
||||
# My-Website
|
||||
|
||||
Code of the website hosted at https://www.0x01fe.net
|
||||
|
||||
Could I gitignore the config files?
|
||||
Yes.
|
||||
Do I?
|
||||
no.
|
||||
|
||||
|
||||
159
app/app.py
159
app/app.py
@ -1,77 +1,82 @@
|
||||
import glob
|
||||
import configparser
|
||||
import random
|
||||
|
||||
import flask
|
||||
import waitress
|
||||
import markdown
|
||||
|
||||
from post import Post
|
||||
|
||||
app = flask.Flask(__name__, static_url_path='', static_folder='static')
|
||||
|
||||
CONFIG_PATH = "./config.ini"
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
|
||||
POSTS_FOLDER = config['POSTS']['POSTS_FOLDER']
|
||||
STATUS_FILE = config['STATUS']['STATUS_FILE']
|
||||
PORT = int(config['NETWORK']['PORT'])
|
||||
DEV = int(config['NETWORK']['DEV'])
|
||||
|
||||
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')
|
||||
|
||||
posts: list[Post] = []
|
||||
for post_file in post_files:
|
||||
post = Post(post_file)
|
||||
|
||||
if not category_filter:
|
||||
posts.append(post)
|
||||
elif category_filter == post.category:
|
||||
posts.append(post)
|
||||
|
||||
# Order Posts by Date
|
||||
ordered_posts = []
|
||||
for i in range(len(posts)):
|
||||
|
||||
most_recent = posts[0]
|
||||
for p in posts:
|
||||
if p.date < most_recent.date:
|
||||
most_recent = p
|
||||
|
||||
ordered_posts.append(most_recent)
|
||||
posts.remove(most_recent)
|
||||
|
||||
return reversed(ordered_posts)
|
||||
|
||||
def get_status() -> str:
|
||||
with open(STATUS_FILE, 'r', encoding='utf-8') as file:
|
||||
statuses = file.readlines()
|
||||
|
||||
status = random.randint(0, len(statuses) - 1)
|
||||
|
||||
return markdown.markdown(statuses[status])
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
|
||||
# Get posts
|
||||
posts = get_posts()
|
||||
|
||||
post_bodies = []
|
||||
for post in posts:
|
||||
post_bodies.append(post.body)
|
||||
|
||||
# Get status
|
||||
status = get_status()
|
||||
|
||||
return flask.render_template('index.html', posts=post_bodies, status=status)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if DEV:
|
||||
app.run(port=PORT)
|
||||
else:
|
||||
waitress.serve(app, host='0.0.0.0', port=PORT)
|
||||
import glob
|
||||
import configparser
|
||||
import random
|
||||
|
||||
import flask
|
||||
import waitress
|
||||
import markdown
|
||||
|
||||
from post import Post
|
||||
|
||||
app = flask.Flask(__name__, static_url_path='', static_folder='static')
|
||||
|
||||
CONFIG_PATH = "./config.ini"
|
||||
config = configparser.ConfigParser()
|
||||
config.read(CONFIG_PATH)
|
||||
|
||||
POSTS_FOLDER = config['POSTS']['POSTS_FOLDER']
|
||||
STATUS_FILE = config['STATUS']['STATUS_FILE']
|
||||
PORT = int(config['NETWORK']['PORT'])
|
||||
DEV = int(config['NETWORK']['DEV'])
|
||||
|
||||
def get_posts(category_filter : str | None = None) -> list[Post]:
|
||||
post_files = glob.glob(f'{POSTS_FOLDER}/*')
|
||||
try:
|
||||
post_files.remove(f'{POSTS_FOLDER}/POST_TEMPLATE.md')
|
||||
except ValueError as e:
|
||||
print(e)
|
||||
print(f'Couldn\'t remove the template file probably; {post_files}')
|
||||
exit()
|
||||
|
||||
posts: list[Post] = []
|
||||
for post_file in post_files:
|
||||
post = Post(post_file)
|
||||
|
||||
if not category_filter:
|
||||
posts.append(post)
|
||||
elif category_filter == post.category:
|
||||
posts.append(post)
|
||||
|
||||
# Order Posts by Date
|
||||
ordered_posts = []
|
||||
for i in range(len(posts)):
|
||||
|
||||
most_recent = posts[0]
|
||||
for p in posts:
|
||||
if p.date < most_recent.date:
|
||||
most_recent = p
|
||||
|
||||
ordered_posts.append(most_recent)
|
||||
posts.remove(most_recent)
|
||||
|
||||
return reversed(ordered_posts)
|
||||
|
||||
def get_status() -> str:
|
||||
with open(STATUS_FILE, 'r', encoding='utf-8') as file:
|
||||
statuses = file.readlines()
|
||||
|
||||
status = random.randint(0, len(statuses) - 1)
|
||||
|
||||
return markdown.markdown(statuses[status])
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
|
||||
# Get posts
|
||||
posts = get_posts()
|
||||
|
||||
post_bodies = []
|
||||
for post in posts:
|
||||
post_bodies.append(post.body)
|
||||
|
||||
# Get status
|
||||
status = get_status()
|
||||
|
||||
return flask.render_template('index.html', posts=post_bodies, status=status)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if DEV:
|
||||
app.run(port=PORT)
|
||||
else:
|
||||
waitress.serve(app, host='0.0.0.0', port=PORT)
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
[POSTS]
|
||||
posts_folder=./posts
|
||||
|
||||
[STATUS]
|
||||
status_file=./resources/status.text
|
||||
|
||||
[NETWORK]
|
||||
PORT=1111
|
||||
[POSTS]
|
||||
posts_folder=./posts
|
||||
|
||||
[STATUS]
|
||||
status_file=./resources/status.text
|
||||
|
||||
[NETWORK]
|
||||
PORT=1111
|
||||
DEV=1
|
||||
|
||||
50
app/post.py
50
app/post.py
@ -1,25 +1,25 @@
|
||||
import markdown
|
||||
import datetime
|
||||
|
||||
class Post:
|
||||
|
||||
category : str
|
||||
author : str
|
||||
date : datetime.datetime
|
||||
body : str
|
||||
file : str
|
||||
|
||||
def __init__(self, file_path):
|
||||
self.file = file_path
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
lines = file.readlines()
|
||||
|
||||
self.category = lines[1].split(":")[1].strip()
|
||||
self.author = lines[2].split(":")[1].strip()
|
||||
|
||||
date = lines[3].split(":")[1].strip()
|
||||
self.date = datetime.datetime.strptime(date, "%d-%m-%Y")
|
||||
|
||||
self.body = markdown.markdown(''.join(lines[6:]))
|
||||
|
||||
import markdown
|
||||
import datetime
|
||||
|
||||
class Post:
|
||||
|
||||
category : str
|
||||
author : str
|
||||
date : datetime.datetime
|
||||
body : str
|
||||
file : str
|
||||
|
||||
def __init__(self, file_path):
|
||||
self.file = file_path
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
lines = file.readlines()
|
||||
|
||||
self.category = lines[1].split(":")[1].strip()
|
||||
self.author = lines[2].split(":")[1].strip()
|
||||
|
||||
date = lines[3].split(":")[1].strip()
|
||||
self.date = datetime.datetime.strptime(date, "%d-%m-%Y")
|
||||
|
||||
self.body = markdown.markdown(''.join(lines[6:]))
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
# Metadata
|
||||
category: category
|
||||
author: author
|
||||
date: date
|
||||
|
||||
# POST
|
||||
## TITLE
|
||||
### DATE OR SUBTITLE
|
||||
POST TEXT
|
||||
# Metadata
|
||||
category: category
|
||||
author: author
|
||||
date: date
|
||||
|
||||
# POST
|
||||
## TITLE
|
||||
### DATE OR SUBTITLE
|
||||
POST TEXT
|
||||
|
||||
@ -1,31 +1,31 @@
|
||||
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 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
|
||||
~ Nuclear Fusion
|
||||
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 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
|
||||
~ Nuclear Fusion
|
||||
Check out [NEUPINK](https://neupink.bandcamp.com/album/swordflower-hills-killer-2)!
|
||||
@ -1,124 +1,152 @@
|
||||
/* Global Settings */
|
||||
@font-face {
|
||||
font-family: ibmplexmono;
|
||||
src: url(./IBMPlexMono-Regular.woff) format('woff');
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
/* font-family: 'Courier New', Courier, monospace; */
|
||||
font-family: ibmplexmono;
|
||||
}
|
||||
|
||||
a {
|
||||
color: black;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: hotpink;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Other */
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
|
||||
margin: 10pt;
|
||||
|
||||
border-style: solid;
|
||||
border-color: #1E2022;
|
||||
background-color: #F0F5F9;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.header a {
|
||||
text-decoration: none;
|
||||
color: #703be7;
|
||||
}
|
||||
|
||||
.container {
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
border-style: solid;
|
||||
border-color: #1E2022;
|
||||
background-color: #F0F5F9;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
order: 1;
|
||||
height: fit-content;
|
||||
float: left;
|
||||
|
||||
padding: 20pt;
|
||||
padding-bottom: 5em;
|
||||
|
||||
margin: 15pt;
|
||||
|
||||
border-style: solid;
|
||||
border-radius: 10px;
|
||||
border-color: #1E2022;
|
||||
background-color: #C9D6DF;
|
||||
|
||||
opacity: 0.9;
|
||||
|
||||
/* Text Settings */
|
||||
font-weight: bold;
|
||||
line-height: 30pt;
|
||||
}
|
||||
|
||||
.sidebar a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
.dlog {
|
||||
order: 2;
|
||||
flex: 3;
|
||||
/* text-align: center; */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
padding: 10pt;
|
||||
margin: 15pt;
|
||||
margin-left: 15%;
|
||||
margin-right: 15%;
|
||||
|
||||
border-style: solid;
|
||||
border-radius: 20px;
|
||||
border-color: #1E2022;
|
||||
background-color: #C9D6DF;
|
||||
}
|
||||
|
||||
.post {
|
||||
/* opacity: 0.9; */
|
||||
|
||||
border: 2px solid #52616B;
|
||||
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 {
|
||||
text-indent: 3em;
|
||||
}
|
||||
/* Global Stuff */
|
||||
@import url('https://fonts.googleapis.com/css?family=PT%20Mono:700|PT%20Mono:400');
|
||||
|
||||
body {
|
||||
font-family: 'PT Mono';
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: 'PT Mono';
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
html {
|
||||
--text: hsl(224, 83%, 91%);
|
||||
--background: hsl(224, 31%, 23%);
|
||||
--primary: hsl(229, 81%, 73%);
|
||||
--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%);
|
||||
--accent50: hsla(291, 81%, 60%, 50%);
|
||||
|
||||
--main-background: var(--primary10);
|
||||
--borders-style: hidden;
|
||||
--border-radius: 15px;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
color: var(--text);
|
||||
background-color: var(--background);
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Other */
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
|
||||
margin: 0 30%;
|
||||
padding: 2em;
|
||||
|
||||
border-style: var(--borders-style);
|
||||
border-color: #1E2022;
|
||||
background-color: var(--background);
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
.header a {
|
||||
text-decoration: none;
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.container {
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
margin: 0px 20%;
|
||||
|
||||
border-style: var(--borders-style);
|
||||
border-color: #1E2022;
|
||||
background-color: var(--main-background);
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
order: 1;
|
||||
height: fit-content;
|
||||
float: left;
|
||||
|
||||
padding: 20pt;
|
||||
|
||||
margin: 5em 0;
|
||||
margin-left: 2em;
|
||||
|
||||
border-style: var(--borders-style);
|
||||
border-radius: var(--border-radius);
|
||||
border-color: #1E2022;
|
||||
background-color: var(--main-background);
|
||||
|
||||
opacity: 0.9;
|
||||
|
||||
/* Text Settings */
|
||||
font-weight: bold;
|
||||
line-height: 30pt;
|
||||
}
|
||||
|
||||
.sidebar a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
.dlog {
|
||||
order: 2;
|
||||
flex: 3;
|
||||
/* text-align: center; */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
padding: 10pt;
|
||||
margin: 0 5%;
|
||||
margin-left: 0;
|
||||
|
||||
border-style: var(--borders-style);
|
||||
border-radius: var(--border-radius);
|
||||
border-color: #1E2022;
|
||||
/* background-color: var(--main-background); */
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
@ -1,31 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<header>
|
||||
<link rel="shortcut icon" href="index_favicon.ico">
|
||||
<link rel="stylesheet" href="index_style.css">
|
||||
<title>0x01fe.net</title>
|
||||
</header>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1>0x01fe.net</h1>
|
||||
<h4>{{ status|safe }}</h4>
|
||||
</div>
|
||||
<div class="container">
|
||||
<!-- Sidebar -->
|
||||
<div class="sidebar">
|
||||
<a href="./">Home</a><br>
|
||||
<a href="">Media</a><br>
|
||||
<a href="">Programming</a><br>
|
||||
<a href="">About</a>
|
||||
</div>
|
||||
|
||||
<!-- Main Page -->
|
||||
<!-- Get it? D-Log? Like digital log? -->
|
||||
<div class="dlog">
|
||||
{% for post in posts %}
|
||||
<div class="post">{{ post|safe }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<header>
|
||||
<link rel="shortcut icon" href="index_favicon.ico">
|
||||
<link rel="stylesheet" href="index_style.css">
|
||||
<title>0x01fe.net</title>
|
||||
</header>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1>0x01fe.net</h1>
|
||||
{{ status|safe }}
|
||||
</div>
|
||||
<div class="container">
|
||||
<!-- Sidebar -->
|
||||
<div class="sidebar">
|
||||
<a href="./">Home</a><br>
|
||||
<a href="">Media</a><br>
|
||||
<a href="">Programming</a><br>
|
||||
<a href="">About</a>
|
||||
</div>
|
||||
|
||||
<!-- Main Page -->
|
||||
<!-- Get it? D-Log? Like digital log? -->
|
||||
<div class="dlog">
|
||||
{% for post in posts %}
|
||||
<div class="post">{{ post|safe }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Markdown==3.5.2
|
||||
Flask==2.2.3
|
||||
waitress==2.1.2
|
||||
Markdown==3.5.2
|
||||
Flask==2.2.3
|
||||
waitress==2.1.2
|
||||
Werkzeug==2.2.3
|
||||
Loading…
x
Reference in New Issue
Block a user