removed all(?) of the comments stuff

This commit is contained in:
0x01FE 2025-01-29 09:01:05 -06:00
parent c2f829d39b
commit 4dc412d9be
7 changed files with 5 additions and 104 deletions

View File

@ -13,12 +13,8 @@ import waitress
import markdown import markdown
from post import Post from post import Post
import comment
import user
app = flask.Flask(__name__, static_url_path='', static_folder='static') app = flask.Flask(__name__, static_url_path='', static_folder='static')
app.register_blueprint(comment.comments)
app.register_blueprint(user.user)
# CONFIG # CONFIG
CONFIG_PATH = "./config.ini" CONFIG_PATH = "./config.ini"
@ -127,20 +123,12 @@ def index():
# Get posts # Get posts
posts = get_posts() posts = get_posts()
if 'username' in flask.session:
user = flask.session['username']
else:
user = 'Anon'
# Get status # Get status
status = get_status() status = get_status()
# Setup Comment Form
form = comment.CommentForm()
img = get_header_image() img = get_header_image()
return flask.render_template('index.html', posts=posts, status=status, form=form, user=user, title='0x01fe.net', header_background_image=img) return flask.render_template('index.html', posts=posts, status=status, title='0x01fe.net', header_background_image=img)
# Posts # Posts
@app.route('/post/<string:post_name>') @app.route('/post/<string:post_name>')
@ -149,15 +137,7 @@ def post(post_name: str):
for post in get_posts(): for post in get_posts():
if post['title'] == post_name: if post['title'] == post_name:
if 'username' in flask.session: return flask.render_template('index.html', posts=[post], status=get_status(), title='0x01fe.net')
user = flask.session['username']
else:
user = 'Anon'
# Setup Comment Form
form = comment.CommentForm()
return flask.render_template('index.html', posts=[post], status=get_status(), form=form, user=user, title='0x01fe.net')
flask.abort(404) flask.abort(404)
@ -168,18 +148,10 @@ def category_filter(category: str):
# Get posts # Get posts
posts = get_posts(category_filter=category) posts = get_posts(category_filter=category)
if 'username' in flask.session:
user = flask.session['username']
else:
user = 'Anon'
# Get status # Get status
status = get_status() status = get_status()
# Setup Comment Form return flask.render_template('index.html', posts=posts, status=status, title=category.replace('-', ' '))
form = comment.CommentForm()
return flask.render_template('index.html', posts=posts, status=status, form=form, user=user, title=category.replace('-', ' '))
# Music Page # Music Page
@app.route('/music/') @app.route('/music/')
@ -188,11 +160,6 @@ def music():
# Get posts # Get posts
posts = get_posts(category_filter="music") posts = get_posts(category_filter="music")
if 'username' in flask.session:
user = flask.session['username']
else:
user = 'Anon'
# Get status # Get status
status = get_status() status = get_status()
@ -214,10 +181,8 @@ def music():
top_albums[album_index]['listen_time'] = hours top_albums[album_index]['listen_time'] = hours
# Setup Comment Form
form = comment.CommentForm()
return flask.render_template('music.html', posts=posts, status=status, top_albums=top_albums, form=form, user=user) return flask.render_template('music.html', posts=posts, status=status, top_albums=top_albums)
# Programming Page # Programming Page
@app.route('/programming/') @app.route('/programming/')
@ -226,18 +191,10 @@ def programming():
# Get posts # Get posts
posts_and_comments = get_posts(category_filter="programming") posts_and_comments = get_posts(category_filter="programming")
if 'username' in flask.session:
user = flask.session['username']
else:
user = 'Anon'
# Get status # Get status
status = get_status() status = get_status()
# Setup Comment Form return flask.render_template('programming.html', posts=posts_and_comments, status=status)
form = comment.CommentForm()
return flask.render_template('programming.html', posts=posts_and_comments, form=form, user=user, status=status)
# About Page # About Page
@app.route('/about/') @app.route('/about/')

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 KiB

View File

@ -31,24 +31,6 @@
{{ post.date_str }} {{ post.date_str }}
</div> </div>
{{ post.body|safe }} {{ post.body|safe }}
<div class="comment-container">
<h2>Comments</h2>
{% for comment in post.comments %}
<div class="comment">
<h4>{{ comment.username }}</h4>
<p>{{ comment.content }}</p>
</div>
{% endfor %}
{% if user %}
<div class="comment-editor">
<h4>{{ user }}</h4>
<form method="post" action="/comment/{{ post.title }}">
{{ form.hidden_tag() }}
{{ form.textbox }}
<input type="submit" value="Save">
</form>
</div>
{% endif %}
</div> </div>
</div> </div>
{% endfor %} {% endfor %}

View File

@ -31,25 +31,6 @@
{{ post.date_str }} {{ post.date_str }}
</div> </div>
{{ post.body|safe }} {{ post.body|safe }}
<div class="comment-container">
<h2>Comments</h2>
{% for comment in post.comments %}
<div class="comment">
<h4>{{ comment.username }}</h4>
<p>{{ comment.content }}</p>
</div>
{% endfor %}
{% if user %}
<div class="comment-editor">
<h4>{{ user }}</h4>
<form method="post" action="/comment/{{ post.title }}">
{{ form.hidden_tag() }}
{{ form.textbox }}
<input type="submit" value="Save">
</form>
</div>
{% endif %}
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -31,25 +31,6 @@
{{ post.date_str }} {{ post.date_str }}
</div> </div>
{{ post.body|safe }} {{ post.body|safe }}
<div class="comment-container">
<h2>Comments</h2>
{% for comment in post.comments %}
<div class="comment">
<h4>{{ comment.username }}</h4>
<p>{{ comment.content }}</p>
</div>
{% endfor %}
{% if user %}
<div class="comment-editor">
<h4>{{ user }}</h4>
<form method="post" action="/comment/{{ post.title }}">
{{ form.hidden_tag() }}
{{ form.textbox }}
<input type="submit" value="Save">
</form>
</div>
{% endif %}
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>