Add RDP Toggle API with venv support
RDP 관련 파일들을 RDP 폴더로 정리하고 API 시스템 추가 주요 변경사항: - FastAPI 기반 RDP/Shell 모드 전환 API 서버 추가 - venv 환경을 사용하는 자동 설치 스크립트 - requirements.txt로 패키지 의존성 관리 - systemd 서비스로 자동 시작 설정 - CORS 지원으로 외부 프론트엔드 연동 가능 - 실시간 상태 모니터링 API - 웹 기반 컨트롤 패널 포함 파일 구성: - rdp-toggle-api.py: FastAPI REST API 서버 - install-rdp-api.sh: venv 환경 자동 설치 - requirements.txt: Python 패키지 의존성 - rdp-toggle-web.html: 웹 컨트롤 패널 - README.md: 사용 가이드 API 기능: - GET /status: 현재 모드 확인 - POST /toggle: RDP/Shell 모드 전환 - GET /config: 설정 확인 - PUT /config: 설정 업데이트 리액트 프론트엔드에서 토글로 화면 모드 제어 가능 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
95
RDP/README.md
Normal file
95
RDP/README.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# RDP Toggle API
|
||||
|
||||
Proxmox VE 호스트에서 RDP/Shell 모드를 API로 전환할 수 있는 시스템
|
||||
|
||||
## 개요
|
||||
|
||||
외부에서 API 호출을 통해 Proxmox 호스트의 물리적 화면을 Shell 모드와 RDP 모드로 전환할 수 있습니다.
|
||||
프론트엔드에서 토글 버튼으로 화면 모드를 실시간으로 제어할 수 있습니다.
|
||||
|
||||
## 구성 파일
|
||||
|
||||
- **rdp-toggle-api.py** - FastAPI 기반 REST API 서버
|
||||
- **install-rdp-api.sh** - 자동 설치 스크립트 (venv 환경)
|
||||
- **requirements.txt** - Python 패키지 의존성
|
||||
- **RDP_TOGGLE_API.md** - API 상세 문서
|
||||
- **rdp-toggle-web.html** - 웹 기반 컨트롤 패널
|
||||
- **proxmox-auto-rdp-setup.sh** - Proxmox RDP 초기 설정 스크립트
|
||||
- **proxmox_auto_rdp_setup_korean.md** - 초기 설정 가이드
|
||||
|
||||
## 빠른 시작
|
||||
|
||||
```bash
|
||||
# 1. 설치
|
||||
chmod +x install-rdp-api.sh
|
||||
./install-rdp-api.sh
|
||||
|
||||
# 2. 서비스 확인
|
||||
systemctl status rdp-toggle-api
|
||||
|
||||
# 3. API 테스트
|
||||
curl http://localhost:8090/status
|
||||
```
|
||||
|
||||
## API 엔드포인트
|
||||
|
||||
### GET /status
|
||||
현재 상태 확인
|
||||
```bash
|
||||
curl http://localhost:8090/status
|
||||
```
|
||||
|
||||
### POST /toggle
|
||||
모드 전환
|
||||
```bash
|
||||
# RDP 모드
|
||||
curl -X POST http://localhost:8090/toggle \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"mode":"rdp"}'
|
||||
|
||||
# Shell 모드
|
||||
curl -X POST http://localhost:8090/toggle \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"mode":"shell"}'
|
||||
```
|
||||
|
||||
## 리액트 연동 예시
|
||||
|
||||
```jsx
|
||||
const [status, setStatus] = useState(null);
|
||||
const API_URL = 'http://your-proxmox-ip:8090';
|
||||
|
||||
// 상태 확인
|
||||
const fetchStatus = async () => {
|
||||
const res = await fetch(`${API_URL}/status`);
|
||||
const data = await res.json();
|
||||
setStatus(data);
|
||||
};
|
||||
|
||||
// 모드 전환
|
||||
const toggleMode = async (mode) => {
|
||||
await fetch(`${API_URL}/toggle`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ mode })
|
||||
});
|
||||
};
|
||||
```
|
||||
|
||||
## 설치 위치
|
||||
|
||||
- API 서버: `/opt/rdp-toggle-api/`
|
||||
- Python 가상환경: `/opt/rdp-toggle-api/venv/`
|
||||
- systemd 서비스: `/etc/systemd/system/rdp-toggle-api.service`
|
||||
|
||||
## 기능
|
||||
|
||||
- ✅ RDP ↔ Shell 모드 전환
|
||||
- ✅ 실시간 상태 모니터링
|
||||
- ✅ CORS 지원 (외부 접근 가능)
|
||||
- ✅ venv 환경 (패키지 충돌 방지)
|
||||
- ✅ systemd 서비스 (자동 시작)
|
||||
|
||||
## 포트
|
||||
|
||||
기본 포트: **8090**
|
||||
Reference in New Issue
Block a user