✨ donation page with monero
This commit is contained in:
parent
7bf48daab5
commit
fa78fbff0f
3 changed files with 111 additions and 38 deletions
9
Makefile
9
Makefile
|
@ -5,7 +5,8 @@ fmt:
|
|||
clean:
|
||||
fd pycache -I -x rm -rv {}
|
||||
|
||||
restart:
|
||||
docker-compose down
|
||||
docker-compose build
|
||||
docker-compose up -d
|
||||
debug:
|
||||
docker-compose -f docker-compose-debug.yml up -d
|
||||
|
||||
debug-stop:
|
||||
docker-compose -f docker-compose-debug.yml down
|
||||
|
|
12
docker-compose-debug.yml
Normal file
12
docker-compose-debug.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
app:
|
||||
build: "."
|
||||
environment:
|
||||
TZ: Europe/Berlin
|
||||
ports:
|
||||
- 1030:1030
|
||||
volumes:
|
||||
- ./config:/config
|
||||
- ./src:/app
|
128
src/index.py
128
src/index.py
|
@ -23,7 +23,13 @@ BOOTSTRAP = [
|
|||
def buildSite(content):
|
||||
return Document(
|
||||
head=Head(
|
||||
[Meta(name="viewport", content="width=350, user-scalable=0;"), BOOTSTRAP]
|
||||
[
|
||||
Meta(
|
||||
name="viewport",
|
||||
content="user-scalable=no, width=device-width, initial-scale=1.0",
|
||||
),
|
||||
BOOTSTRAP,
|
||||
]
|
||||
),
|
||||
body=Body(
|
||||
content,
|
||||
|
@ -41,7 +47,33 @@ def public_key():
|
|||
|
||||
ua = request.user_agent.string.lower()
|
||||
if "chrome" in ua or "safari" in ua or "firefox" in ua:
|
||||
return buildSite(Paragraph(ret.replace("\n", "<br>"))).to_code()
|
||||
return buildSite(
|
||||
[
|
||||
Div(
|
||||
Div(
|
||||
[
|
||||
Bold("To Import: "),
|
||||
Span(
|
||||
f'curl "{request.base_url}"|gpg --import',
|
||||
global_attr=GlobalAttributes(
|
||||
style="display: block;font-family: monospace,monospace;margin-top: 10px; font-size: 20px;overflow-wrap: break-word;"
|
||||
),
|
||||
),
|
||||
],
|
||||
global_attr=GlobalAttributes(css_class="alert alert-info"),
|
||||
),
|
||||
global_attr=GlobalAttributes(
|
||||
css_class="container", style="margin-top: 25px"
|
||||
),
|
||||
),
|
||||
Div(
|
||||
Paragraph(ret.replace("\n", "<br>")),
|
||||
global_attr=GlobalAttributes(
|
||||
css_class="container card bg-primary"
|
||||
),
|
||||
),
|
||||
]
|
||||
).to_code()
|
||||
|
||||
resp = Response(response=ret, status=200, mimetype="application/pgp-keys")
|
||||
return resp
|
||||
|
@ -49,40 +81,68 @@ def public_key():
|
|||
return Response(response="", status=502)
|
||||
|
||||
|
||||
def build_contact_block():
|
||||
return Div(
|
||||
[
|
||||
Heading(1, "Contact"),
|
||||
ThematicBreak(),
|
||||
[Link("/public_key", "My PGP Key"), LineBreak()]
|
||||
if exists("/config/pub.key")
|
||||
else None,
|
||||
Link(f"mailto:{CONFIG['email']}", CONFIG["email"]),
|
||||
LineBreak(),
|
||||
],
|
||||
global_attr=GlobalAttributes(css_class="container border-dark"),
|
||||
)
|
||||
|
||||
|
||||
def build_donation_block():
|
||||
return Div(
|
||||
[
|
||||
Heading(1, "Donation"),
|
||||
ThematicBreak(),
|
||||
Paragraph(
|
||||
[
|
||||
Bold("Monero: "),
|
||||
Span(
|
||||
CONFIG["xmr_address"],
|
||||
global_attr=GlobalAttributes(
|
||||
style="color: orange;overflow-wrap: break-word;"
|
||||
),
|
||||
),
|
||||
]
|
||||
)
|
||||
if "xmr_address" in CONFIG
|
||||
else None,
|
||||
],
|
||||
global_attr=GlobalAttributes(css_class="container", style="margin-top: 20px"),
|
||||
)
|
||||
|
||||
|
||||
def build_information_block():
|
||||
return Div(
|
||||
[
|
||||
Image(
|
||||
"/assets/me",
|
||||
200,
|
||||
200,
|
||||
"Me",
|
||||
global_attr=GlobalAttributes(css_class="rounded"),
|
||||
),
|
||||
LineBreak(),
|
||||
LineBreak(),
|
||||
Heading(1, CONFIG["name"]),
|
||||
ThematicBreak(),
|
||||
],
|
||||
global_attr=GlobalAttributes(
|
||||
css_class="container border-dark", style="margin-top: 20px"
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
# Main
|
||||
@main_pages.route("/", methods=["GET"])
|
||||
def index():
|
||||
return buildSite(
|
||||
[
|
||||
Div(
|
||||
[
|
||||
Image(
|
||||
"/assets/me",
|
||||
200,
|
||||
200,
|
||||
"Me",
|
||||
global_attr=GlobalAttributes(css_class="rounded"),
|
||||
),
|
||||
LineBreak(),
|
||||
LineBreak(),
|
||||
Heading(1, CONFIG["name"]),
|
||||
ThematicBreak(),
|
||||
],
|
||||
global_attr=GlobalAttributes(
|
||||
css_class="container border-dark", style="margin-top: 20px"
|
||||
),
|
||||
),
|
||||
Div(
|
||||
[
|
||||
Heading(1, "Contact"),
|
||||
ThematicBreak(),
|
||||
[Link("/public_key", "My PGP Key"), LineBreak()]
|
||||
if exists("/config/pub.key")
|
||||
else None,
|
||||
Link(f"mailto:{CONFIG['email']}", CONFIG["email"]),
|
||||
LineBreak(),
|
||||
],
|
||||
global_attr=GlobalAttributes(css_class="container border-dark"),
|
||||
),
|
||||
]
|
||||
[build_information_block(), build_contact_block(), build_donation_block()]
|
||||
).to_code()
|
||||
|
|
Loading…
Add table
Reference in a new issue