Compare commits
No commits in common. "75bf2bb0e135ecaf473e7777d9345dcf33f61cc7" and "98b10c1c38a95dae27b263f29ae11c783e09ce33" have entirely different histories.
75bf2bb0e1
...
98b10c1c38
6 changed files with 12 additions and 108 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -4,7 +4,3 @@ lib64
|
||||||
pyvenv.cfg
|
pyvenv.cfg
|
||||||
|
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
src/public/fonts/
|
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
Flask==2.2.2
|
Flask==2.2.2
|
||||||
requests==2.28.1
|
|
||||||
|
|
13
src/app.py
13
src/app.py
|
@ -1,15 +1,18 @@
|
||||||
from flask import Flask, redirect
|
|
||||||
|
|
||||||
from font import init as init_font
|
|
||||||
from routes.index import router as index
|
from routes.index import router as index
|
||||||
|
from flask import Flask, redirect
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__, static_url_path="/", static_folder="public")
|
app = Flask(__name__, static_url_path="/", static_folder="public")
|
||||||
app.register_blueprint(index, url_prefix="/index")
|
app.register_blueprint(index, url_prefix="/index")
|
||||||
|
|
||||||
init_font("1.3.0")
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def root():
|
def root():
|
||||||
return redirect("index")
|
return redirect("index")
|
||||||
|
|
||||||
|
|
||||||
|
class AttributeDict(dict):
|
||||||
|
def __getattr__(self, name):
|
||||||
|
if name in self:
|
||||||
|
return self[name]
|
||||||
|
raise AttributeError(name)
|
||||||
|
|
37
src/font.py
37
src/font.py
|
@ -1,37 +0,0 @@
|
||||||
from os import mkdir
|
|
||||||
|
|
||||||
from requests import get
|
|
||||||
|
|
||||||
|
|
||||||
def exist(path):
|
|
||||||
"""Check if file or directory exists"""
|
|
||||||
try:
|
|
||||||
open(path, "r")
|
|
||||||
except FileNotFoundError:
|
|
||||||
return False # Doesn't exist
|
|
||||||
except IsADirectoryError:
|
|
||||||
return True # Directory exists
|
|
||||||
else:
|
|
||||||
return True # File exists
|
|
||||||
|
|
||||||
|
|
||||||
def init(version):
|
|
||||||
""" Download font """
|
|
||||||
path = "./src/public/fonts"
|
|
||||||
filename = "RiluRegular.ttf"
|
|
||||||
# If there is filename changes, you should change
|
|
||||||
# the name in the css file too (./src/public/styles/style.css)
|
|
||||||
|
|
||||||
# Check if fonts directory exists
|
|
||||||
if not exist(path):
|
|
||||||
mkdir(path)
|
|
||||||
|
|
||||||
# Download the font file if needed
|
|
||||||
if not exist(f"{path}/{filename}"):
|
|
||||||
# Download the font file
|
|
||||||
file_url = f"https://github.com/alisinisterra/rilu/releases/download/v{version}/{filename}"
|
|
||||||
data = get(file_url).content
|
|
||||||
|
|
||||||
# Save the file
|
|
||||||
with open(f"{path}/{filename}", "wb") as file:
|
|
||||||
file.write(data)
|
|
|
@ -1,48 +1,3 @@
|
||||||
@font-face {
|
|
||||||
font-family: Rilu;
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
src: url(../fonts/RiluRegular.ttf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* https://www.colorhexa.com/c2b280 */
|
|
||||||
@media (prefers-color-scheme: light) {
|
|
||||||
:root {
|
|
||||||
--bg-color: rgb(245, 242, 234);
|
|
||||||
--text-color: rgb(6, 5, 3);
|
|
||||||
--selection: rgb(232, 226, 208);
|
|
||||||
--link-color: rgb(13, 71, 161);
|
|
||||||
--link-color-hover: rgb(181, 162, 101);
|
|
||||||
--grey: rgb(207, 216, 220);
|
|
||||||
--shadow: rgba(0, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--bg-color: rgb(19, 16, 9);
|
|
||||||
--text-color: rgb(251, 250, 247);
|
|
||||||
--selection: rgb(226, 218, 194);
|
|
||||||
--link-color: rgb(100, 181, 246);
|
|
||||||
--link-color-hover: rgb(175, 154, 88);
|
|
||||||
--grey: rgb(55, 71, 79);
|
|
||||||
--shadow: rgba(125, 109, 60, 0.288);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
::selection {
|
|
||||||
color: rgb(0, 0, 0);
|
|
||||||
background: var(--selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
color: var(--text-color);
|
|
||||||
font-family: Rilu;
|
|
||||||
font-size: 17px;
|
|
||||||
scroll-behavior: smooth;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-center {
|
.text-center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
@ -50,17 +5,3 @@ html {
|
||||||
header > .text-title {
|
header > .text-title {
|
||||||
font-size: 2.5rem;
|
font-size: 2.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
margin-top: 2%;
|
|
||||||
padding: 0.9% 0.9% 0.9% 0.9%;
|
|
||||||
width: 42%;
|
|
||||||
border-radius: 6px;
|
|
||||||
border: 1px solid rgb(170, 170, 170);
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 4px 30px 0 var(--shadow), 0 4px 30px 0 var(--shadow);
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>{{ name }}</title>
|
<title>{{ name }} - Index</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="../styles/style.css" />
|
<link rel="stylesheet" href="../styles/style.css" />
|
||||||
</head>
|
</head>
|
||||||
|
@ -18,6 +18,8 @@
|
||||||
<p>placeholder-main</p>
|
<p>placeholder-main</p>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer>NPNO</footer>
|
<footer>
|
||||||
|
<p>placeholder-footer</p>
|
||||||
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Reference in a new issue