teste rota /mmpSearch/api/
Deploy / Deploy (push) Successful in 2m39s
Details
Deploy / Deploy (push) Successful in 2m39s
Details
This commit is contained in:
parent
d831fd2c57
commit
5562b97846
|
|
@ -8,7 +8,6 @@ permalink: /samples/
|
|||
|
||||
<main class="main-content">
|
||||
<div class="publication">
|
||||
{% include modal_login.html %}
|
||||
|
||||
<div class="container">
|
||||
<br />
|
||||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue