diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 7b898f5..a021304 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -34,7 +34,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(784, 561); + this.ClientSize = new System.Drawing.Size(584, 561); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); diff --git a/Form1.cs b/Form1.cs index 19af638..3b69377 100644 --- a/Form1.cs +++ b/Form1.cs @@ -15,6 +15,7 @@ namespace VNCServerList public Form1() { InitializeComponent(); + this.Text = $"{Application.ProductName} ver {Application.ProductVersion}"; StartWebServer(); InitializeWebView(); diff --git a/Models/AppSettings.cs b/Models/AppSettings.cs index 206bb4b..5219a99 100644 --- a/Models/AppSettings.cs +++ b/Models/AppSettings.cs @@ -4,7 +4,9 @@ namespace VNCServerList.Models { public class AppSettings { + public string UserName { get; set; } = ""; public string VNCViewerPath { get; set; } = @"C:\Program Files\TightVNC\tvnviewer.exe"; public int WebServerPort { get; set; } = 8080; + public string Argument { get; set; } = "-useclipboard=no -scale=auto -showcontrols=yes"; } } \ No newline at end of file diff --git a/Models/VNCServer.cs b/Models/VNCServer.cs index b1720e5..d3866a8 100644 --- a/Models/VNCServer.cs +++ b/Models/VNCServer.cs @@ -7,6 +7,7 @@ namespace VNCServerList.Models public string User { get; set; } public string IP { get; set; } public string Category { get; set; } + public string Title { get; set; } public string Description { get; set; } public string Password { get; set; } public string Argument { get; set; } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index e2e29f4..d8ac043 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -8,9 +8,9 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("VNCServerList")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("SIMP")] [assembly: AssemblyProduct("VNCServerList")] -[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyCopyright("Copyright ©SIMP 2025")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 // 지정되도록 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("25.07.08.0000")] +[assembly: AssemblyFileVersion("25.07.08.0000")] diff --git a/Services/DatabaseService.cs b/Services/DatabaseService.cs index 05bcbfa..dc02faf 100644 --- a/Services/DatabaseService.cs +++ b/Services/DatabaseService.cs @@ -32,6 +32,7 @@ namespace VNCServerList.Services [User] [varchar](50) NOT NULL, [IP] [varchar](20) NOT NULL, [Category] [varchar](20) NULL, + [Title] [varchar](50) NULL, [Description] [varchar](100) NULL, [Password] [varchar](20) NULL, [Argument] [varchar](50) NULL, @@ -68,6 +69,7 @@ namespace VNCServerList.Services User = reader["User"].ToString(), IP = reader["IP"].ToString(), Category = reader["Category"] == DBNull.Value ? null : reader["Category"].ToString(), + Title = reader["Title"] == DBNull.Value ? null : reader["Title"].ToString(), Description = reader["Description"] == DBNull.Value ? null : reader["Description"].ToString(), Password = reader["Password"] == DBNull.Value ? null : reader["Password"].ToString(), Argument = reader["Argument"] == DBNull.Value ? null : reader["Argument"].ToString() @@ -100,6 +102,7 @@ namespace VNCServerList.Services User = reader["User"].ToString(), IP = reader["IP"].ToString(), Category = reader["Category"] == DBNull.Value ? null : reader["Category"].ToString(), + Title = reader["Title"] == DBNull.Value ? null : reader["Title"].ToString(), Description = reader["Description"] == DBNull.Value ? null : reader["Description"].ToString(), Password = reader["Password"] == DBNull.Value ? null : reader["Password"].ToString(), Argument = reader["Argument"] == DBNull.Value ? null : reader["Argument"].ToString() @@ -118,7 +121,7 @@ namespace VNCServerList.Services { connection.Open(); string sql = @" - INSERT INTO VNC_ServerList ([User], [IP], [Category], [Description], [Password], [Argument]) + INSERT INTO VNC_ServerList ([User], [IP], [Category], [Title],[Description], [Password], [Argument]) VALUES (@User, @IP, @Category, @Description, @Password, @Argument)"; using (var command = new SqlCommand(sql, connection)) @@ -126,6 +129,7 @@ namespace VNCServerList.Services command.Parameters.AddWithValue("@User", server.User); command.Parameters.AddWithValue("@IP", server.IP); command.Parameters.AddWithValue("@Category", (object)server.Category ?? DBNull.Value); + command.Parameters.AddWithValue("@Title", (object)server.Title ?? DBNull.Value); command.Parameters.AddWithValue("@Description", (object)server.Description ?? DBNull.Value); command.Parameters.AddWithValue("@Password", (object)server.Password ?? DBNull.Value); command.Parameters.AddWithValue("@Argument", (object)server.Argument ?? DBNull.Value); @@ -142,7 +146,7 @@ namespace VNCServerList.Services connection.Open(); string sql = @" UPDATE VNC_ServerList - SET [Category] = @Category, [Description] = @Description, + SET [Category] = @Category, [Title] = @Title, [Description] = @Description, [Password] = @Password, [Argument] = @Argument WHERE [User] = @User AND [IP] = @IP"; @@ -151,6 +155,7 @@ namespace VNCServerList.Services command.Parameters.AddWithValue("@User", server.User); command.Parameters.AddWithValue("@IP", server.IP); command.Parameters.AddWithValue("@Category", (object)server.Category ?? DBNull.Value); + command.Parameters.AddWithValue("@Title", (object)server.Title ?? DBNull.Value); command.Parameters.AddWithValue("@Description", (object)server.Description ?? DBNull.Value); command.Parameters.AddWithValue("@Password", (object)server.Password ?? DBNull.Value); command.Parameters.AddWithValue("@Argument", (object)server.Argument ?? DBNull.Value); diff --git a/Services/VNCService.cs b/Services/VNCService.cs index 530969a..0420d5d 100644 --- a/Services/VNCService.cs +++ b/Services/VNCService.cs @@ -20,25 +20,44 @@ namespace VNCServerList.Services { try { - var vncViewerPath = _settingsService.GetSettings().VNCViewerPath; + var settings = _settingsService.GetSettings(); + var vncViewerPath = settings.VNCViewerPath; if (!File.Exists(vncViewerPath)) { throw new FileNotFoundException($"VNC Viewer를 찾을 수 없습니다: {vncViewerPath}"); } + // 서버의 argument가 없으면 설정의 기본 argument 사용 + var arguments = $"-host={server.IP}"; + + if (!string.IsNullOrEmpty(server.Argument)) + { + arguments += $" {server.Argument}"; + } + else if (!string.IsNullOrEmpty(settings.Argument)) + { + arguments += $" {settings.Argument}"; + } + + // 비밀번호가 있으면 추가 + if (!string.IsNullOrEmpty(server.Password)) + { + arguments += $" -password={server.Password}"; + } + + System.Diagnostics.Debug.WriteLine($"VNC 실행: 경로='{vncViewerPath}', 인수='{arguments}'"); + // VNC Viewer 실행 var startInfo = new ProcessStartInfo { FileName = vncViewerPath, - Arguments = $"-host={server.IP} {server.Argument}", + Arguments = arguments, UseShellExecute = true }; Process.Start(startInfo); - // 연결 성공 (마지막 연결 시간 업데이트는 현재 테이블 구조에 없으므로 제거) - return true; } catch (Exception ex) diff --git a/Web/Controllers/VNCServerController.cs b/Web/Controllers/VNCServerController.cs index 691a380..26afc55 100644 --- a/Web/Controllers/VNCServerController.cs +++ b/Web/Controllers/VNCServerController.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Web.Http; +using System.Linq; using VNCServerList.Models; using VNCServerList.Services; @@ -22,12 +23,21 @@ namespace VNCServerList.Web.Controllers [HttpGet] [Route("list")] - public IHttpActionResult GetServerList() + public IHttpActionResult GetServerList(string userName = null) { try { var servers = _databaseService.GetAllServers(); - return Ok(servers); + + // 사용자 이름이 있으면 필터링 + 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); } catch (Exception ex) { diff --git a/Web/Startup.cs b/Web/Startup.cs index 39eb8c1..bc64ab8 100644 --- a/Web/Startup.cs +++ b/Web/Startup.cs @@ -36,6 +36,18 @@ namespace VNCServerList.Web }; app.UseFileServer(options); + + // 캐시 방지 미들웨어 추가 + app.Use(async (context, next) => + { + if (context.Request.Path.Value.EndsWith(".js") || context.Request.Path.Value.EndsWith(".css")) + { + context.Response.Headers["Cache-Control"] = "no-cache, no-store, must-revalidate"; + context.Response.Headers["Pragma"] = "no-cache"; + context.Response.Headers["Expires"] = "0"; + } + await next(); + }); } } } \ No newline at end of file diff --git a/Web/wwwroot/index.html b/Web/wwwroot/index.html index 420e25c..ed168c6 100644 --- a/Web/wwwroot/index.html +++ b/Web/wwwroot/index.html @@ -3,6 +3,9 @@
+ + +VNC 서버를 관리하고 연결할 수 있습니다.
+IP: {{serverIP}}
+ {{#if serverCategory}}카테고리: {{serverCategory}}
{{/if}} + {{#if serverDescription}}설명: {{serverDescription}}
{{/if}} + {{#if serverArgument}}인수: {{serverArgument}}
{{/if}} +등록된 서버가 없습니다.
+새 서버를 추가해보세요.
+사용자 설정이 필요합니다
+서버 목록을 보려면 먼저 사용자 이름을 설정해주세요.
+