add: template editor

This commit is contained in:
h z
2025-04-14 17:02:22 +01:00
parent 6626fac452
commit fa855bc7bb
20 changed files with 442 additions and 299 deletions

View File

@@ -1,5 +1,6 @@
import base64
import os
import pkgutil
from functools import wraps
from cryptography import x509
@@ -17,8 +18,6 @@ import hashlib
import json
_public_key_cache = {}
_lock = Lock()
@@ -126,17 +125,18 @@ limiter = Limiter(
def register_blueprints(app):
current_dir = os.path.dirname(__file__)
for filename in os.listdir(current_dir):
if filename == "__init__.py" or not filename.endswith(".py"):
continue
module_name = filename[:-3]
module = importlib.import_module(f"api.{module_name}")
for attr in dir(module):
bp = getattr(module, attr)
if isinstance(bp, Blueprint):
app.register_blueprint(bp)
package_name = __name__
package_path = os.path.dirname(__file__)
for finder, mod_name, is_pkg in pkgutil.walk_packages([package_path], package_name + "."):
module = importlib.import_module(mod_name)
for attr_name in dir(module):
item = getattr(module, attr_name)
if isinstance(item, Blueprint):
if item.name in app.blueprints:
continue
app.register_blueprint(item)
def generate_etag(data):