VNC 인증 실패 자동 해결 시스템 구현
- VNC 티켓 만료 시 자동 새로고침 API 엔드포인트 추가 (/api/vnc/refresh/<session_id>) - credentialsrequired 및 securityfailure 이벤트 시 자동 티켓 새로고침 로직 구현 - 새 티켓으로 자동 재연결 기능 추가 (기존 연결 종료 후 새 연결 생성) - 수동 새로고침 버튼 추가 (🔄 Refresh 버튼) - 인증 실패 발생 시 사용자에게 진행 상황 표시 - VNC 세션 데이터 자동 업데이트 및 타임스탬프 추가 이제 "Authentication failed" 오류 시 자동으로 새 VNC 티켓을 받아와서 재연결되어 사용자가 수동으로 새로고침할 필요가 없음 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -566,6 +566,55 @@ def create_app(config_name=None):
|
||||
print(f"❌ VNC API 오류: {e}")
|
||||
return jsonify({'error': str(e)}), 500
|
||||
|
||||
@app.route('/api/vnc/refresh/<session_id>', methods=['POST'])
|
||||
def api_vnc_refresh_ticket(session_id):
|
||||
"""VNC 티켓 새로고침 API"""
|
||||
try:
|
||||
# 세션 확인
|
||||
if session_id not in vnc_sessions:
|
||||
return jsonify({'error': '유효하지 않은 VNC 세션입니다.'}), 404
|
||||
|
||||
session_data = vnc_sessions[session_id]
|
||||
node = session_data['node']
|
||||
vmid = session_data['vmid']
|
||||
|
||||
print(f"🔄 VNC 티켓 새로고침 요청: {node}/{vmid}")
|
||||
|
||||
# Proxmox 클라이언트 생성
|
||||
client = ProxmoxClient(
|
||||
host=config['proxmox']['host'],
|
||||
username=config['proxmox']['username'],
|
||||
password=config['proxmox']['password']
|
||||
)
|
||||
|
||||
if not client.login():
|
||||
return jsonify({'error': 'Proxmox 로그인 실패'}), 500
|
||||
|
||||
# 새 VNC 티켓 생성
|
||||
vnc_data = client.get_vnc_ticket(node, vmid)
|
||||
if not vnc_data:
|
||||
return jsonify({'error': '새 VNC 티켓 생성 실패'}), 500
|
||||
|
||||
# 세션 업데이트
|
||||
vnc_sessions[session_id].update({
|
||||
'websocket_url': vnc_data['websocket_url'],
|
||||
'password': vnc_data.get('password', ''),
|
||||
'updated_at': datetime.now()
|
||||
})
|
||||
|
||||
print(f"✅ VNC 티켓 새로고침 완료: {session_id}")
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'websocket_url': vnc_data['websocket_url'],
|
||||
'password': vnc_data.get('password', ''),
|
||||
'message': '새 VNC 티켓이 생성되었습니다.'
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ VNC 티켓 새로고침 실패: {e}")
|
||||
return jsonify({'error': str(e)}), 500
|
||||
|
||||
@app.route('/vnc/<session_id>')
|
||||
def vnc_console(session_id):
|
||||
"""VNC 콘솔 페이지"""
|
||||
|
||||
Reference in New Issue
Block a user