fix: DrHider fully on VM, managed Flask only redirect — v1.1/v1.0.194
Deploy contracts-flask / validate (push) Successful in 0s
Deploy contracts-flask / validate (push) Successful in 0s
This commit is contained in:
+2
-33
@@ -105,39 +105,8 @@ def ci_cd():
|
||||
|
||||
@app.route("/DrHider")
|
||||
def drhider():
|
||||
return render_template("drhider.html")
|
||||
|
||||
|
||||
@app.route("/api/drhider", methods=["POST"])
|
||||
def api_drhider():
|
||||
"""Обфускация: JSON {files: [{name, data: base64}]} → ZIP."""
|
||||
import io, base64
|
||||
from flask import send_file
|
||||
from services.drhider import obfuscate_files
|
||||
from services.llm_client import HttpxLLMClient
|
||||
|
||||
body = request.get_json(silent=True) or {}
|
||||
raw_files = body.get("files", [])
|
||||
if not raw_files:
|
||||
return jsonify({"ok": False, "error": "Нет файлов"}), 400
|
||||
|
||||
files = []
|
||||
for f in raw_files:
|
||||
name = f.get("name", "unnamed")
|
||||
data = base64.b64decode(f.get("data", ""))
|
||||
files.append((name, data, f.get("type", "")))
|
||||
|
||||
if not files:
|
||||
return jsonify({"ok": False, "error": "Нет файлов"}), 400
|
||||
|
||||
try:
|
||||
llm = HttpxLLMClient(LLM_URL, LLM_KEY, LLM_MODEL) if LLM_KEY else None
|
||||
zip_data, _csv = obfuscate_files(files, llm_client=llm)
|
||||
buf = io.BytesIO(zip_data)
|
||||
buf.seek(0)
|
||||
return send_file(buf, mimetype="application/zip", as_attachment=True, download_name="drhider_output.zip")
|
||||
except Exception as e:
|
||||
return jsonify({"ok": False, "error": str(e)}), 500
|
||||
from flask import redirect
|
||||
return redirect("https://contracts.kube5s.ru/drhider", code=302)
|
||||
|
||||
|
||||
@app.route("/health")
|
||||
|
||||
Reference in New Issue
Block a user