From 0729d7a2887c874d8cddd5c451099433ace4210f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E9=A1=BA=E6=98=8E?= Date: Thu, 11 Apr 2024 11:42:47 +0800 Subject: [PATCH] ITME --- Bridge/HttpBridgeClient.cs | 7 +++--- Mime/HttpMimeServier.cs | 46 +++++++++++++++++----------------- Program.cs | 7 ++++-- Proxy/SiteActivity.cs | 4 +-- Proxy/SiteAppActivity.cs | 11 ++++---- Proxy/SiteAuthActivity.cs | 2 +- Proxy/SiteConfActivity.cs | 2 +- Proxy/SiteConfImageActivity.cs | 2 +- Proxy/SiteLogActivity.cs | 2 +- Proxy/SiteLogConfActivity.cs | 2 +- Proxy/SiteMarketActivity.cs | 2 +- Proxy/SiteMimeActivity.cs | 2 +- Proxy/SiteSSHActivities.cs | 2 +- Proxy/SiteSearchActivity.cs | 2 +- Proxy/SiteServerActivity.cs | 2 +- Proxy/SiteSetupActivity.cs | 2 +- Proxy/SiteUIActivity.cs | 9 +++---- Proxy/SiteUMCActivity.cs | 2 +- Proxy/SiteUserActivity.cs | 2 +- Proxy/UIConfigActivity.cs | 6 ++--- Proxy/WebFactory.cs | 2 +- Proxy/WebServlet.cs | 2 +- Resources/desktop.html | 2 +- Resources/desktop.site.html | 2 +- Resources/umc.html | 2 +- 25 files changed, 65 insertions(+), 61 deletions(-) diff --git a/Bridge/HttpBridgeClient.cs b/Bridge/HttpBridgeClient.cs index e81762a..645d6a2 100644 --- a/Bridge/HttpBridgeClient.cs +++ b/Bridge/HttpBridgeClient.cs @@ -299,11 +299,12 @@ namespace UMC.ITME { lock (_bridgeClients) { - for (var i = 0; i < _bridgeClients.Count; i++) + var cls = _bridgeClients.Values.ToArray(); + for (var i = 0; i < cls.Length; i++) { try { - _bridgeClients[i]?._Stop(); + cls[i]._Stop(); } catch { @@ -338,7 +339,7 @@ namespace UMC.ITME void _Stop() { _stoped = true; - base.Close(); + this.Close(); } HttpMimeRequest Bridge(int pid) { diff --git a/Mime/HttpMimeServier.cs b/Mime/HttpMimeServier.cs index 5bfad83..39453ee 100644 --- a/Mime/HttpMimeServier.cs +++ b/Mime/HttpMimeServier.cs @@ -888,32 +888,32 @@ namespace UMC.ITME } - private void Cert() - { - var secret = UMC.Data.WebResource.Instance().Provider["appSecret"]; - int nextIndex = 0; + // private void Cert() + // { + // var secret = UMC.Data.WebResource.Instance().Provider["appSecret"]; + // int nextIndex = 0; - if (String.IsNullOrEmpty(secret) == false) - { - var now = Utility.TimeSpan(DateTime.Now.AddDays(5)); - while (nextIndex >= 0) - { + // if (String.IsNullOrEmpty(secret) == false) + // { + // var now = Utility.TimeSpan(DateTime.Now.AddDays(5)); + // while (nextIndex >= 0) + // { - var fs = HotCache.Find(new SiteCert(), false, 0, 500, out nextIndex); - foreach (var r in fs) - { - if ((r.IsApiumc ?? false) == false && String.IsNullOrEmpty(r.PrivateKey) == false && String.IsNullOrEmpty(r.PublicKey) == false) - { - if (r.ExpirationTime < now) - { - CheckSSl(secret, r.Domain, false); - } - } - }; + // var fs = HotCache.Find(new SiteCert(), false, 0, 500, out nextIndex); + // foreach (var r in fs) + // { + // if ((r.IsApiumc ?? false) == false && String.IsNullOrEmpty(r.PrivateKey) == false && String.IsNullOrEmpty(r.PublicKey) == false) + // { + // if (r.ExpirationTime < now) + // { + // CheckSSl(secret, r.Domain, false); + // } + // } + // }; - } - } - } + // } + // } + // } private void Unix(object sender, SocketAsyncEventArgs eventArgs) { var client = eventArgs.AcceptSocket; diff --git a/Program.cs b/Program.cs index b2f181d..624e683 100644 --- a/Program.cs +++ b/Program.cs @@ -285,7 +285,7 @@ namespace UMC.ITME { Excel("main"); } - break; + break; case "restart": if (IsRun()) { @@ -370,7 +370,7 @@ namespace UMC.ITME }; if (OperatingSystem.IsWindows()) { - thread.SetApartmentState(ApartmentState.STA); + thread.SetApartmentState(ApartmentState.STA); } thread.Start(); Thread.Sleep(5000); @@ -545,7 +545,10 @@ namespace UMC.ITME AppDomain.CurrentDomain.UnhandledException += UnhandledException; var p = typeof(Program).Assembly.GetCustomAttributes().FirstOrDefault(r => r is System.Reflection.AssemblyInformationalVersionAttribute) as System.Reflection.AssemblyInformationalVersionAttribute; APIProxy.Version = p?.InformationalVersion ?? "1.0.0"; + // using Microsoft.Extensions.PlatformAbstractions; + // string version = PlatformServices.Default.Application.ApplicationVersion; + // AppDomain.CurrentDomain. Register(); // UMC.Data.HotCache.Namespace(typeof(UMC.Proxy.Entities.Cookie).Namespace); diff --git a/Proxy/SiteActivity.cs b/Proxy/SiteActivity.cs index f9d8e73..a8c0192 100644 --- a/Proxy/SiteActivity.cs +++ b/Proxy/SiteActivity.cs @@ -16,7 +16,7 @@ namespace UMC.ITME.Activities /// /// 应用管理 /// - [UMC.Web.Apiumc("Proxy", "Site", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "Site", Auth = WebAuthType.User)] public class SiteActivity : WebActivity { @@ -75,7 +75,7 @@ namespace UMC.ITME.Activities } } - this.Context.Response.Redirect("Proxy", "Market", site.Root); + this.Context.Response.Redirect("ITME", "Market", site.Root); } public static WebMeta PutMarket(Site site, string secret) { diff --git a/Proxy/SiteAppActivity.cs b/Proxy/SiteAppActivity.cs index 3b86b01..a92317c 100644 --- a/Proxy/SiteAppActivity.cs +++ b/Proxy/SiteAppActivity.cs @@ -9,7 +9,7 @@ using UMC.Data; namespace UMC.ITME.Activities { - [UMC.Web.Apiumc("Proxy", "App", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "App", Auth = WebAuthType.User)] public class SiteAppActivity : UMC.Web.WebActivity { public override void ProcessActivity(WebRequest request, WebResponse response) @@ -57,6 +57,7 @@ namespace UMC.ITME.Activities sts.Columns.Add("target"); sts.Columns.Add("badge"); sts.Columns.Add("desktop", typeof(bool)); + sts.Columns.Add("group"); var user = this.Context.Token.Identity(); @@ -74,8 +75,8 @@ namespace UMC.ITME.Activities sts.Rows.Add("应用管理", "Market", "/Apps", "/css/images/icon/appmgr.png", "max", "", true); - sts.Rows.Add("发布应用", "Add", "javascript:void(0)", - "/css/images/icon/add.png", "max", "", true); + sts.Rows.Add("发布应用", "Market", "/Apps?Create", + "/css/images/icon/add.png", "max", "", true, "应用管理"); } sts.Rows.Add("堡垒机", "WebSSH", "/WebSSH", @@ -140,14 +141,14 @@ namespace UMC.ITME.Activities else { - strUrl = $"{request.Url.Scheme}://{d.Root}{union}{home}{d.Home}"; + strUrl = $"{request.Url.Scheme}://{d.Root}{union}{home}{d.Home}"; } } else if (authCnf.Contains("*") || d.AuthType == WebAuthType.All) { strUrl = $"{request.Url.Scheme}://{d.Root}{union}{home}{d.Home}"; } - } + } var isDesktop = desktop.ContainsKey(d.Root); if (d.IsDesktop == true) { diff --git a/Proxy/SiteAuthActivity.cs b/Proxy/SiteAuthActivity.cs index e47ac5c..0c682f7 100644 --- a/Proxy/SiteAuthActivity.cs +++ b/Proxy/SiteAuthActivity.cs @@ -14,7 +14,7 @@ namespace UMC.ITME.Activities /// /// 邮箱账户 /// - [UMC.Web.Apiumc("Proxy", "Auth", Auth = WebAuthType.Guest)] + [UMC.Web.Apiumc("ITME", "Auth", Auth = WebAuthType.Guest)] public class SiteAuthActivity : WebActivity { diff --git a/Proxy/SiteConfActivity.cs b/Proxy/SiteConfActivity.cs index 604f052..ed09df2 100644 --- a/Proxy/SiteConfActivity.cs +++ b/Proxy/SiteConfActivity.cs @@ -7,7 +7,7 @@ namespace UMC.ITME.Activities /// /// 邮箱账户 /// - [UMC.Web.Apiumc("Proxy", "Conf", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "Conf", Auth = WebAuthType.User)] public class SiteConfActivity : WebActivity { public override void ProcessActivity(WebRequest request, WebResponse response) diff --git a/Proxy/SiteConfImageActivity.cs b/Proxy/SiteConfImageActivity.cs index 0c90c1d..4df915b 100644 --- a/Proxy/SiteConfImageActivity.cs +++ b/Proxy/SiteConfImageActivity.cs @@ -8,7 +8,7 @@ namespace UMC.ITME.Activities /// /// 图片处理配置 /// - [UMC.Web.Apiumc("Proxy", "ConfImage", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "ConfImage", Auth = WebAuthType.User)] public class SiteConfImageActivity : WebActivity { string GetPostion(String m) diff --git a/Proxy/SiteLogActivity.cs b/Proxy/SiteLogActivity.cs index 26239d5..4b2eceb 100644 --- a/Proxy/SiteLogActivity.cs +++ b/Proxy/SiteLogActivity.cs @@ -8,7 +8,7 @@ namespace UMC.ITME.Activities /// /// 应用管理 /// - [UMC.Web.Apiumc("Proxy", "Log", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "Log", Auth = WebAuthType.User)] public class SiteLogActivity : WebActivity { diff --git a/Proxy/SiteLogConfActivity.cs b/Proxy/SiteLogConfActivity.cs index 01fa6b3..2b0ebb8 100644 --- a/Proxy/SiteLogConfActivity.cs +++ b/Proxy/SiteLogConfActivity.cs @@ -6,7 +6,7 @@ using UMC.Web.UI; namespace UMC.ITME { - // [Mapping("Proxy", "LogConf", Auth = WebAuthType.Admin, Desc = "服务器日志")] + // [Mapping("ITME", "LogConf", Auth = WebAuthType.Admin, Desc = "服务器日志")] class SiteLogConfActivity : WebActivity { diff --git a/Proxy/SiteMarketActivity.cs b/Proxy/SiteMarketActivity.cs index b6467dd..78c7fda 100644 --- a/Proxy/SiteMarketActivity.cs +++ b/Proxy/SiteMarketActivity.cs @@ -13,7 +13,7 @@ using UMC.Net; namespace UMC.ITME.Activities { - [Apiumc("Proxy", "Market", Desc = "我的出售", Auth = WebAuthType.Admin)] + [Apiumc("ITME", "Market", Desc = "我的出售", Auth = WebAuthType.Admin)] class SiteMarketActivity : UMC.Web.WebActivity { public override void ProcessActivity(UMC.Web.WebRequest request, UMC.Web.WebResponse response) diff --git a/Proxy/SiteMimeActivity.cs b/Proxy/SiteMimeActivity.cs index cc1b688..678ca94 100644 --- a/Proxy/SiteMimeActivity.cs +++ b/Proxy/SiteMimeActivity.cs @@ -15,7 +15,7 @@ namespace UMC.ITME.Activities /// /// 邮箱账户 /// - [UMC.Web.Apiumc("Proxy", "Mime", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "Mime", Auth = WebAuthType.User)] public class SiteMimeActivity : WebActivity { bool Check(Hashtable login) diff --git a/Proxy/SiteSSHActivities.cs b/Proxy/SiteSSHActivities.cs index 8040991..0ae0449 100644 --- a/Proxy/SiteSSHActivities.cs +++ b/Proxy/SiteSSHActivities.cs @@ -11,7 +11,7 @@ using UMC.Net; namespace UMC.ITME.Activities; -[Apiumc("Proxy", "SSH", Auth = WebAuthType.User)] +[Apiumc("ITME", "SSH", Auth = WebAuthType.User)] class SiteSSHActivities : Web.WebActivity { diff --git a/Proxy/SiteSearchActivity.cs b/Proxy/SiteSearchActivity.cs index b001d77..e8b14ea 100644 --- a/Proxy/SiteSearchActivity.cs +++ b/Proxy/SiteSearchActivity.cs @@ -11,7 +11,7 @@ using UMC.Web.UI; namespace UMC.ITME.Activities { - [UMC.Web.Apiumc("Proxy", "Search", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "Search", Auth = WebAuthType.User)] public class SiteSearchActivity : UMC.Web.WebActivity { public override void ProcessActivity(WebRequest request, WebResponse response) diff --git a/Proxy/SiteServerActivity.cs b/Proxy/SiteServerActivity.cs index 34221bc..8c34e3f 100644 --- a/Proxy/SiteServerActivity.cs +++ b/Proxy/SiteServerActivity.cs @@ -17,7 +17,7 @@ using UMC.Web.UI; namespace UMC.ITME.Activities { - [Apiumc("Proxy", "Server", Auth = WebAuthType.Admin, Desc = "Http服务配置")] + [Apiumc("ITME", "Server", Auth = WebAuthType.Admin, Desc = "Http服务配置")] public class SiteServerActivity : WebActivity { diff --git a/Proxy/SiteSetupActivity.cs b/Proxy/SiteSetupActivity.cs index e8a8000..78d7083 100644 --- a/Proxy/SiteSetupActivity.cs +++ b/Proxy/SiteSetupActivity.cs @@ -17,7 +17,7 @@ namespace UMC.ITME.Activities /// /// 邮箱账户 /// - [UMC.Web.Apiumc("Proxy", "Setup", Auth = WebAuthType.Admin)] + [UMC.Web.Apiumc("ITME", "Setup", Auth = WebAuthType.Admin)] class SiteSetupActivity : WebActivity { diff --git a/Proxy/SiteUIActivity.cs b/Proxy/SiteUIActivity.cs index cc00467..bb0e73f 100644 --- a/Proxy/SiteUIActivity.cs +++ b/Proxy/SiteUIActivity.cs @@ -6,7 +6,7 @@ using UMC.Web.UI; namespace UMC.ITME.Activities { - [UMC.Web.Apiumc("Proxy", "UI", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "UI", Auth = WebAuthType.User)] public class SiteUIActivity : UMC.Web.WebActivity { public override void ProcessActivity(WebRequest request, WebResponse response) @@ -26,12 +26,11 @@ namespace UMC.ITME.Activities ui.UIHeader = new UIHeader().Slider(new WebMeta[] { new WebMeta().Put("src", surl) }); UMC.Web.UI.UIIcon iIcon = new Web.UI.UIIcon(); if (request.IsMaster) - {//Icon('\uf108', 0x34bfa3)//.Icon('\uf085', 0x40c9c6) - iIcon.Add(new UIEventText("堡垒机").Src(new Uri(request.Url, "/css/images/icon/computer.png").AbsoluteUri).Click(new UIClick("Proxy", "SSH"))); - iIcon.Add(new UIEventText("应用管理").Src(new Uri(request.Url, "/css/images/icon/appmgr.png").AbsoluteUri).Click(new UIClick("Proxy", "Site"))); + { + iIcon.Add(new UIEventText("堡垒机").Src(new Uri(request.Url, "/css/images/icon/computer.png").AbsoluteUri).Click(new UIClick("ITME", "SSH"))); + iIcon.Add(new UIEventText("应用管理").Src(new Uri(request.Url, "/css/images/icon/appmgr.png").AbsoluteUri).Click(new UIClick("ITME", "Site"))); iIcon.Add(new UIEventText("组织账户").Icon('\uf0c0', 0x36a3f7).Click(new UIClick("Settings", "Organize"))); iIcon.Add(new UIEventText("功能授权").Icon('\uf214', 0xf4516c).Click(new UIClick("Settings", "AuthKey"))); -//css/images/icon/market.png ui.Add(iIcon); } diff --git a/Proxy/SiteUMCActivity.cs b/Proxy/SiteUMCActivity.cs index f66e065..4456625 100644 --- a/Proxy/SiteUMCActivity.cs +++ b/Proxy/SiteUMCActivity.cs @@ -17,7 +17,7 @@ namespace UMC.ITME.Activities /// /// 邮箱账户 /// - [UMC.Web.Apiumc("Proxy", "UMC", Auth = WebAuthType.Admin)] + [UMC.Web.Apiumc("ITME", "UMC", Auth = WebAuthType.Admin)] class SiteUMCActivity : WebActivity { diff --git a/Proxy/SiteUserActivity.cs b/Proxy/SiteUserActivity.cs index b7c85a4..a14ca3e 100644 --- a/Proxy/SiteUserActivity.cs +++ b/Proxy/SiteUserActivity.cs @@ -9,7 +9,7 @@ using UMC.Data.Entities; namespace UMC.ITME.Activities { - [UMC.Web.Apiumc("Proxy", "User", Auth = WebAuthType.User)] + [UMC.Web.Apiumc("ITME", "User", Auth = WebAuthType.User)] public class SiteUserActivity : WebActivity { diff --git a/Proxy/UIConfigActivity.cs b/Proxy/UIConfigActivity.cs index 6357fbc..1399dd4 100644 --- a/Proxy/UIConfigActivity.cs +++ b/Proxy/UIConfigActivity.cs @@ -26,8 +26,8 @@ namespace UMC.ITME.Activities var footBar = new List { - new WebMeta().Put("text", "云桌面", "key", "Pager", "cmd", "UI", "model", "Proxy", "icon", "\uf1b3", "RefreshEvent", "Proxy.Site"), - new WebMeta("text", "发布应用", "icon", "\ue907").Put("max", true).Put("click", new UIClick("Proxy", "Setup")), + new WebMeta().Put("text", "云桌面", "key", "Pager", "cmd", "UI", "model", "ITME", "icon", "\uf1b3", "RefreshEvent", "ITME.Site"), + new WebMeta("text", "发布应用", "icon", "\ue907").Put("max", true).Put("click", new UIClick("ITME", "Setup")), new WebMeta().Put("text", "我的", "key", "Pager", "cmd", "Self", "model", "Account", "icon", "", "RefreshEvent", "UI.Setting").Put("search", new WebMeta("Type", "Setting")) }; this.Context.Reset(new WebMeta().Put("footBar", footBar)); @@ -48,7 +48,7 @@ namespace UMC.ITME.Activities if (url.AbsolutePath.StartsWith("/UMC/Platform/Apper")) { var Setup = System.Web.HttpUtility.ParseQueryString(url.Query).Get("Setup"); - this.Context.Send(new UIClick("Proxy", "Setup").Send(new WebMeta("_", Setup)), true); + this.Context.Send(new UIClick("ITME", "Setup").Send(new WebMeta("_", Setup)), true); } diff --git a/Proxy/WebFactory.cs b/Proxy/WebFactory.cs index 3574482..c072deb 100644 --- a/Proxy/WebFactory.cs +++ b/Proxy/WebFactory.cs @@ -225,7 +225,7 @@ namespace UMC.ITME var webReq = httpProxy.Reqesut(content.Transfer(httpProxy.Domain)); httpProxy.AuthBridge(webReq.Headers); // webReq.Headers[] - + webReq.Headers["x-forwarded-proto"] = request.Url.Scheme; webReq.Headers[System.Net.HttpRequestHeader.Host] = request.Url.Authority; webReq.RawUrl = $"/UMC/{Utility.Guid(this.Context.Token.Device.Value)}/{query}"; webReq.ContentType = "application/x-www-form-urlencoded"; diff --git a/Proxy/WebServlet.cs b/Proxy/WebServlet.cs index 48c2c02..d24f8c9 100644 --- a/Proxy/WebServlet.cs +++ b/Proxy/WebServlet.cs @@ -36,7 +36,7 @@ namespace UMC.ITME } else { - Error(context, "签发证书", "Apiumc域名证书服务

建议:请在云桌面->应用设置->网关服务中集中管理证书", $"$.UI.Command('Proxy','Server',{{Model:'CSR',Domain:'{host}'}})"); + Error(context, "签发证书", "ITME域名证书服务

建议:请在云桌面->应用设置->网关服务中集中管理证书", $"$.UI.Command('ITME','Server',{{Model:'CSR',Domain:'{host}'}})"); } } void Unauthorized(Net.NetContext context) diff --git a/Resources/desktop.html b/Resources/desktop.html index 6ffcbd6..081bcea 100644 --- a/Resources/desktop.html +++ b/Resources/desktop.html @@ -119,7 +119,7 @@