Improved SSE listeners (#865)
* logging listeners * comments * generate privkey upon init * listener queue * remove duplicate check * make format * reuse channel * error handling in sse listener * uuid for listeners * register named invoices * uuid for listeners and listener list * fix poetry lock * setuptools * requirements asyncio timeout * setuptool;s * make format * remove async-timeout * async_timeout readd * try lower setuptools version * try lower lower setuptools version * back to current version + fix, maybe * fix worflows to use poetry 1.2.1 * remove uneeded setuptools from build-system * fix up formatting workflow * debug to trace * more traces * debug logs to trace Co-authored-by: dni ⚡ <office@dnilabs.com>
This commit is contained in:
@@ -183,3 +183,26 @@ def template_renderer(additional_folders: List = []) -> Jinja2Templates:
|
||||
t.env.globals["VENDORED_CSS"] = ["/static/bundle.css"]
|
||||
|
||||
return t
|
||||
|
||||
|
||||
def get_current_extension_name() -> str:
|
||||
"""
|
||||
Returns the name of the extension that calls this method.
|
||||
"""
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
|
||||
callee_filepath = inspect.stack()[1].filename
|
||||
callee_dirname, callee_filename = os.path.split(callee_filepath)
|
||||
|
||||
path = os.path.normpath(callee_dirname)
|
||||
extension_director_name = path.split(os.sep)[-1]
|
||||
try:
|
||||
config_path = os.path.join(callee_dirname, "config.json")
|
||||
with open(config_path) as json_file:
|
||||
config = json.load(json_file)
|
||||
ext_name = config["name"]
|
||||
except:
|
||||
ext_name = extension_director_name
|
||||
return ext_name
|
||||
|
||||
Reference in New Issue
Block a user