diff --git a/capsulflask/__init__.py b/capsulflask/__init__.py index 8e55b87..ac258a2 100644 --- a/capsulflask/__init__.py +++ b/capsulflask/__init__.py @@ -2,6 +2,7 @@ import logging from logging.config import dictConfig as logging_dict_config import atexit +import jinja2 import os import hashlib import requests @@ -87,7 +88,9 @@ app.config.from_mapping( #STRIPE_WEBHOOK_SECRET=os.environ.get("STRIPE_WEBHOOK_SECRET", default="") BTCPAY_PRIVATE_KEY=os.environ.get("BTCPAY_PRIVATE_KEY", default="").replace("\\n", "\n"), - BTCPAY_URL=os.environ.get("BTCPAY_URL", default="") + BTCPAY_URL=os.environ.get("BTCPAY_URL", default=""), + + THEME=os.environ.get("THEME", default="") ) app.config['HUB_URL'] = os.environ.get("HUB_URL", default=app.config['BASE_URL']) @@ -156,7 +159,7 @@ else: app.config['HTTP_CLIENT'] = MyHTTPClient(timeout_seconds=int(app.config['INTERNAL_HTTP_TIMEOUT_SECONDS'])) app.config['BTCPAY_ENABLED'] = False -if app.config['BTCPAY_URL'] is not "": +if app.config['BTCPAY_URL'] != "": try: app.config['BTCPAY_CLIENT'] = btcpay.Client(api_uri=app.config['BTCPAY_URL'], pem=app.config['BTCPAY_PRIVATE_KEY']) app.config['BTCPAY_ENABLED'] = True @@ -170,6 +173,14 @@ is_running_server = ('flask run' in command_line) or ('gunicorn' in command_line app.logger.info(f"is_running_server: {is_running_server}") +if app.config['THEME'] != "": + my_loader = jinja2.ChoiceLoader([ + jinja2.FileSystemLoader( + [os.path.join('capsulflask', 'theme', app.config['THEME']), + 'capsulflask/templates']), + ]) + app.jinja_loader = my_loader + if app.config['HUB_MODE_ENABLED']: if app.config['HUB_MODEL'] == "capsul-flask": diff --git a/capsulflask/static/style.yolocolo.css b/capsulflask/static/style.yolocolo.css new file mode 100644 index 0000000..206c245 --- /dev/null +++ b/capsulflask/static/style.yolocolo.css @@ -0,0 +1,35 @@ +html { + color: #241e1e !important; + background-color: #bdc7b8 !important; +} + +a { + color:#00517a !important; + text-shadow: 1px 1px 0px #eee !important; +} + +a:hover, a:active, a:visited { + color: #323417 !important; +} + +.nav-links a { + text-shadow: 2px 2px 0px #eee !important; +} + +h1, h2, h3, h4, h5 { + text-shadow: 2px 2px 0px #eee; +} + +main { + border: 1px dashed #241e1e !important; +} + + +input, select, textarea { + color: #241e1e !important; +} + +th { + border-right: 1px solid #eee !important; + text-align: left !important; +} diff --git a/capsulflask/theme/yolocolo/account-balance.html b/capsulflask/theme/yolocolo/account-balance.html new file mode 100644 index 0000000..3028baa --- /dev/null +++ b/capsulflask/theme/yolocolo/account-balance.html @@ -0,0 +1,94 @@ +{% extends 'base.html' %} + +{% block title %}Account Balance{% endblock %} + +{% block content %} +
{{ warning_text }}+
amount | +date | +
---|---|
${{ payment["dollars"] }} | +{{ payment["created"] }} | +
id | +created | +deleted | +$/month | +months | +$ billed | +
---|---|---|---|---|---|
{{ vm["id"] }} | +{{ vm["created"] }} | +{{ vm["deleted"] }} | +${{ vm["dollars_per_month"] }} | +{{ vm["months"] }} | +${{ vm["dollars"] }} | +
❦ | +id | +size | +cpu | +mem | +ipv4 | +os | +created | +|||
---|---|---|---|---|---|---|---|---|---|---|
• | + {% elif vm['state'] == 'crashed' or vm['state'] == 'blocked' or vm['state'] == 'stopped' %} +• | + {% elif vm['state'] == 'unknown' %} +? | + {% else %} +• | + {% endif %} + +{{ vm["id"] }} | +{{ vm["size"] }} | ++ | + | {{ vm["ipv4"] }} | +{{ vm["os"] }} | +{{ vm["created"] }} | +
You don't have any Capsuls running. Create one today!
++
+ This is a technical demo of Capsul, for the + as-yet-untitled Cotech server hosting + initiative, which you can read + about on the Cotech forum. +
+No backups
+No service level agreement
+"Best effort" support
+Cyberia, the authors of this platform, run the canonical instance, Capsul.org, on hardware they own. Please + send them your money! (cash, crypto, or card accepted).
+Please see the official Capsul FAQ + page.
++ _ _ + _ _ ___ | | ___ ___ ___ | | ___ +| | | |/ _ \| |/ _ \ / __/ _ \| |/ _ \ +| |_| | (_) | | (_) | (_| (_) | | (_) | + \__, |\___/|_|\___/ \___\___/|_|\___/ + |___/ + ++ Co-operative hosting using Cyberia's Capsul +{% endblock %} + +{% block subcontent %} +
+
+ Rates for this service aren't set yet. You can see Cyberia's Capsul pricing + on their website. +
++ SUPPORTED OPERATING SYSTEMS: + + {% for os_id, os in operating_systems.items() %} - {{ os.description }} + {% endfor %} ++
+ You can also find us on Matrix: #untitled-hosting.public:autonomic.zone. +
+{% endblock %} + +{% block pagesource %}/templates/support.html{% endblock %}