7f9c5c874a
- backend/tools/hasher.py: POST /api/hash/sha256 and /api/hash/bcrypt (bcrypt added to requirements) - backend/tools/base64tool.py: POST /api/base64/encode and /api/base64/decode - backend/tools/jwtdecoder.py: POST /api/jwt/decode (signature verification disabled) - backend/tools/passwordgen.py: POST /api/password/generate with charset and length options - backend/tools/timestamp.py: POST /api/timestamp/convert (unix<->date, ISO 8601 + German format) - backend/tools/textdiff.py: POST /api/text/diff returning structured added/removed/unchanged lines - All blueprints registered in app.py and tools/__init__.py - React components with copy button, dark/light mode support via CSS variables - ToolOverview rebuilt as card grid; App.jsx routes added for all tools Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
import os
|
|
import sys
|
|
if __name__ != '__main__':
|
|
import sys
|
|
sys.path.append(os.path.dirname(__file__))
|
|
|
|
from flask import Flask, send_from_directory, redirect
|
|
from util.logger import logger
|
|
from util.db_config import is_configured, load_config, test_connection
|
|
from util.setup_routes import setup_blueprint
|
|
from util.limiter import limiter
|
|
from auth import auth_bp
|
|
from tools import (
|
|
md5_blueprint,
|
|
hasher_blueprint,
|
|
base64_blueprint,
|
|
jwt_decoder_blueprint,
|
|
passwordgen_blueprint,
|
|
timestamp_blueprint,
|
|
textdiff_blueprint,
|
|
)
|
|
from admin import admin_bp
|
|
|
|
app = Flask(__name__, template_folder="templates")
|
|
limiter.init_app(app)
|
|
|
|
# Blueprints registrieren
|
|
app.register_blueprint(setup_blueprint)
|
|
app.register_blueprint(auth_bp)
|
|
app.register_blueprint(md5_blueprint)
|
|
app.register_blueprint(hasher_blueprint)
|
|
app.register_blueprint(base64_blueprint)
|
|
app.register_blueprint(jwt_decoder_blueprint)
|
|
app.register_blueprint(passwordgen_blueprint)
|
|
app.register_blueprint(timestamp_blueprint)
|
|
app.register_blueprint(textdiff_blueprint)
|
|
app.register_blueprint(admin_bp)
|
|
|
|
# 🌐 React-Frontend ausliefern
|
|
@app.route('/', defaults={'path': ''})
|
|
@app.route('/<path:path>')
|
|
def serve_frontend(path):
|
|
if not is_configured() or not test_connection(load_config()):
|
|
return redirect('/setup')
|
|
|
|
if path.startswith('setup') or path.startswith('api'):
|
|
return redirect(f'/{path}')
|
|
|
|
dist_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'frontend', 'dist'))
|
|
file_path = os.path.join(dist_dir, path)
|
|
|
|
if path and os.path.exists(file_path):
|
|
return send_from_directory(dist_dir, path)
|
|
else:
|
|
return send_from_directory(dist_dir, 'index.html')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
os.makedirs("config", exist_ok=True)
|
|
app.run(host='0.0.0.0', port=5000, debug=True)
|