added some checks for user/comments files
This commit is contained in:
parent
724e0ac3d9
commit
2542b6862c
@ -161,7 +161,7 @@ def post(post_name: str):
|
|||||||
|
|
||||||
flask.abort(404)
|
flask.abort(404)
|
||||||
|
|
||||||
# Games Page
|
# Category's Endpoint
|
||||||
@app.route('/category/<string:category>/')
|
@app.route('/category/<string:category>/')
|
||||||
def category_filter(category: str):
|
def category_filter(category: str):
|
||||||
|
|
||||||
@ -264,10 +264,6 @@ def writing():
|
|||||||
|
|
||||||
return flask.render_template('writing.html', works=works)
|
return flask.render_template('writing.html', works=works)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# About Page
|
# About Page
|
||||||
@app.route('/about/')
|
@app.route('/about/')
|
||||||
def about():
|
def about():
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
import flask_wtf.csrf
|
import flask_wtf.csrf
|
||||||
@ -53,4 +54,8 @@ def get_comments(post_title : int) -> list[dict]:
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
# Check Comments file exists
|
||||||
|
if not os.path.exists(COMMENTS_PATH):
|
||||||
|
with open(COMMENTS_PATH, 'w+') as file:
|
||||||
|
file.write('{}')
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
import flask_wtf.csrf
|
import flask_wtf.csrf
|
||||||
@ -94,3 +95,8 @@ def logout_user():
|
|||||||
flask.session.pop('username')
|
flask.session.pop('username')
|
||||||
|
|
||||||
return flask.redirect('/')
|
return flask.redirect('/')
|
||||||
|
|
||||||
|
# Check User file exists
|
||||||
|
if not os.path.exists(USERS_PATH):
|
||||||
|
with open(USERS_PATH, 'w+') as file:
|
||||||
|
file.write('{}')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user