diff --git a/helpers.py b/helpers.py index 179218e0..86056f38 100644 --- a/helpers.py +++ b/helpers.py @@ -51,7 +51,7 @@ def message(color, message): f"\033[95m {currentTime(True)}]\033[0m" f"\033[9{color}m {message}\033[0m\n" ) - logFile = open("log.log", "a") + logFile = open("log.log", "a", encoding="utf-8") logFile.write(f"[{currentDate()}" f"|{currentTime(True)}]" f" {message}\n") logFile.close() diff --git a/routes/editPost.py b/routes/editPost.py index eebd6289..927272ee 100644 --- a/routes/editPost.py +++ b/routes/editPost.py @@ -56,13 +56,16 @@ def editPost(postID): connection = sqlite3.connect("db/posts.db") cursor = connection.cursor() cursor.execute( - f'update posts set title = "{postTitle}" where id = {post[0]}' + """update posts set title = ? where id = ? """, + (postTitle, post[0]), ) cursor.execute( - f'update posts set tags = "{postTags}" where id = {post[0]}' + """update posts set tags = ? where id = ? """, + (postTags, post[0]), ) cursor.execute( - f'update posts set content = "{postContent}" where id = {post[0]}' + """update posts set content = ? where id = ? """, + (postContent, post[0]), ) cursor.execute( f'update posts set lastEditDate = "{currentDate()}" where id = {post[0]}' diff --git a/static/css/post.css b/static/css/post.css new file mode 100644 index 00000000..9fa1d72f --- /dev/null +++ b/static/css/post.css @@ -0,0 +1,121 @@ +.post { + display: flex; + flex-direction: column; + max-width: 50rem; + margin-top: 1.5rem; +} + +.post p img { + max-width: 100%; +} + +.post h1 { + text-align: center; +} + +.title { + font-size: 2rem; +} + +.bottomBar { + display: flex; + align-items: stretch; + justify-content: space-between; +} + +.linkLogin { + color: var(--primaryColor); + transition: 0.25s; +} + +.linkLogin:hover { + color: var(--themePrimary); +} + +.comment { + display: block; + width: 25rem; + height: 8rem; + background-color: transparent; + border: none; + resize: none; + padding: 1rem; + font-size: 0.8rem; +} + +.comment:focus { + outline: none; +} + +small { + font-size: 0.75rem; +} + +.btnSubmit { + background-color: var(--primaryColor); + color: var(--themeSecondary); + border: 0px; + border-radius: 1rem; + height: 2rem; + width: 5rem; + font-size: 0.75rem; + transition: 0.25s; + margin: auto 0.5rem 0.5rem 0rem; + cursor: pointer; +} + +.btnSubmit:hover { + background-color: transparent; + color: var(--primaryColor); +} + +.commentForm { + margin: 2rem auto 0 auto; + display: flex; + justify-content: space-between; + width: fit-content; + border: 1px solid var(--primaryColor); + border-radius: 1rem; +} + +.comments { + margin: 3rem auto 0 auto; + width: 32rem; + font-size: 0.75rem; + display: flex; + justify-content: space-between; + flex-wrap: wrap; + align-items: center; +} + +.commentUserNameContainer { + font-size: 0.7rem; + margin-right: 2rem; +} + +.commentUserNameContainer p { + margin: 0; +} + +.profilePicture { + margin-right: 0.6rem; +} + +.dateTime h5 { + text-align: right; +} + +@media screen and (max-width: 600px) { + .comments, + .comments small { + max-width: 100% !important; + } + + .commentForm textarea { + width: 100%; + } + + .navbar * { + width: 100%; + } +}