Add 6 new tools: Hasher, Base64, JWT Decoder, Password Gen, Timestamp, Text Diff

- 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>
This commit is contained in:
Nirodan
2026-04-24 14:28:18 +02:00
parent 80ec5eca7b
commit 7f9c5c874a
17 changed files with 788 additions and 6 deletions
+46
View File
@@ -0,0 +1,46 @@
from flask import Blueprint, request, jsonify
from datetime import datetime, timezone
from util.logger import logger
from auth.token import verify_token
timestamp_blueprint = Blueprint('timestamp_tool', __name__)
_DATE_FORMATS = [
"%Y-%m-%dT%H:%M:%S",
"%Y-%m-%d %H:%M:%S",
"%Y-%m-%d",
"%d.%m.%Y %H:%M:%S",
"%d.%m.%Y",
]
@timestamp_blueprint.route('/api/timestamp/convert', methods=['POST'])
def convert_timestamp():
user = verify_token()
if not user:
return jsonify({"message": "Nicht autorisiert"}), 401
try:
data = request.get_json()
value = data.get("value", "").strip()
direction = data.get("direction", "unix_to_date")
if direction == "unix_to_date":
ts = float(value)
dt_utc = datetime.fromtimestamp(ts, tz=timezone.utc)
return jsonify({"utc": dt_utc.isoformat(), "unix": int(ts)})
dt = None
for fmt in _DATE_FORMATS:
try:
dt = datetime.strptime(value, fmt).replace(tzinfo=timezone.utc)
break
except ValueError:
continue
if dt is None:
return jsonify({"message": "Ungültiges Datumsformat"}), 400
logger.info(f"Timestamp konvertiert von {user['username']}")
return jsonify({"unix": int(dt.timestamp()), "utc": dt.isoformat()})
except Exception as e:
logger.error(f"Fehler Timestamp: {e}")
return jsonify({"message": "Ungültiger Wert"}), 400