From b8279d749105f3404949afb5f950ff768c80c9e3 Mon Sep 17 00:00:00 2001 From: forest Date: Mon, 19 Jul 2021 18:08:31 -0500 Subject: [PATCH 1/4] add about ssh link to faq --- capsulflask/templates/faq.html | 1 + 1 file changed, 1 insertion(+) diff --git a/capsulflask/templates/faq.html b/capsulflask/templates/faq.html index b6fdaed..d3a832b 100644 --- a/capsulflask/templates/faq.html +++ b/capsulflask/templates/faq.html @@ -23,6 +23,7 @@ How do I log in?

ssh to the ip provided to you using the cyberian user.

$ ssh cyberian@1.2.3.4
+

For more information, see Understanding the Secure Shell Protocol (SSH).

  • How do I change to the root user? From 7923f3a99f0b9b7824542a8ea092443bd863b8c6 Mon Sep 17 00:00:00 2001 From: 3wc <3wc.cyberia@doesthisthing.work> Date: Wed, 21 Jul 2021 12:19:28 +0200 Subject: [PATCH 2/4] Auto-generate the pricing table from the database --- capsulflask/landing.py | 2 ++ capsulflask/static/style.css | 3 +-- capsulflask/templates/pricing.html | 36 +++++++++++++++++++++--------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/capsulflask/landing.py b/capsulflask/landing.py index 3c1781e..8161352 100644 --- a/capsulflask/landing.py +++ b/capsulflask/landing.py @@ -12,9 +12,11 @@ def index(): @bp.route("/pricing") def pricing(): + vm_sizes = get_model().vm_sizes_dict() operating_systems = get_model().operating_systems_dict() return render_template( "pricing.html", + vm_sizes=vm_sizes, operating_systems=operating_systems ) diff --git a/capsulflask/static/style.css b/capsulflask/static/style.css index f4a2d32..515f1a6 100644 --- a/capsulflask/static/style.css +++ b/capsulflask/static/style.css @@ -241,7 +241,6 @@ thead { background: #bdc7b812; } td, th { - padding: 0.1em 1em; } table.small td, table.small th { @@ -378,4 +377,4 @@ footer { border: 1px solid rgba(255, 223, 155, 0.8); box-sizing: border-box; position: relative; -} \ No newline at end of file +} diff --git a/capsulflask/templates/pricing.html b/capsulflask/templates/pricing.html index b985e67..5d34117 100644 --- a/capsulflask/templates/pricing.html +++ b/capsulflask/templates/pricing.html @@ -6,21 +6,37 @@

    CAPSUL TYPES & PRICING

    +
    + + + + + + + + + + + + + {% for vm_size_key, vm_size in vm_sizes.items() %} + + + + + + + + + {% endfor %} + +
    typemonthly*cpusmemssdnet
    {{ vm_size_key }}${{ vm_size['dollars_per_month'] }}{{ vm_size['vcpus'] }}{{ vm_size['memory_mb'] }}25G{{ vm_size['bandwidth_gb_per_month'] }}
    +
    -    type     monthly*  cpus  mem     ssd   net*
    -    -----    -------   ----  ---     ---   ---
    -    f1-xs    $5.00     1     512M    25G   .5TB
    -    f1-s     $7.50     1     1024M   25G   1TB
    -    f1-m     $12.50    1     2048M   25G   2TB
    -    f1-l     $20.00    2     3072M   25G   3TB
    -    f1-x     $27.50    3     4096M   25G   4TB
    -    f1-xx    $50.00    4     8192M   25G   5TB
    -
         * net is calculated as a per-month average
         * vms are billed for a minimum of 24 hours upon creation
         * all VMs come standard with one public IPv4 address
    -  
         
         SUPPORTED OPERATING SYSTEMS:
     
    
    From 28271ee852fc2fc91c6126b007ffbbcff5c0b96e Mon Sep 17 00:00:00 2001
    From: forest 
    Date: Wed, 21 Jul 2021 11:53:44 -0500
    Subject: [PATCH 3/4] remove class="small" from pricing table cuz normal size
     fits fine
    
    ---
     capsulflask/templates/pricing.html | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/capsulflask/templates/pricing.html b/capsulflask/templates/pricing.html
    index 5d34117..6888660 100644
    --- a/capsulflask/templates/pricing.html
    +++ b/capsulflask/templates/pricing.html
    @@ -7,7 +7,7 @@
         

    CAPSUL TYPES & PRICING

    - +
    From 36329796f0538ce0fc8eecbb4f7fb01c5d132829 Mon Sep 17 00:00:00 2001 From: forest Date: Wed, 21 Jul 2021 12:12:41 -0500 Subject: [PATCH 4/4] define BTCPAY_ENABLED based on URL and btcpay key, pass it explicitly --- capsulflask/__init__.py | 17 ++++++++--------- capsulflask/console.py | 1 + capsulflask/payment.py | 2 +- capsulflask/templates/account-balance.html | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/capsulflask/__init__.py b/capsulflask/__init__.py index 027ad06..7261bf4 100644 --- a/capsulflask/__init__.py +++ b/capsulflask/__init__.py @@ -71,7 +71,7 @@ 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="https://btcpay.cyberia.club") + BTCPAY_URL=os.environ.get("BTCPAY_URL", default="") ) app.config['HUB_URL'] = os.environ.get("HUB_URL", default=app.config['BASE_URL']) @@ -139,10 +139,13 @@ else: app.config['HTTP_CLIENT'] = MyHTTPClient(timeout_seconds=int(app.config['INTERNAL_HTTP_TIMEOUT_SECONDS'])) -try: - app.config['BTCPAY_CLIENT'] = btcpay.Client(api_uri=app.config['BTCPAY_URL'], pem=app.config['BTCPAY_PRIVATE_KEY']) -except: - app.logger.warning("unable to create btcpay client. Capsul will work fine except cryptocurrency payments will not work. The error was: " + my_exec_info_message(sys.exc_info())) +app.config['BTCPAY_ENABLED'] = False +if app.config['BTCPAY_URL'] is not "": + try: + app.config['BTCPAY_CLIENT'] = btcpay.Client(api_uri=app.config['BTCPAY_URL'], pem=app.config['BTCPAY_PRIVATE_KEY']) + app.config['BTCPAY_ENABLED'] = True + except: + app.logger.warning("unable to create btcpay client. Capsul will work fine except cryptocurrency payments will not work. The error was: " + my_exec_info_message(sys.exc_info())) # only start the scheduler and attempt to migrate the database if we are running the app. # otherwise we are running a CLI command. @@ -218,10 +221,6 @@ def override_url_for(): return dict(url_for=url_for_with_cache_bust) -@app.context_processor -def load_config_vars(): - return dict(config=app.config) - def url_for_with_cache_bust(endpoint, **values): """ Add a query parameter based on the hash of the file, this acts as a cache bust diff --git a/capsulflask/console.py b/capsulflask/console.py index e97b805..5da18e9 100644 --- a/capsulflask/console.py +++ b/capsulflask/console.py @@ -423,6 +423,7 @@ def account_balance(): has_vms=len(vms_billed)>0, vms_billed=vms_billed, warning_text=warning_text, + btcpay_enabled=current_app.config["BTCPAY_ENABLED"], payments=list(map( lambda x: dict( dollars=x["dollars"], diff --git a/capsulflask/payment.py b/capsulflask/payment.py index b11c164..3c41cd9 100644 --- a/capsulflask/payment.py +++ b/capsulflask/payment.py @@ -48,7 +48,7 @@ def validate_dollars(): def btcpay_payment(): errors = list() - if current_app.config['BTCPAY_PRIVATE_KEY'] == "": + if not current_app.config['BTCPAY_ENABLED']: flash("BTCPay is not enabled on this server") return redirect(url_for("console.account_balance")) diff --git a/capsulflask/templates/account-balance.html b/capsulflask/templates/account-balance.html index de3b7b0..3d47e70 100644 --- a/capsulflask/templates/account-balance.html +++ b/capsulflask/templates/account-balance.html @@ -46,7 +46,7 @@ Add funds with Credit/Debit (stripe)
    • notice: stripe will load nonfree javascript
    - {% if config['BTCPAY_PRIVATE_KEY'] != "" %} + {% if btcpay_enabled %}
  • Add funds with Bitcoin/Litecoin/Monero (btcpay)
  • {% endif %}
    type