From 25c7d1c146637f8064e23c4590a5fb107b1d2fcc Mon Sep 17 00:00:00 2001
From: trinkey <97406176+trinkey@users.noreply.github.com>
Date: Sun, 31 Mar 2024 17:56:11 -0400
Subject: [PATCH] pride flags
---
_server.py | 78 ++++++++++++++++++++----------
public/browse.html | 2 +-
public/css/page.css | 15 +++++-
public/img/flags/ace.png | Bin 0 -> 9742 bytes
public/img/flags/agender.png | Bin 0 -> 8519 bytes
public/img/flags/ally.png | Bin 0 -> 37062 bytes
public/img/flags/aro.png | Bin 0 -> 10698 bytes
public/img/flags/aroace.png | Bin 0 -> 11067 bytes
public/img/flags/bi.png | Bin 0 -> 8339 bytes
public/img/flags/bicurious.png | Bin 0 -> 9772 bytes
public/img/flags/bigender.png | Bin 0 -> 8665 bytes
public/img/flags/cisgender.png | Bin 0 -> 8205 bytes
public/img/flags/demiboy.png | Bin 0 -> 9228 bytes
public/img/flags/demigirl.png | Bin 0 -> 8506 bytes
public/img/flags/demiromantic.png | Bin 0 -> 235162 bytes
public/img/flags/demisexual.png | Bin 0 -> 25613 bytes
public/img/flags/gay.png | Bin 0 -> 10121 bytes
public/img/flags/gayman.png | Bin 0 -> 10191 bytes
public/img/flags/genderfluid.png | Bin 0 -> 10805 bytes
public/img/flags/intersex.png | Bin 0 -> 13760 bytes
public/img/flags/lesbian.png | Bin 0 -> 11012 bytes
public/img/flags/nonbinary.png | Bin 0 -> 9940 bytes
public/img/flags/omnigender.png | Bin 0 -> 21978 bytes
public/img/flags/pan.png | Bin 0 -> 10184 bytes
public/img/flags/polyamory.png | Bin 0 -> 11117 bytes
public/img/flags/straight.png | Bin 0 -> 9306 bytes
public/img/flags/trans.png | Bin 0 -> 11159 bytes
public/img/flags/transfem.png | Bin 0 -> 8521 bytes
public/img/flags/transmasc.png | Bin 0 -> 8772 bytes
public/js/base.js | 29 +++++++++++
public/js/editor.js | 21 ++++++--
public/user.html | 18 -------
32 files changed, 115 insertions(+), 48 deletions(-)
create mode 100644 public/img/flags/ace.png
create mode 100644 public/img/flags/agender.png
create mode 100644 public/img/flags/ally.png
create mode 100644 public/img/flags/aro.png
create mode 100644 public/img/flags/aroace.png
create mode 100644 public/img/flags/bi.png
create mode 100644 public/img/flags/bicurious.png
create mode 100644 public/img/flags/bigender.png
create mode 100644 public/img/flags/cisgender.png
create mode 100644 public/img/flags/demiboy.png
create mode 100644 public/img/flags/demigirl.png
create mode 100644 public/img/flags/demiromantic.png
create mode 100644 public/img/flags/demisexual.png
create mode 100644 public/img/flags/gay.png
create mode 100644 public/img/flags/gayman.png
create mode 100644 public/img/flags/genderfluid.png
create mode 100644 public/img/flags/intersex.png
create mode 100644 public/img/flags/lesbian.png
create mode 100644 public/img/flags/nonbinary.png
create mode 100644 public/img/flags/omnigender.png
create mode 100644 public/img/flags/pan.png
create mode 100644 public/img/flags/polyamory.png
create mode 100644 public/img/flags/straight.png
create mode 100644 public/img/flags/trans.png
create mode 100644 public/img/flags/transfem.png
create mode 100644 public/img/flags/transmasc.png
diff --git a/_server.py b/_server.py
index 10b5494..997bc09 100644
--- a/_server.py
+++ b/_server.py
@@ -1,3 +1,6 @@
+# MAKE SURE YOU INSTALL ALL NEEDED LIBRARIES!
+# pip install flask dotindex ensure-file
+
CONTENT_DIRECTORY = "./public/"
SAVING_DIRECTORY = "./save/"
@@ -12,6 +15,7 @@ import os
import re
from DotIndex import DotIndex
+from ensure_file import ensure_file
from typing import Union, Callable
from flask import request, redirect
from werkzeug.middleware.proxy_fix import ProxyFix
@@ -19,6 +23,36 @@ from werkzeug.middleware.proxy_fix import ProxyFix
app = flask.Flask(__name__)
app.url_map.strict_slashes = False
+FLAGS = {
+ "agender": "Agender",
+ "ally": "Ally",
+ "aroace": "Aroace",
+ "aro": "Aromantic",
+ "ace": "Asexual",
+ "bicurious": "Bicurious",
+ "bigender": "Bigender",
+ "bi": "Bisexual",
+ "cisgender": "Cisgender",
+ "demiboy": "Demiboy",
+ "demigirl": "Demigirl",
+ "demiromantic": "Demiromantic",
+ "demisexual": "Demisexual",
+ "gay": "Gay (Rainbow)",
+ "gayman": "Gay Man",
+ "genderfluid": "Genderfluid",
+ "intersex": "Intersex",
+ "lesbian": "Lesbian",
+ "nonbinary": "Nonbinary",
+ "omnigender": "Omnigender",
+ "pan": "Pansexual",
+ "polyamory": "Polyamorous",
+ "straight": "Straight",
+ "transfem": "Transfeminine",
+ "trans": "Transgender",
+ "transmasc": "Transmasculine"
+}
+
+
SOCIALS_REGEX = {
"discord" : re.compile(r"^(?!.*\.\.)(?=.{2,32}$)[a-z0-9_.]+$"),
"twitter" : re.compile(r"^(?!.*twitter)(?!.*admin)[a-z0-9_]{1,15}$", re.IGNORECASE),
@@ -126,24 +160,6 @@ def sha(string: Union[str, bytes]) -> str:
return hashlib.sha256(string).hexdigest()
return ""
-def ensure_file(path: str, *, default_value: str="", folder: bool=False) -> None:
- if os.path.exists(path):
- if folder and not os.path.isdir(path):
- os.remove(path)
- os.makedirs(path)
- elif not folder and os.path.isdir(path):
- shutil.rmtree(path, ignore_errors=True)
- f = open(path, "w")
- f.write(default_value)
- f.close()
- else:
- if folder:
- os.makedirs(path)
- else:
- f = open(path, "w")
- f.write(default_value)
- f.close()
-
def escape_html(string: str) -> str:
return string.replace("&", "&").replace("<", "<").replace("\"", """)
@@ -226,11 +242,10 @@ def get_template(json, username):
inner = add_to_output(inner, json, "compliments", "Compliments");
inner = add_to_output(inner, json, "relationship", "Relationship
Descriptions");
- try:
- social = json.social # type: ignore
+ if "social" in json and len(json.social):
inner += '
Z0=tZj!zPDrvQ{%Uij*aWxi*Z&fQv}KI-
zRzWdYci@=;v+4J{97z>IlRC*)z50r66gpI||$89oI$&d|Qo`{L8EmHi#LG#(>$
zWC+NVRXhL5@?&!y8&aSBAx0cq#;zT5#_CAKdy~R#upHe9Y7B%$%UFKYu(pv`%;vjj
zE)dv`de``J>|Rqv#d_miA>ZjGyA}yJ;T+SxJWR&5?lY
O2zdj!!XhvHk
zjJYzxBqQ1rI~m__h8joNyJ=971r0?#$?vE2$I;GFnIA676v~
zE$MbR`E=1}NVq6B0>Ifcy0bMAZ@PbaI)d9>ud%k}uZ?H?!pwW7iccK)C~jG>j<
WVTDQ_+ixwD5G&4@Yf{3wMuS!%!1%B%SQMF{hvf77vH0yQm
zO3R?A;j*BOWLQh9Rs>t+TcAUA?UKft$e1r5@%hUt!{bJSqoQxwaEGe)MFh}gSBfm{
zYbe?9v+?kpAx4k|rB)_0o9Lu}72{X*PfL{@=`uWhI(@{PPnc^eSkXOa{Z}S?0d~rP
z_)768q@cssbFby;j7~1hjjn#`I#k>~**2J~blgrvI!$X0TBXH-WsL+u2r>c5mmv
hc^J6`0ts5T99CRt+6n$Ba>03FL8NO^MhRHp7G89d=#@1-SK|U-C
zbj&$}lIeaIR@+^K2>i7vGCHxhjY+neb0P!!;ik`KSrJfkoAWA_`mQn1q4(&dUl!TV
zigdKP(4!N~PZ;l?{`7%=2Lt#3;5_Da=+|(q%u(H<-2UhkTe6Fx*zEvbh)ZM#i7#3K6iz#uZzbS~X
z$vAr4hzZI~yjH?`gKF+~{GS?nx^
zBs3(GvZw5|w#kaSS9&_aP#)iyG;y&^gH-2`ETG=2k#u=%U*i@TZcNZm+_BSBi^
Social Links
' - for i in social: + for i in json.social: if SOCIAL_INFO[i[1]]["link"]: inner += f"