teste rota /mmpSearch/api/

This commit is contained in:
JotaChina committed 2025-12-09 22:08:22 -03:00
1 parent 8526d74eca
commit 879ec3cb7b
2 files changed
+10 -11

No files matched your search

+8 -8
View File
@@ -243,7 +243,7 @@ def process_and_build(filename):
# ROTAS DE AUTENTICAÇÃO
# ==============================================================================
@app.route('/mmpSearch/api/register', methods=['POST'])
@app.route('/api/register', methods=['POST'])
def register():
data = request.json
if not data or not data.get('username') or not data.get('password'):
@@ -259,7 +259,7 @@ def register():
except Exception as e:
return jsonify({"message": f"Erro: {str(e)}"}), 500
@app.route('/mmpSearch/api/login', methods=['POST'])
@app.route('/api/login', methods=['POST'])
def login():
data = request.json
user = User.query.filter_by(username=data['username']).first()
@@ -268,13 +268,13 @@ def login():
return jsonify({"message": "Login realizado", "user": user.username}), 200
return jsonify({"message": "Credenciais inválidas"}), 401
@app.route('/mmpSearch/api/logout', methods=['POST'])
@app.route('/api/logout', methods=['POST'])
@login_required
def logout():
logout_user()
return jsonify({"message": "Logout realizado"}), 200
@app.route('/mmpSearch/api/check_auth', methods=['GET'])
@app.route('/api/check_auth', methods=['GET'])
def check_auth():
if current_user.is_authenticated:
return jsonify({"logged_in": True, "user": current_user.username})
@@ -284,7 +284,7 @@ def check_auth():
# ROTAS PRINCIPAIS
# ==============================================================================
@app.route("/mmpSearch/api/download/<project_name>", methods=["GET"])
@app.route("/api/download/<project_name>", methods=["GET"])
def download_project_package(project_name):
"""Gera um ZIP com caminhos limpos (Não exige login para baixar)."""
if not project_name.lower().endswith('.mmp'):
@@ -331,7 +331,7 @@ def download_project_package(project_name):
return jsonify({"error": f"Erro ao gerar pacote: {str(e)}"}), 500
@app.route("/mmpSearch/api/upload", methods=["POST"])
@app.route("/api/upload", methods=["POST"])
@login_required # <--- PROTEGIDO
def upload_file():
if "project_file" not in request.files:
@@ -387,7 +387,7 @@ def upload_file():
return jsonify({"error": "Tipo de arquivo não permitido"}), 400
@app.route("/mmpSearch/api/upload/resolve", methods=["POST"])
@app.route("/api/upload/resolve", methods=["POST"])
@login_required # <--- PROTEGIDO
def resolve_samples():
project_filename = request.form.get('project_file')
@@ -415,7 +415,7 @@ def resolve_samples():
return jsonify({"error": "Falha ao atualizar o arquivo de projeto."}), 500
@app.route('/mmpSearch/api/upload/sample', methods=['POST'])
@app.route('/api/upload/sample', methods=['POST'])
@login_required # <--- PROTEGIDO
def upload_sample_standalone():
if 'sample_file' not in request.files: return jsonify({'error': 'Nenhum arquivo'}), 400