add some stuff and whatnot
This commit is contained in:
parent
93937b20f8
commit
12310e3b83
6 changed files with 40 additions and 15 deletions
|
@ -1,12 +1,8 @@
|
|||
# infopage
|
||||
or https://infpg.pythonanywhere.com
|
||||
or https://infopg.web.app
|
||||
|
||||
it's like pronouns.page but i made it
|
||||
|
||||
### todo
|
||||
* social links
|
||||
* sexuality/gender flags
|
||||
* 404 page
|
||||
* embed meta tags
|
||||
* short url redir
|
||||
* make displ name default to `x["username"]`
|
23
_server.py
23
_server.py
|
@ -15,6 +15,16 @@ from werkzeug.middleware.proxy_fix import ProxyFix
|
|||
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
def validate_color(color: str) -> bool:
|
||||
if len(color) != 7 or color[0] != "#":
|
||||
return False
|
||||
|
||||
for i in color[1::]:
|
||||
if i not in "abcdef0123456789":
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def sort_list(l: list[list[str]]) -> list[list[str]]:
|
||||
output = []
|
||||
for i in l:
|
||||
|
@ -128,7 +138,7 @@ def api_account_signup():
|
|||
except KeyError:
|
||||
flask.abort(400)
|
||||
|
||||
if len(username) > 24 or len(username) < 1:
|
||||
if len(x["username"]) > 24 or len(x["username"]) < 1:
|
||||
flask.abort(400)
|
||||
|
||||
if len(passhash) != 64:
|
||||
|
@ -158,7 +168,7 @@ def api_account_signup():
|
|||
ensure_file(f"{SAVING_DIRECTORY}tokens/{token}.txt", default_value=username)
|
||||
ensure_file(f"{SAVING_DIRECTORY}{username}.json", default_value=json.dumps({
|
||||
"username": username,
|
||||
"display_name": username,
|
||||
"display_name": x["username"],
|
||||
"description": "",
|
||||
"colors": {
|
||||
"accent": "#ff0000",
|
||||
|
@ -192,7 +202,8 @@ def api_account_signup():
|
|||
["hot", "3"],
|
||||
["pretty", "3"],
|
||||
["sexy", "3"]
|
||||
], "relationship": [
|
||||
],
|
||||
"relationship": [
|
||||
["beloved", "3"],
|
||||
["boyfriend", "3"],
|
||||
["darling", "3"],
|
||||
|
@ -243,13 +254,13 @@ def api_save():
|
|||
user_data["description"] = x["description"]
|
||||
|
||||
if "colors" in x:
|
||||
if "accent" in x["colors"]:
|
||||
if "accent" in x["colors"] and validate_color(x["colors"]["accent"]):
|
||||
user_data["colors"]["accent"] = x["colors"]["accent"]
|
||||
|
||||
if "background" in x["colors"]:
|
||||
if "background" in x["colors"] and validate_color(x["colors"]["background"]):
|
||||
user_data["colors"]["background"] = x["colors"]["background"]
|
||||
|
||||
if "text" in x["colors"]:
|
||||
if "text" in x["colors"] and validate_color(x["colors"]["text"]):
|
||||
user_data["colors"]["text"] = x["colors"]["text"]
|
||||
|
||||
if "names" in x:
|
||||
|
|
16
public/404.html
Normal file
16
public/404.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Page not found!</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="stylesheet" href="/css/base.css">
|
||||
<link rel="stylesheet" href="/css/page.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Page not found!</h1>
|
||||
<a href="/login">Log in</a> - <a href="/signup">Sign up</a>
|
||||
</body>
|
||||
</html>
|
|
@ -88,7 +88,9 @@ fetch("/api/account/self", {
|
|||
<div>Text color: <input id="input-col-text" type="color" value="${colors.text}"></div>
|
||||
<div>Background color: <input id="input-col-background" type="color" value="${colors.background}"></div>
|
||||
<div>Accent color: <input id="input-col-accent" type="color" value="${colors.accent}"></div><br>
|
||||
<a target="_blank" href="/u/${json.username}"><button>Preview</button></a> <button id="save">Save</button><div id="log"> </div>
|
||||
<a target="_blank" href="/u/${json.username}"><button>Preview</button></a>
|
||||
<button onclick="navigator.clipboard.writeText('https://infopg.web.app/u/trinkey'); log('Copied!');">Share</button>
|
||||
<button id="save">Save</button><div id="log"> </div>
|
||||
<div id="word-container">
|
||||
`;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ function addToOutput(starting, json, key, title) {
|
|||
|
||||
let x2 = window.location.href.split("?")[0].split("/");
|
||||
|
||||
fetch("/api/account/info/" + x2[x2.length - 1], {
|
||||
fetch("/api/account/info/" + x2[x2.length - 1].toLowerCase(), {
|
||||
"method": "GET"
|
||||
}).then((response) => (response.json()))
|
||||
.then((json) => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<title>sussy among us imposter</title>
|
||||
<title>User not found!</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="stylesheet" href="/css/base.css">
|
||||
|
|
Loading…
Reference in a new issue