lnbits-legend/lnbits/extensions/ngrok/views.py
2021-07-03 15:29:40 +01:00

28 lines
No EOL
699 B
Python

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)
string2 = string[string.find('url="https') : string.find('url="https') + 40]
if string2:
string3 = string2
string4 = string3[4:]
global string5
string5 = string4.replace('"', "")
conf.get_default().log_event_callback = log_event_callback
ngrok_tunnel = ngrok.connect(5000)
@ngrok_ext.route("/")
@validate_uuids(["usr"], required=True)
@check_user_exists()
async def index():
return await render_template("ngrok/index.html", ngrok=string5)