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 %} +
+

Account Balance: ${{ account_balance }}

+
+
+ + {% if has_vms and has_payments and warning_text != "" %} +
+
{{ warning_text }}
+
+ {% endif %} +
+ {% if has_payments %} +
+
+

Payments

+
+ + + + + + + + + + {% for payment in payments %} + + + + + {% endfor %} + +
amountdate
${{ payment["dollars"] }}{{ payment["created"] }}
+
+ {% endif %} + + +
+ + + {% if has_vms %} +
+

Capsuls Billed

+
+
+ + + + + + + + + + + + + {% for vm in vms_billed %} + + + + + + + + + {% endfor %} + +
idcreateddeleted$/monthmonths$ billed
{{ vm["id"] }}{{ vm["created"] }}{{ vm["deleted"] }}${{ vm["dollars_per_month"] }}{{ vm["months"] }}${{ vm["dollars"] }}
+
+ + {% endif %} +
+{% endblock %} + +{% block pagesource %}/templates/create-capsul.html{% endblock %} diff --git a/capsulflask/theme/yolocolo/base.html b/capsulflask/theme/yolocolo/base.html new file mode 100644 index 0000000..70834cc --- /dev/null +++ b/capsulflask/theme/yolocolo/base.html @@ -0,0 +1,60 @@ + + + + + {% block title %}{% endblock %}{% if self.title() %} - {% endif %}Capsul + + + + {% block head %}{% endblock %} + + + + + +{% for message in get_flashed_messages() %} +
{{ message }}
+{% endfor %} +{% block custom_flash %}{% endblock %} +
+ {% block content %}{% endblock %} +
+{% block subcontent %}{% endblock %} + + + + + diff --git a/capsulflask/theme/yolocolo/capsuls.html b/capsulflask/theme/yolocolo/capsuls.html new file mode 100644 index 0000000..f64a674 --- /dev/null +++ b/capsulflask/theme/yolocolo/capsuls.html @@ -0,0 +1,68 @@ +{% extends 'base.html' %} + +{% block title %}Capsuls{% endblock %} + +{% block custom_flash %} +{% if created %} +
{{ created }} successfully created!
+{% endif %} +{% endblock %} + +{% block content %} +
+

Capsuls

+
+
+ {% if has_vms %} +
+ Create Capsul +
+
+ + + + + + + + + + + + + + + {% for vm in vms %} + + {% if vm['state'] == 'starting' or vm['state'] == 'stopping' %} + + {% elif vm['state'] == 'crashed' or vm['state'] == 'blocked' or vm['state'] == 'stopped' %} + + {% elif vm['state'] == 'unknown' %} + + {% else %} + + {% endif %} + + + + + + + + + + {% endfor %} + +
idsizecpumemipv4oscreated
?{{ vm["id"] }}{{ vm["size"] }}{{ vm["ipv4"] }}{{ vm["os"] }}{{ vm["created"] }}
+
+ + {% else %} +
+

You don't have any Capsuls running. Create one today!

+
+ {% endif %} +
+{% endblock %} + +{% block pagesource %}/templates/capsuls.html{% endblock %} diff --git a/capsulflask/theme/yolocolo/faq.html b/capsulflask/theme/yolocolo/faq.html new file mode 100644 index 0000000..54dbc95 --- /dev/null +++ b/capsulflask/theme/yolocolo/faq.html @@ -0,0 +1,46 @@ +{% extends 'base.html' %} + +{% block title %}FAQ{% endblock %} + +{% block content %} +

Frequently Asked Questions

+{% endblock %} + +{% block subcontent %} +

+

+

+ +{% endblock %} + +{% block pagesource %}/templates/faq.html{% endblock %} + diff --git a/capsulflask/theme/yolocolo/index.html b/capsulflask/theme/yolocolo/index.html new file mode 100644 index 0000000..f785803 --- /dev/null +++ b/capsulflask/theme/yolocolo/index.html @@ -0,0 +1,28 @@ +{% extends 'base.html' %} + +{% block content %} +

+
+             _                 _
+ _   _  ___ | | ___   ___ ___ | | ___
+| | | |/ _ \| |/ _ \ / __/ _ \| |/ _ \
+| |_| | (_) | | (_) | (_| (_) | | (_) |
+ \__, |\___/|_|\___/ \___\___/|_|\___/
+ |___/
+
+  
+ Co-operative hosting using Cyberia's Capsul +{% endblock %} + +{% block subcontent %} +

+

+

+{% endblock %} + +{% block pagesource %}/templates/index.html{% endblock %} diff --git a/capsulflask/theme/yolocolo/pricing.html b/capsulflask/theme/yolocolo/pricing.html new file mode 100644 index 0000000..c2156cc --- /dev/null +++ b/capsulflask/theme/yolocolo/pricing.html @@ -0,0 +1,23 @@ +{% extends 'base.html' %} + +{% block title %}Pricing{% endblock %} + +{% block content %} +
+

CAPSUL TYPES & PRICING

+
+
+

+ 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 %}
+    
+
+{% endblock %} diff --git a/capsulflask/theme/yolocolo/support.html b/capsulflask/theme/yolocolo/support.html new file mode 100644 index 0000000..ded9b82 --- /dev/null +++ b/capsulflask/theme/yolocolo/support.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} + +{% block title %}Support{% endblock %} + +{% block content %} +
+

SUPPORT

+
+
+ yolocolo@doesthisthing.work +
+{% endblock %} + +{% block subcontent %} +

+ You can also find us on Matrix: #untitled-hosting.public:autonomic.zone. +

+{% endblock %} + +{% block pagesource %}/templates/support.html{% endblock %}