diff --git a/main b/main index 2491f71..57a5084 100644 --- a/main +++ b/main @@ -7,6 +7,7 @@ import json import secrets import datetime import socket +import subprocess from itertools import groupby from waitress import serve from werkzeug.utils import secure_filename @@ -126,6 +127,8 @@ def get_session(id): return "error" return post +full_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip() +short_hash = subprocess.check_output(["git", "rev-parse", "--short=8", "HEAD"]).decode().strip() ALLOWED_EXTENSIONS = {"png", "apng", "jpg", "jpeg", "gif", "svg", "webp"} @@ -144,9 +147,9 @@ def main(): if usersession: userCookie = get_session(usersession) user = get_user(userCookie["id"]) - return render_template("main.html", userdata=user, posts=posts) + return render_template("main.html", userdata=user, posts=posts, full_hash=full_hash, short_hash=short_hash) else: - return render_template("main.html", posts=posts) + return render_template("main.html", posts=posts, full_hash=full_hash, short_hash=short_hash) @app.route("/chat", methods=("GET", "POST")) def chat(): diff --git a/static/css/style.css b/static/css/style.css index d677f44..7ac1133 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -19,6 +19,20 @@ body { z-index: 2; } +.bottom { + margin: 0; + border: solid; + border-color: grey; + border-width: 0; + border-bottom-width: 1px; + background-color: white; +} + +.bottom a { + color: lightgrey; + text-decoration: none; +} + .navbar .selected { border: solid; border-color: #f1b739; @@ -332,6 +346,14 @@ body { background-color: var(--gray-800); } + .bottom { + background-color: var(--gray-900); + } + + .bottom a { + color: var(--gray-700) + } + .navbar a, a { color: white; border-size: 0px; diff --git a/static/js/chat.js b/static/js/chat.js index 52d97c1..1c7194e 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -20,7 +20,11 @@ async function updateMessages(id) { const timeParagraph = document.createElement("p"); const { creator, content, id, created } = message; - messageParagraph.appendChild(document.createTextNode(`${creator.username}: ${content}`)); + // Check if the message content contains any links that are not image links and hide image links + const linkRegex = /(https?:\/\/[^\s]+(?$1"); + + messageParagraph.innerHTML = `${creator.username}: ${messageContent}`; messageParagraph.classList.add("messageParagraph"); messageParagraph.id = `messageParagraph${id}`; messageParagraph.appendChild(timeParagraph); diff --git a/templates/main.html b/templates/main.html index 1e1b17a..2a3932f 100644 --- a/templates/main.html +++ b/templates/main.html @@ -113,7 +113,12 @@ {% endfor %} - +