This commit is contained in:
backuppc
2025-07-08 13:29:40 +09:00
parent 8efe357430
commit 0d2da98470
4 changed files with 113 additions and 47 deletions

View File

@@ -28,13 +28,13 @@ namespace VNCServerList.Web.Controllers
try
{
var servers = _databaseService.GetAllServers();
// 사용자 이름이 있으면 필터링
if (!string.IsNullOrEmpty(userName))
{
servers = servers.Where(s => s.User.Equals(userName, StringComparison.OrdinalIgnoreCase)).ToList();
}
// 사용자명으로 오름차순 정렬
var sortedServers = servers.OrderBy(s => s.User).ThenBy(s => s.IP).ToList();
return Ok(sortedServers);
@@ -92,8 +92,8 @@ namespace VNCServerList.Web.Controllers
}
[HttpPut]
[Route("update")]
public IHttpActionResult UpdateServer([FromBody] VNCServer server)
[Route("update/{originalUser}/{originalIp}")]
public IHttpActionResult UpdateServer(string originalUser, string originalIp, [FromBody] VNCServer server)
{
try
{
@@ -102,7 +102,8 @@ namespace VNCServerList.Web.Controllers
return BadRequest("서버 정보가 없습니다.");
}
bool success = _databaseService.UpdateServer(server);
// 원본 사용자명과 IP로 서버를 찾아서 업데이트
bool success = _databaseService.UpdateServerByUserAndIP(originalUser, originalIp, server);
if (success)
{
return Ok(new { Message = "서버가 성공적으로 업데이트되었습니다." });
@@ -170,10 +171,11 @@ namespace VNCServerList.Web.Controllers
{
bool isInstalled = _vncService.IsVNCViewerInstalled();
string path = _vncService.GetVNCViewerPath();
return Ok(new {
IsInstalled = isInstalled,
Path = path
return Ok(new
{
IsInstalled = isInstalled,
Path = path
});
}
catch (Exception ex)
@@ -210,13 +212,13 @@ namespace VNCServerList.Web.Controllers
try
{
System.Diagnostics.Debug.WriteLine("=== 설정 조회 시작 ===");
var settings = _settingsService.GetSettings();
// 디버깅용 로그
System.Diagnostics.Debug.WriteLine($"조회된 설정: VNCViewerPath='{settings.VNCViewerPath}', WebServerPort={settings.WebServerPort}");
System.Diagnostics.Debug.WriteLine("=== 설정 조회 완료 ===");
return Ok(settings);
}
catch (Exception ex)
@@ -234,7 +236,7 @@ namespace VNCServerList.Web.Controllers
try
{
System.Diagnostics.Debug.WriteLine("=== 설정 저장 요청 시작 ===");
if (settings == null)
{
System.Diagnostics.Debug.WriteLine("설정 객체가 null입니다.");
@@ -247,12 +249,12 @@ namespace VNCServerList.Web.Controllers
System.Diagnostics.Debug.WriteLine($"WebServerPort 타입: {settings.WebServerPort.GetType()}");
_settingsService.SaveSettings(settings);
// 저장된 설정 확인
var savedSettings = _settingsService.GetSettings();
System.Diagnostics.Debug.WriteLine($"저장된 설정: VNCViewerPath='{savedSettings.VNCViewerPath}', WebServerPort={savedSettings.WebServerPort}");
System.Diagnostics.Debug.WriteLine("=== 설정 저장 완료 ===");
return Ok(new { Message = "설정이 저장되었습니다." });
}
catch (Exception ex)
@@ -263,4 +265,4 @@ namespace VNCServerList.Web.Controllers
}
}
}
}
}