step one of launch instance

This commit is contained in:
2025-06-12 15:07:01 +02:00
parent 5c2c514825
commit 83c94acbac
4 changed files with 392 additions and 12 deletions

View File

@@ -572,11 +572,33 @@ def test_nginx_connection():
return jsonify({'error': 'Missing required fields'}), 400
try:
# Test NGINX Proxy Manager connection
# First, get the JWT token
token_response = requests.post(
f"{url.rstrip('/')}/api/tokens",
json={
'identity': username,
'secret': password
},
headers={'Content-Type': 'application/json'},
timeout=5
)
if token_response.status_code != 200:
return jsonify({'error': 'Failed to authenticate with NGINX Proxy Manager'}), 400
token_data = token_response.json()
token = token_data.get('token')
if not token:
return jsonify({'error': 'No token received from NGINX Proxy Manager'}), 400
# Now test the connection using the token
response = requests.get(
f"{url.rstrip('/')}/api/nginx/proxy-hosts",
auth=(username, password),
headers={'Accept': 'application/json'},
headers={
'Authorization': f'Bearer {token}',
'Accept': 'application/json'
},
timeout=5
)

View File

@@ -376,7 +376,14 @@ def init_routes(main_bp):
db.session.commit()
return render_template('main/instances.html', instances=instances)
# Get connection settings
portainer_settings = KeyValueSettings.get_value('portainer_settings')
nginx_settings = KeyValueSettings.get_value('nginx_settings')
return render_template('main/instances.html',
instances=instances,
portainer_settings=portainer_settings,
nginx_settings=nginx_settings)
@main_bp.route('/instances/add', methods=['POST'])
@login_required