This commit is contained in:
Gnawmon 2024-04-16 18:00:28 +03:00
parent db9d0c6c82
commit b73a0da47e
4 changed files with 23 additions and 9 deletions

10
app.py
View File

@ -17,7 +17,7 @@ app = Flask(__name__, static_url_path='',
@app.route("/<name>/next")
def getNextUser(name):
if(not name in users):
return "user not found."
return render_template('404.html'), 404
nextUserId = users.index(name) + 1
if(nextUserId == len(users)):
nextUserId = 0
@ -27,7 +27,7 @@ def getNextUser(name):
@app.route("/<name>/previous")
def getPreviousUser(name):
if(not name in users):
return "user not found."
return render_template('404.html'), 404
nextUserId = users.index(name) - 1
if(nextUserId == -1):
nextUserId = len(users) -1
@ -37,7 +37,7 @@ def getPreviousUser(name):
@app.route("/<name>")
def getUserWebsite(name):
if(not name in users):
return "user not found."
return render_template('404.html'), 404
return redirect(websites[users.index(name)])
@ -52,6 +52,10 @@ def listUsers():
def home():
return render_template('index.html')
@app.errorhandler(404)
def pageNotFound(e):
return render_template('404.html'), 404
if __name__ == '__main__':
print("Running on http://127.0.0.1:9932")
serve(app, host='127.0.0.1', port=9932)

BIN
web/static/images/404.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

14
web/templates/404.html Normal file
View File

@ -0,0 +1,14 @@
<html>
<head>
<title>404</title>
<link rel="stylesheet" type="text/css" href="/css/style.css">
</head>
<body>
<h2>womp womp</h2>
<img src="/images/404.png">
<p>Page not found. <br> <br> Click <a href="/">here</a> to go back to the landing page.</p>
</body>
</html>

View File

@ -10,7 +10,7 @@
<h1>Bring</h1>
<p>Welcome to Bring's home page! A webring for humans. <br></p>
<h2>Members</h2>
<iframe style="border: none; " src="/users"></iframe>
<iframe style="border: none;" src="/users"></iframe>
<h2>Rules</h2>
<ul>
<li>be human</li>
@ -51,7 +51,7 @@
}
</code></div>
<div class="bnav">
<p><a href="http://b-gnawmon.vern.cc/username/previous" id="left"><</a> bring <a href="http://b-name.vern.cc/username/next" id="right">></a></p>
<p><a href="thisgoestonowherelol" id="left"><</a> bring <a href="thisgoestonowhereaswell" id="right">></a></p>
</div>
<p></p>
<h2>How can I sign up?</h2>
@ -60,8 +60,4 @@
<a href="http://git.vern.cc/Gnawmon/bring" style="text-align:end;">Source Code</a>
</body>
<script>
var div = document.getElementById('myDiv');
div.innerHTML = '<p>Hello, World!</p>';
</script>
</html>