Added some pages

This commit is contained in:
Profitroll 2022-12-20 15:34:47 +01:00
parent 8ee3687c73
commit 2e76962ca0
9 changed files with 402 additions and 2 deletions

3
.gitignore vendored
View File

@ -154,5 +154,4 @@ cython_debug/
# Custom
.vscode
config.json
pages
config.json

27
extensions/pages.py Normal file
View File

@ -0,0 +1,27 @@
from os import path
from modules.app import app
from fastapi.responses import HTMLResponse, Response
@app.get("/pages/matter.css", include_in_schema=False)
async def page_matter():
with open(path.join("pages", "matter.css"), "r", encoding="utf-8") as f:
output = f.read()
return Response(content=output)
@app.get("/pages/{page}/{file}", include_in_schema=False)
async def page_assets(page:str, file: str):
with open(path.join("pages", page, file), "r", encoding="utf-8") as f:
output = f.read()
return Response(content=output)
@app.get("/", include_in_schema=False)
async def page_home():
with open(path.join("pages", "home", "index.html"), "r", encoding="utf-8") as f:
output = f.read()
return HTMLResponse(content=output)
@app.get("/register", include_in_schema=False)
async def page_register():
with open(path.join("pages", "register", "index.html"), "r", encoding="utf-8") as f:
output = f.read()
return HTMLResponse(content=output)

24
pages/home/index.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>END PLAY Photos API • Home</title>
<link href="/pages/matter.css" rel="stylesheet">
<link rel="stylesheet" href="/pages/home/style.css">
</head>
<body>
<form class="registration">
<h1>👋 Welcome!</h1>
<p>You need to register in order to use this API.</p>
<p>After registering use official docs to learn how to authentiticate and start managing photos.</p>
<center><a class="matter-button-contained" href="https://photos.end-play.xyz/register">Sign Up</a></center>
</form>
</body>
</html>

6
pages/home/script.js Normal file
View File

@ -0,0 +1,6 @@
// JavaScript is used for toggling loading state
var form = document.querySelector('form');
form.onsubmit = function (event) {
event.preventDefault();
form.classList.add('signed');
};

148
pages/home/style.css Normal file
View File

@ -0,0 +1,148 @@
/* Material Customization */
:root {
--pure-material-primary-rgb: 255, 191, 0;
--pure-material-onsurface-rgb: 0, 0, 0;
}
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
background: url("https://res.cloudinary.com/finnhvman/image/upload/v1541930411/pattern.png");
}
.registration {
position: relative;
border-radius: 8px;
padding: 16px 48px;
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
overflow: hidden;
background-color: white;
}
h1 {
margin: 32px 0;
font-family: "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system;
font-weight: normal;
text-align: center;
}
.registration > label {
display: block;
margin: 24px 0;
width: 320px;
}
p {
font-family: "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system;
font-weight: normal;
text-align: center;
}
a.matter-button-contained {
text-decoration: none;
}
a {
color: rgb(var(--pure-material-primary-rgb));
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
button {
display: block !important;
margin: 32px auto;
}
.done,
.progress {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: white;
visibility: hidden;
}
.done {
transition: visibility 0s 1s;
}
.signed > .done {
visibility: visible;
}
.done > a {
display: inline-block;
text-decoration: none;
}
.progress {
opacity: 0;
}
.signed > .progress {
animation: loading 4s;
}
@keyframes loading {
0% {
visibility: visible;
}
12.5% {
opacity: 0;
}
25% {
opacity: 1;
}
87.5% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.left-footer,
.right-footer {
position: fixed;
padding: 14px;
bottom: 14px;
color: #555;
background-color: #eee;
font-family: "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system;
font-size: 14px;
line-height: 1.5;
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.left-footer {
left: 0;
border-radius: 0 4px 4px 0;
text-align: left;
}
.right-footer {
right: 0;
border-radius: 4px 0 0 4px;
text-align: right;
}
.left-footer > a,
.right-footer > a {
color: black;
}
.left-footer > a:hover,
.right-footer > a:hover {
text-decoration: underline;
}

2
pages/matter.css Normal file

File diff suppressed because one or more lines are too long

50
pages/register/index.html Normal file
View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>END PLAY Photos API • Sign Up</title>
<link href="/pages/matter.css" rel="stylesheet">
<link rel="stylesheet" href="/pages/home/style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<form class="registration" method="post">
<h1>👋 Welcome!</h1>
<label class="matter-textfield-outlined">
<input placeholder=" " type="text" alt="You won't be able to change it later!" required>
<span>Username</span>
</label>
<label class="matter-textfield-outlined">
<input placeholder=" " type="email" required>
<span>Email</span>
</label>
<label class="matter-textfield-outlined">
<input placeholder=" " type="password" required>
<span>Password</span>
</label>
<label class="matter-checkbox">
<input type="checkbox" required>
<span>I agree to the <a href="https://codepen.io/collection/nZKBZe/" target="_blank" title="Actually not a Terms of Service">Terms of Service</a></span>
</label>
<button class="matter-button-contained" type="submit">Sign Up</button>
<div class="done">
<h1>👌 You're all set!</h1>
<a class="matter-button-text" href="javascript:window.location.reload(true)">Again</a>
</div>
<div class="progress">
<progress class="matter-progress-circular" />
</div>
</form>
<!-- partial -->
<script src="./script.js"></script>
</body>
</html>

6
pages/register/script.js Normal file
View File

@ -0,0 +1,6 @@
// JavaScript is used for toggling loading state
var form = document.querySelector('form');
form.onsubmit = function (event) {
event.preventDefault();
form.classList.add('signed');
};

138
pages/register/style.css Normal file
View File

@ -0,0 +1,138 @@
/* Material Customization */
:root {
--pure-material-primary-rgb: 255, 191, 0;
--pure-material-onsurface-rgb: 0, 0, 0;
}
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
background: url("https://res.cloudinary.com/finnhvman/image/upload/v1541930411/pattern.png");
}
.registration {
position: relative;
border-radius: 8px;
padding: 16px 48px;
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
overflow: hidden;
background-color: white;
}
h1 {
margin: 32px 0;
font-family: "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system;
font-weight: normal;
text-align: center;
}
.registration > label {
display: block;
margin: 24px 0;
width: 320px;
}
a {
color: rgb(var(--pure-material-primary-rgb));
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
button {
display: block !important;
margin: 32px auto;
}
.done,
.progress {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: white;
visibility: hidden;
}
.done {
transition: visibility 0s 1s;
}
.signed > .done {
visibility: visible;
}
.done > a {
display: inline-block;
text-decoration: none;
}
.progress {
opacity: 0;
}
.signed > .progress {
animation: loading 4s;
}
@keyframes loading {
0% {
visibility: visible;
}
12.5% {
opacity: 0;
}
25% {
opacity: 1;
}
87.5% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.left-footer,
.right-footer {
position: fixed;
padding: 14px;
bottom: 14px;
color: #555;
background-color: #eee;
font-family: "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system;
font-size: 14px;
line-height: 1.5;
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.left-footer {
left: 0;
border-radius: 0 4px 4px 0;
text-align: left;
}
.right-footer {
right: 0;
border-radius: 4px 0 0 4px;
text-align: right;
}
.left-footer > a,
.right-footer > a {
color: black;
}
.left-footer > a:hover,
.right-footer > a:hover {
text-decoration: underline;
}