diff --git a/Bridge/HttpBridgeActivity.cs b/Bridge/HttpBridgeActivity.cs index 4698585..11b7aaf 100644 --- a/Bridge/HttpBridgeActivity.cs +++ b/Bridge/HttpBridgeActivity.cs @@ -139,8 +139,10 @@ namespace UMC.Host }), 0); var src = this.AsyncDialog("API", r => { - var appId = provider["appId"]; - return this.DialogValue($"https://api.apiumc.com/UMC/Platform/Alipay/Bridge?AuthKey={appId}"); + + this.Prompt("支付参数不正确,请联系官方"); + // var appId = provider["appId"]; + // return this.DialogValue($"https://api.apiumc.com/UMC/Platform/Payment/Bridge?AuthKey={appId}"); }); response.Redirect(new Uri($"{src}&Combo={ComboValue}")); diff --git a/Mime/HttpMimeServier.cs b/Mime/HttpMimeServier.cs index 31e4960..2c8d42c 100644 --- a/Mime/HttpMimeServier.cs +++ b/Mime/HttpMimeServier.cs @@ -455,9 +455,7 @@ namespace UMC.Host static async void Pipe() { var key = UMC.Data.Utility.Parse36Encode(UMC.Data.Utility.IntParse(new Guid(UMC.Data.Utility.MD5(UMC.Data.Utility.MapPath("~"))))); ; - using (NamedPipeServerStream pipeServer = - new NamedPipeServerStream($"APIUMC", PipeDirection.InOut)) - // new NamedPipeServerStream($"APIUMC", PipeDirection.InOut)) + using (NamedPipeServerStream pipeServer = new NamedPipeServerStream($"APIUMC", PipeDirection.InOut)) { do { @@ -551,7 +549,7 @@ namespace UMC.Host var webr2 = new Uri(APIProxy.Uri, "Certificater").WebRequest(); UMC.Proxy.Utility.Sign(webr2, new System.Collections.Specialized.NameValueCollection(), secret); - var webr = webr2.Post(new WebMeta().Put("type", "apply", "domain", host)); + var webr = webr2.Post(new WebMeta().Put("type", "apply", "domain", host).Put("dcv", str.Length > 2 ? str[2] : null)); var jsonStr = webr.ReadAsString(); if (webr.StatusCode == System.Net.HttpStatusCode.OK) @@ -658,6 +656,7 @@ namespace UMC.Host case "stop": pipeServer.Write(System.Text.Encoding.UTF8.GetBytes("正在停止Apiumc网关服务。\r\n")); httpMimeServier.IsStop = true; + pipeServer.Disconnect(); httpMimeServier.mre.Set(); return; default: diff --git a/Proxy/SiteActivity.cs b/Proxy/SiteActivity.cs index d52179c..a7adc33 100644 --- a/Proxy/SiteActivity.cs +++ b/Proxy/SiteActivity.cs @@ -304,41 +304,23 @@ namespace UMC.Proxy.Activities { var from = new Web.UIFormDialog() { Title = "应用设置" }; from.AddText("应用名称", "Caption", site.Caption); - from.AddText("应用主页", "Home", site.Home).NotRequired(); - from.AddText("移动主页", "MobileHome", site.MobileHome).NotRequired(); from.AddText("缓存版本", "Version", site.Version).NotRequired(); - - var userBrowser = site.UserBrowser ?? Entities.UserBrowser.All; - from.AddCheckBox("支持浏览器", "UserBrowser", "All") - .Put("IE", "IE", (userBrowser & UserBrowser.IE) == UserBrowser.IE) - .Put("谷歌", "Chrome", (userBrowser & UserBrowser.Chrome) == UserBrowser.Chrome) - .Put("火狐", "Firefox", (userBrowser & UserBrowser.Firefox) == UserBrowser.Firefox) - .Put("钉钉", "Dingtalk", (userBrowser & UserBrowser.Dingtalk) == UserBrowser.Dingtalk) - .Put("微信", "WeiXin", (userBrowser & UserBrowser.WeiXin) == UserBrowser.WeiXin) - .Put("WebKit", "WebKit", (userBrowser & UserBrowser.WebKit) == UserBrowser.WebKit); - + from.AddCheckBox("", "Setings", "0") + .Put("桌面展示", "IsDesktop", site.IsDesktop == true) + .Put("隐藏应用", "IsModule", site.IsModule == true); + from.AddRadio("打开方式", "OpenModel") + .Put("新窗口", "0", (site.OpenModel ?? 0) == 0) + .Put("当前窗口", "1", site.OpenModel == 1) + .Put("最大化窗口", "2", site.OpenModel == 2) + .Put("快捷方式", "3", site.OpenModel == 3); from.Submit("确认", "Site.Config"); return from; }); - var Home = config["Home"]; - if (String.IsNullOrEmpty(Home) == false) - { - if (Home.StartsWith("https://") == false && Home.StartsWith("http://") == false) - { - if (Home.StartsWith("/") == false || Home.StartsWith("//")) - { - this.Prompt("主页格式不正确,请确认"); - } - } - } - else - { - Home = null; - } + var version = config["Version"]; if (String.IsNullOrEmpty(version) == false) @@ -355,16 +337,27 @@ namespace UMC.Proxy.Activities var confgiSite = new Site { Caption = config["Caption"], - Home = Home, + OpenModel = UMC.Data.Utility.Parse(config["OpenModel"], 0), Version = version, + IsDesktop = false, + IsModule = false, Root = site.Root }; - var userBrowser2 = UserBrowser.All; - foreach (var v in config["UserBrowser"].Split(',')) + + var sDoHtmlType = config["Setings"].Split(','); + foreach (var v in sDoHtmlType) { - userBrowser2 |= UMC.Data.Utility.Parse(v, UserBrowser.All); + switch (v) + { + case "IsDesktop": + confgiSite.IsDesktop = true; + break; + case "IsModule": + confgiSite.IsModule = true; + break; + } } - confgiSite.UserBrowser = userBrowser2; + DataFactory.Instance().Put(confgiSite); this.Context.Send("Site.Config", true); } @@ -399,7 +392,7 @@ namespace UMC.Proxy.Activities this.Prompt("应用安全码", "AppSecret:" + site.AppSecret); break; } - //site.AppSecret + } void Setting(Site site) @@ -407,6 +400,10 @@ namespace UMC.Proxy.Activities var config = this.AsyncDialog("Config", g => { var from = new Web.UIFormDialog() { Title = "应用设置" }; + + from.AddText("应用主页", "Home", site.Home).NotRequired(); + from.AddText("移动主页", "MobileHome", site.MobileHome).NotRequired(); + from.AddRadio("访问许可", "AuthType") .Put("所有人", "All", site.AuthType == WebAuthType.All) .Put("匿名检查", "Check", site.AuthType == WebAuthType.Check) @@ -415,45 +412,82 @@ namespace UMC.Proxy.Activities .Put("用户检查", "UserCheck", site.AuthType == WebAuthType.UserCheck) .Put("管理员", "Admin", site.AuthType == WebAuthType.Admin); - from.AddCheckBox("设置", "Setings", "0") - .Put("桌面展示", "IsDesktop", site.IsDesktop == true) - .Put("隐藏应用", "IsModule", site.IsModule == true) + from.AddCheckBox("", "Setings", "0") + // .Put("桌面展示", "IsDesktop", site.IsDesktop == true) + // .Put("隐藏应用", "IsModule", site.IsModule == true); .Put("开启日志", "IsDebug", site.IsDebug == true) .Put("强化验证", "IsAuth", site.IsAuth == true); + var userBrowser = site.UserBrowser ?? Entities.UserBrowser.All; + from.AddCheckBox("支持浏览器", "UserBrowser", "All") + .Put("IE", "IE", (userBrowser & UserBrowser.IE) == UserBrowser.IE) + .Put("谷歌", "Chrome", (userBrowser & UserBrowser.Chrome) == UserBrowser.Chrome) + .Put("火狐", "Firefox", (userBrowser & UserBrowser.Firefox) == UserBrowser.Firefox) + .Put("钉钉", "Dingtalk", (userBrowser & UserBrowser.Dingtalk) == UserBrowser.Dingtalk) + .Put("微信", "WeiXin", (userBrowser & UserBrowser.WeiXin) == UserBrowser.WeiXin) + .Put("WebKit", "WebKit", (userBrowser & UserBrowser.WebKit) == UserBrowser.WebKit); + + - from.AddRadio("打开方式", "OpenModel") - .Put("新窗口", "0", (site.OpenModel ?? 0) == 0) - .Put("当前窗口", "1", site.OpenModel == 1) - .Put("最大化窗口", "2", site.OpenModel == 2) - .Put("快捷方式", "3", site.OpenModel == 3); from.Submit("确认", "Site.Config"); return from; }); + var Home = config["Home"]; + if (String.IsNullOrEmpty(Home) == false) + { + if (Home.StartsWith("https://") == false && Home.StartsWith("http://") == false) + { + if (Home.StartsWith("/") == false || Home.StartsWith("//")) + { + this.Prompt("主页格式不正确,请确认"); + } + } + } + else + { + Home = null; + } + var MobileHome = config["MobileHome"]; + if (String.IsNullOrEmpty(MobileHome) == false) + { + if (MobileHome.StartsWith("https://") == false && MobileHome.StartsWith("http://") == false) + { + if (MobileHome.StartsWith("/") == false || MobileHome.StartsWith("//")) + { + this.Prompt("主页格式不正确,请确认"); + } + } + } + else + { + MobileHome = null; + } var confgiSite = new Site { + Home = Home, + MobileHome = MobileHome, OpenModel = UMC.Data.Utility.Parse(config["OpenModel"], 0), - IsModule = false, IsDebug = false, - IsDesktop = false, - IsAuth = true, + IsAuth = false, AuthType = UMC.Data.Utility.Parse(config["AuthType"], UMC.Web.WebAuthType.User), Root = site.Root }; + + var userBrowser2 = UserBrowser.All; + foreach (var v in config["UserBrowser"].Split(',')) + { + userBrowser2 |= UMC.Data.Utility.Parse(v, UserBrowser.All); + } + confgiSite.UserBrowser = userBrowser2; + var sDoHtmlType = config["Setings"].Split(','); foreach (var v in sDoHtmlType) { switch (v) { - case "IsDesktop": - confgiSite.IsDesktop = true; - break; - case "IsModule": - confgiSite.IsModule = true; - break; case "IsDebug": confgiSite.IsDebug = true; break; @@ -952,10 +986,11 @@ namespace UMC.Proxy.Activities .AddCell("请求配置", String.IsNullOrEmpty(site.HeaderConf) ? "未设置" : "已设置", new UIClick(new WebMeta(request.Arguments).Put(g, "HeaderConf")).Send(request.Model, request.Command)); ui.NewSection().AddCell("动静分离", String.IsNullOrEmpty(site.StaticConf) ? "未设置" : "已设置", new UIClick(new WebMeta(request.Arguments).Put(g, "StaticConf")).Send(request.Model, request.Command)) .AddCell("日志参数", String.IsNullOrEmpty(site.LogConf) ? "未设置" : "已设置", new UIClick(new WebMeta(request.Arguments).Put(g, "LogConf")).Send(request.Model, request.Command)); - - ui.NewSection().AddCell("桌面授权", "", new UIClick(new WebMeta().Put("Key", site.Root, "Model", "Auth")).Send(this.Context.Request.Model, this.Context.Request.Command)) - .AddCell("应用安全码", new UIClick(new WebMeta(request.Arguments).Put(g, "AppSecret")).Send(request.Model, request.Command)); - + if (IsShow) + { + ui.NewSection().AddCell("桌面授权", "", new UIClick(new WebMeta().Put("Key", site.Root, "Model", "Auth")).Send(this.Context.Request.Model, this.Context.Request.Command)) + .AddCell("应用安全码", new UIClick(new WebMeta(request.Arguments).Put(g, "AppSecret")).Send(request.Model, request.Command)); + } var imageUI = ui.NewSection().AddCell("图片处理", "配置", new UIClick(new WebMeta(request.Arguments).Put(g, "ImagesConf")).Send(request.Model, request.Command)); @@ -1449,7 +1484,7 @@ namespace UMC.Proxy.Activities var config = this.AsyncDialog("Config", g => { var from = new Web.UIFormDialog() { Title = "动静分离" }; - from.AddTextarea("不分离路径", "StaticConf", site.StaticConf).Put("Rows", 10).PlaceHolder("配置不分离的路径").NotRequired(); + from.AddTextarea("分离路径", "StaticConf", site.StaticConf).Put("Rows", 10).PlaceHolder("只有路径,则表示清除默认分离的配置").NotRequired(); from.AddPrompt("默认对文件名为gif、ico、svg、bmp、png、jpg、jpeg、css、less、sass、scss、js、webp、jsx、coffee、ts、ttf、woff、woff2、wasm进行静态分离,分离参数all、user、 one、[num]"); from.Submit("确认", "Site.Config"); diff --git a/Proxy/SiteServerActivity.cs b/Proxy/SiteServerActivity.cs index 69ffbb9..c6ffbd7 100644 --- a/Proxy/SiteServerActivity.cs +++ b/Proxy/SiteServerActivity.cs @@ -203,7 +203,7 @@ namespace UMC.Proxy.Activities } break; - case "Prom": + case "Statement": { if ((request.SendValues?.ContainsKey("limit") ?? false) == false) @@ -213,10 +213,23 @@ namespace UMC.Proxy.Activities .Builder(), true); } - var webr = new Uri(APIProxy.Uri, "/UMC/System/Docs/apiumc?limit=30").WebRequest(); + var webr = new Uri(APIProxy.Uri, "/UMC/System/Docs/apiumc?limit=30").WebRequest(); response.Redirect(JSON.Expression(webr.Get().ReadAsString())); - + + } + break; + case "VIP": + { + this.AsyncDialog("VIP", g => + { + var ui = new UISheetDialog() { Title = "客户升级" }; + ui.Put(new UIClick("Model", "Recharge", "Code", "CName") { Text = "升级为专享会员" }.Send(request.Model, request.Command)) + .Put(new UIClick("BuyAll") { Text = "升级为企业会员" }.Send(request.Model, request.Command)); + return ui; + }); + // response.Redirect(request.Model, request.Command, new WebMeta().Put("Model", "Recharge", "Code", "CName"), true); + } break; case "BuyAll": @@ -393,12 +406,22 @@ namespace UMC.Proxy.Activities var hash = JSON.Deserialize(json); var ui = UISection.Create(new UITitle("SSL/TLS证书")); - ui.AddCell("域名", hash["domain"] as string); + if (hash.ContainsKey("isEnterprise")) + { + ui.AddCell("会员类型", hash["vip"] as string, new UIClick("BuyAll").Send(request.Model, request.Command)); + } + else + { + ui.AddCell("会员类型", hash["vip"] as string, new UIClick("VIP").Send(request.Model, request.Command)); + } + ui.AddCell("免费声明", "去了解更多权益", new UIClick("Statement").Send(request.Model, request.Command));//.Header.Put("text", "公共服务"); + + var lu = ui.NewSection().AddCell("域名", hash["domain"] as string); var strBtn = "从新签发"; if (hash.ContainsKey("order")) { - ui.AddCell("单号", hash["order"] as string); + lu.AddCell("单号", hash["order"] as string); var csr = ui.NewSection(); switch (hash["status"] as string) @@ -411,9 +434,6 @@ namespace UMC.Proxy.Activities break; case "cname": - // strBtn = "域名验证"; - // - // this.Context.Send("Clipboard", new WebMeta().Put("text", cookie), true); csr.AddCell("证书状态", hash["state"] as string); csr.NewSection()//.AddCell("主域名", hash["cname"] as string) .AddCell("记录类型", "CNAME") @@ -468,8 +488,7 @@ namespace UMC.Proxy.Activities } - ui.NewSection().AddCell("自动续签", hash["contract"] as string, new UIClick("Model", "Recharge", "Code", hash["domain"] as string).Send(request.Model, request.Command)) - .AddCell("续签优惠", hash["renewalCount"] as string, new UIClick("Prom").Send(request.Model, request.Command));//.Header.Put("text", "公共服务"); + ui.NewSection().AddCell("自动续签", hash["contract"] as string, new UIClick("Model", "Recharge", "Code", hash["domain"] as string).Send(request.Model, request.Command)); @@ -540,26 +559,30 @@ namespace UMC.Proxy.Activities fm.AddText("域名", "Code", String.Empty); return fm; }); - var ComboValue = UMC.Data.Utility.IntParse(UMC.Web.UIDialog.AsyncDialog(this.Context, "Combo", gg => + var ComboValue = UMC.Web.UIDialog.AsyncDialog(this.Context, "Combo", gg => { var webr = new Uri(APIProxy.Uri, "Transfer").WebRequest(); var ns = new System.Collections.Specialized.NameValueCollection(); var secret = WebResource.Instance().Provider["appSecret"]; UMC.Proxy.Utility.Sign(webr, ns, secret); - var data = JSON.Deserialize(webr.Post(new WebMeta().Put("type", "Cert").Put("code", Code)).ReadAsString()); + var data = JSON.Deserialize(webr.Post(new WebMeta().Put("type", "Cert").Put("code", Code)).ReadAsString()); request.Arguments["API"] = data["src"] as string; - var Combo = data[gg] as Array; + var Combo = data.GetDictionary()[gg] as Array; - var fom = new Web.UIFormDialog() { Title = "订阅" }; + var fom = new Web.UIFormDialog() { Title = data["Title"] ?? "订阅" }; var style = new UIStyle(); style.Name("icon").Color(0x09bb07).Size(84).Font("wdk"); style.Name("title").Color(0x333).Size(20); style.BgColor(0xfafcff).Height(200).AlignCenter(); - var desc = new UMC.Web.WebMeta().Put("title", "证书自动续签服务").Put("icon", "\uf0ee"); + var desc = new UMC.Web.WebMeta().Put("title", data["Desc"] ?? "证书自动续签服务").Put("icon", data["Icon"] ?? "\uf0ee"); fom.Config.Put("Header", new UIHeader().Desc(desc, "{icon}\n{title}", style)); - fom.AddTextValue().Put("订阅域名", data["Text"] as string ?? Code); + + if (data.ContainsKey("Text")) + { + fom.AddTextValue().Put("订阅域名", data["Text"] as string ?? Code); + } var f = fom.AddRadio("订阅套餐", "Combo"); var cl = Combo.Length; for (var i = 0; i < cl; i++) @@ -571,12 +594,10 @@ namespace UMC.Proxy.Activities fom.Submit("确认订阅"); return fom; - }), 0); + }); var src = this.AsyncDialog("API", r => { - var appId = WebResource.Instance().Provider["appId"]; - return this.DialogValue($"https://api.apiumc.com/UMC/Platform/Alipay/Cert?AuthKey={appId}"); - + this.Prompt("支付参数不正确,请联系官方"); }); response.Redirect(new Uri($"{src}&Combo={ComboValue}&Code={Code}")); } diff --git a/UMC.Host.csproj b/UMC.Host.csproj index 8aa16c1..b77e88a 100644 --- a/UMC.Host.csproj +++ b/UMC.Host.csproj @@ -42,8 +42,8 @@ - - + +