fixed bug

This commit is contained in:
Ben Arc 2021-07-03 15:00:08 +01:00
parent 117ae1aec3
commit 8619da29cf
4 changed files with 40 additions and 48 deletions

View File

@ -3,10 +3,8 @@ from lnbits.db import Database
db = Database("ext_ngrok")
freetunnel_ext: Blueprint = Blueprint(
ngrok_ext: Blueprint = Blueprint(
"ngrok", __name__, static_folder="static", template_folder="templates"
)
from .views_api import * # noqa
from .views import * # noqa
from .views import * # noqa

View File

@ -1,37 +1,47 @@
{% extends "base.html" %} {% from "macros.jinja" import window_vars with context
%} {% block page %}
<q-card>
<q-card-section>
<h5 class="text-subtitle1 q-mt-none q-mb-md">Access this lnbits instance at the following url</h5>
<q-separator class="q-my-lg"></q-separator>
<p><a href="{{ ngrok }}" target="_blank">{{ ngrok }}</a></p>
<p>Note that if you restart your device, your device will generate a new url. If anyone is using your old one for wallets, lnurls, etc., whatever they are doing will stop working.</p>
</q-card-section>
</q-card>
<div class="row q-col-gutter-md">
<div class="col-12 col-md-8 col-lg-7 q-gutter-y-md">
<q-card>
<q-card-section>
<h5 class="text-subtitle1 q-mt-none q-mb-md">
Access this lnbits instance at the following url
</h5>
<q-separator class="q-my-lg"></q-separator>
<p><a href="{{ ngrok }}" target="_blank">{{ ngrok }}</a></p>
<p>
Note that if you restart your device, your device will generate a new
url. If anyone is using your old one for wallets, lnurls, etc.,
whatever they are doing will stop working.
</p>
</q-card-section>
</q-card>
</div>
<div class="col-12 col-md-5 q-gutter-y-md">
<q-card>
<q-card-section>
<h6 class="text-subtitle1 q-my-none">Ngrok extension</h6>
</q-card-section>
<q-card-section class="q-pa-none">
<q-separator></q-separator>
<q-list>
{% include "tpos/_api_docs.html" %}
<q-separator></q-separator>
{% include "tpos/_tpos.html" %}
</q-list>
</q-card-section>
</q-card>
</div>
</div>
{% endblock %} {% block scripts %} {{ window_vars(user) }}
<script>
new Vue({
el: '#vue',
mixins: [windowMixin],
data: function () {
return {
tools: []
}
},
created: function () {
var self = this
// axios is available for making requests
axios({
method: 'GET',
url: '/example/api/v1/tools',
headers: {
'X-example-header': 'not-used'
}
}).then(function (response) {
self.tools = response.data
})
}
data: function () {}
})
</script>
{% endblock %}

View File

@ -3,6 +3,7 @@ from quart import g, render_template
from lnbits.decorators import check_user_exists, validate_uuids
from pyngrok import conf, ngrok
from . import ngrok_ext
def log_event_callback(log):
string = str(log)
@ -17,8 +18,6 @@ conf.get_default().log_event_callback = log_event_callback
ngrok_tunnel = ngrok.connect(5000)
from . import ngrok_ext
@ngrok_ext.route("/")
@validate_uuids(["usr"], required=True)
@check_user_exists()

View File

@ -1,15 +0,0 @@
# views_api.py is for you API endpoints that could be hit by another service
# add your dependencies here
import pyngrok
# import json
# import httpx
# (use httpx just like requests, except instead of response.ok there's only the
# response.is_error that is its inverse)
from quart import jsonify
from http import HTTPStatus
from . import ngrok_ext