FTP文件写入

main
吴顺明 9 months ago
parent 0729d7a288
commit 8011f2f1fb

@ -348,14 +348,13 @@ namespace UMC.ITME
} }
public static void Check() public static void Check()
{ {
var now = Utility.TimeSpan();
var ls = System.Buffers.ArrayPool<byte>.Shared.Rent(9); var ls = System.Buffers.ArrayPool<byte>.Shared.Rent(9);
try try
{ {
var vs = _bridgeClients.Values.ToArray(); var vs = _bridgeClients.Values.ToArray();
foreach (var b in vs) foreach (var b in vs)
{ {
b.Write(0, ls, 9, 0); b.Write(0, ls, 9, 0);
} }

@ -499,6 +499,7 @@ class SiteSSHActivities : Web.WebActivity
using (var sftp = new SftpClient(new PasswordConnectionInfo(device.Ip, device.Port ?? 22, device.Username, password))) using (var sftp = new SftpClient(new PasswordConnectionInfo(device.Ip, device.Port ?? 22, device.Username, password)))
{ {
sftp.Connect(); sftp.Connect();
var Content = this.AsyncDialog("Content", r => var Content = this.AsyncDialog("Content", r =>
{ {
String s = String.Empty; String s = String.Empty;
@ -514,9 +515,10 @@ class SiteSSHActivities : Web.WebActivity
response.Redirect(new WebMeta().Put("Content", s).Put("title", Path)); response.Redirect(new WebMeta().Put("Content", s).Put("title", Path));
}); });
sftp.DeleteFile(Path);
sftp.WriteAllText(Path, Content); sftp.WriteAllText(Path, Content);
SSHLog(device, this.Context.Token.Username, $"upload {Path}"); SSHLog(device, this.Context.Token.Username, $"write {Path}");
} }
} }
break; break;

@ -15,7 +15,7 @@ using UMC.Data;
namespace UMC.ITME.Activities namespace UMC.ITME.Activities
{ {
/// <summary> /// <summary>
/// 邮箱账户 /// 应用安装
/// </summary> /// </summary>
[UMC.Web.Apiumc("ITME", "Setup", Auth = WebAuthType.Admin)] [UMC.Web.Apiumc("ITME", "Setup", Auth = WebAuthType.Admin)]
class SiteSetupActivity : WebActivity class SiteSetupActivity : WebActivity
@ -84,7 +84,7 @@ namespace UMC.ITME.Activities
} }
from.Title = "开发者发布"; from.Title = "开发者发布";
from.Add(UICell.Create("QRCode", new WebMeta().Put("value", $"https://api.apiumc.com/UMC/Platform/EditCert/{appId}"))); from.Add(UICell.QRCode($"https://api.apiumc.com/UMC/Platform/EditCert/{appId}"));
from.AddConfirm("请开发者用ITME App扫一扫生成开发者证书再点击下一步", "Settings", "YES"); from.AddConfirm("请开发者用ITME App扫一扫生成开发者证书再点击下一步", "Settings", "YES");
from.Submit("下一步", $"{request.Model}.{request.Command}"); from.Submit("下一步", $"{request.Model}.{request.Command}");
@ -102,7 +102,7 @@ namespace UMC.ITME.Activities
{ {
request.Arguments.Put("ConfKey", "Proxy"); request.Arguments.Put("ConfKey", "Proxy");
goto case "UMC"; goto case "UMC";
} }
if (data.ContainsKey("success")) if (data.ContainsKey("success"))
{ {
@ -143,7 +143,7 @@ namespace UMC.ITME.Activities
{ {
request.Arguments.Put("ConfKey", "Proxy"); request.Arguments.Put("ConfKey", "Proxy");
goto case "UMC"; goto case "UMC";
} }
// break; // break;
} }
@ -227,7 +227,7 @@ namespace UMC.ITME.Activities
Domain = new Uri(orgDomain, "/").AbsoluteUri;// Domain = new Uri(orgDomain, "/").AbsoluteUri;//
this.Context.Request.Arguments.Put("ConfKey", "UMC"); this.Context.Request.Arguments.Put("ConfKey", "UMC");
this.Context.Request.Arguments.Put("Domain", Domain); this.Context.Request.Arguments.Put("Domain", Domain);
var str = new Uri(orgDomain, "/UMC.Conf").WebRequest().Put(new WebMeta().Put("domain", $"{Web.WebResource.Instance().WebDomain()}")).ReadAsString(); var str = new Uri(orgDomain, "/UMC/Conf").WebRequest().Put(new WebMeta().Put("domain", $"{Web.WebResource.Instance().WebDomain()}")).ReadAsString();
var data = JSON.Deserialize<System.Collections.Hashtable>(str); var data = JSON.Deserialize<System.Collections.Hashtable>(str);
if (data?.ContainsKey("appConf") == true) if (data?.ContainsKey("appConf") == true)
{ {
@ -237,6 +237,14 @@ namespace UMC.ITME.Activities
this.Context.Request.Arguments.Put("IconSrc", appConf["IconSrc"]); this.Context.Request.Arguments.Put("IconSrc", appConf["IconSrc"]);
config.Put("IconSrc", appConf["IconSrc"]); config.Put("IconSrc", appConf["IconSrc"]);
} }
if (appConf.ContainsKey("MarketKey"))
{
site.AuthConf = "#";
site.UserModel = UserModel.Bridge;
site.AuthType = WebAuthType.Guest;
ConfKey = appConf["MarketKey"] as string;
}
if (appConf.ContainsKey("Open")) if (appConf.ContainsKey("Open"))
{ {
@ -257,7 +265,7 @@ namespace UMC.ITME.Activities
{ {
this.Context.Request.Arguments.Put("Mobile", appConf["Mobile"]); this.Context.Request.Arguments.Put("Mobile", appConf["Mobile"]);
config.Put("Mobile", appConf["Mobile"]); config.Put("Mobile", appConf["Mobile"]);
} }
} }

@ -40,6 +40,8 @@ namespace UMC.ITME
SiteConfig site; SiteConfig site;
public override void ProcessActivity(WebRequest request, WebResponse response) public override void ProcessActivity(WebRequest request, WebResponse response)
{ {
var user = this.Context.Token.Identity(); var user = this.Context.Token.Identity();
var httpProxy = new HttpProxy(site, this.Context.Client.Context, -1, "/", String.Empty); var httpProxy = new HttpProxy(site, this.Context.Client.Context, -1, "/", String.Empty);
if (httpProxy.Domain == null) if (httpProxy.Domain == null)
@ -347,7 +349,20 @@ namespace UMC.ITME
{ {
var site = DataFactory.Instance().SiteConfig(p.Attributes["root"]); var site = DataFactory.Instance().SiteConfig(p.Attributes["root"]);
if (site != null) if (site != null)
{
if (site.IsClose)
{
if (site.Site.Flag < 0 || site.Domains.Length == 0 || String.IsNullOrEmpty(site.Site.MarketKey))
{
return WebActivity.Empty;
}
else
{
this.Prompt("许可证已过期", $"{site.Site}的许可证已经过期,请联系管理员更新许可证");
}
}
return new XHRActivity(site); return new XHRActivity(site);
}
} }
} }

@ -31,8 +31,7 @@
<div id="app"> <div id="app">
<div class="sidebar-container"> <div class="sidebar-container">
<div class="sidebar-logo-container"> <div class="sidebar-logo-container">
<a model="Account" cmd="Self" class="box-card-component" data-name="">
<a model="Account" cmd="Self" send="Cashier" class="box-card-component" data-name="">
<img alt="" class="pan-thumb" /> <img alt="" class="pan-thumb" />
</a><div class="umc-logo-name"></div> </a><div class="umc-logo-name"></div>
</div> </div>

Loading…
Cancel
Save