- {% include modal_login.html %}

@@ -302,7 +301,7 @@ document.addEventListener('DOMContentLoaded', async () => { try { console.log("Verificando autenticação..."); // Verifica auth via Proxy Apache - const res = await fetch('/mmpSearch/api/check_auth'); + const res = await fetch('/api/check_auth'); const authData = await res.json(); console.log("Status do usuário:", authData); @@ -715,7 +714,7 @@ document.addEventListener('DOMContentLoaded', async () => { } // URL CORRIGIDA: Usando Proxy reverso (sem porta 33002) - const API_URL = '/mmpSearch/api/upload/sample'; + const API_URL = '/api/upload/sample'; // UI Loading confirmUploadBtn.classList.add('is-loading'); diff --git a/scripts/handler/upload_server.py b/scripts/handler/upload_server.py index 696f1701..09f33737 100755 --- a/scripts/handler/upload_server.py +++ b/scripts/handler/upload_server.py @@ -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/", methods=["GET"]) +@app.route("/api/download/", 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