✨ 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:
|
clean:
|
||||||
fd pycache -I -x rm -rv {}
|
fd pycache -I -x rm -rv {}
|
||||||
|
|
||||||
restart:
|
debug:
|
||||||
docker-compose down
|
docker-compose -f docker-compose-debug.yml up -d
|
||||||
docker-compose build
|
|
||||||
docker-compose 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
|
102
src/index.py
102
src/index.py
|
@ -23,7 +23,13 @@ BOOTSTRAP = [
|
||||||
def buildSite(content):
|
def buildSite(content):
|
||||||
return Document(
|
return Document(
|
||||||
head=Head(
|
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(
|
body=Body(
|
||||||
content,
|
content,
|
||||||
|
@ -41,7 +47,33 @@ def public_key():
|
||||||
|
|
||||||
ua = request.user_agent.string.lower()
|
ua = request.user_agent.string.lower()
|
||||||
if "chrome" in ua or "safari" in ua or "firefox" in ua:
|
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")
|
resp = Response(response=ret, status=200, mimetype="application/pgp-keys")
|
||||||
return resp
|
return resp
|
||||||
|
@ -49,12 +81,46 @@ def public_key():
|
||||||
return Response(response="", status=502)
|
return Response(response="", status=502)
|
||||||
|
|
||||||
|
|
||||||
# Main
|
def build_contact_block():
|
||||||
@main_pages.route("/", methods=["GET"])
|
return Div(
|
||||||
def index():
|
|
||||||
return buildSite(
|
|
||||||
[
|
[
|
||||||
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(
|
Image(
|
||||||
"/assets/me",
|
"/assets/me",
|
||||||
|
@ -71,18 +137,12 @@ def index():
|
||||||
global_attr=GlobalAttributes(
|
global_attr=GlobalAttributes(
|
||||||
css_class="container border-dark", style="margin-top: 20px"
|
css_class="container border-dark", style="margin-top: 20px"
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
Div(
|
|
||||||
[
|
|
||||||
Heading(1, "Contact"),
|
# Main
|
||||||
ThematicBreak(),
|
@main_pages.route("/", methods=["GET"])
|
||||||
[Link("/public_key", "My PGP Key"), LineBreak()]
|
def index():
|
||||||
if exists("/config/pub.key")
|
return buildSite(
|
||||||
else None,
|
[build_information_block(), build_contact_block(), build_donation_block()]
|
||||||
Link(f"mailto:{CONFIG['email']}", CONFIG["email"]),
|
|
||||||
LineBreak(),
|
|
||||||
],
|
|
||||||
global_attr=GlobalAttributes(css_class="container border-dark"),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
).to_code()
|
).to_code()
|
||||||
|
|
Loading…
Add table
Reference in a new issue