ntminer 4 年之前
父节点
当前提交
f55d5f1d84

+ 1 - 0
src/AppModels/AppModels.csproj

@@ -116,6 +116,7 @@
     <Compile Include="MinerStudio\Vms\LocalIpConfigViewModel.cs" />
     <Compile Include="MinerStudio\Vms\NTMinerFileSelectViewModel.cs" />
     <Compile Include="MinerStudio\Vms\NTMinerFileViewModel.cs" />
+    <Compile Include="MinerStudio\Vms\QQGroupQrCodeViewModel.cs" />
     <Compile Include="MinerStudio\Vms\VirtualMemoryViewModel.cs" />
     <Compile Include="MinerStudio\Vms\WebApiServerStateViewModel.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

+ 1 - 1
src/AppModels/AppRoot.cs

@@ -91,7 +91,7 @@ namespace NTMiner {
 
         public static string NppPackageUrl {
             get {
-                const string url = "https://minerjson.oss-cn-beijing.aliyuncs.com/npp.zip";
+                string url = $"https://minerjson.{NTKeyword.CloudFileDomain}/npp.zip";
                 if (WpfUtil.IsInDesignMode) {
                     return url;
                 }

+ 1 - 1
src/AppModels/AppStatic.cs

@@ -823,7 +823,7 @@ namespace NTMiner {
         });
 
         public static ICommand OpenLGPL { get; private set; } = new DelegateCommand(() => {
-            string url = "https://minerjson.oss-cn-beijing.aliyuncs.com/LGPL.png";
+            string url = $"https://minerjson.{NTKeyword.CloudFileDomain}/LGPL.png";
             url = NTMinerContext.Instance.ServerContext.SysDicItemSet.TryGetDicItemValue(NTKeyword.ThisSystemSysDicCode, "LGPL", url);
             VirtualRoot.Execute(new UnTopmostCommand());
             Process.Start(url);

+ 13 - 0
src/AppModels/MinerStudio/Vms/QQGroupQrCodeViewModel.cs

@@ -0,0 +1,13 @@
+using NTMiner.Vms;
+
+namespace NTMiner.MinerStudio.Vms {
+    public class QQGroupQrCodeViewModel : ViewModelBase {
+        public QQGroupQrCodeViewModel() { }
+
+        public string QQGroupQrCodeUrl {
+            get {
+                return $"https://minerjson.{NTKeyword.CloudFileDomain}/NTMiner_QQGroupQrCode.png";
+            }
+        }
+    }
+}

+ 1 - 1
src/AppModels/Vms/CoinViewModel.cs

@@ -412,7 +412,7 @@ namespace NTMiner.Vms {
                         File.Delete(iconFileFullName);
                     }
                 };
-                webClient.DownloadFileAsync(new Uri($"{Services.OfficialServices.MinerJsonBucket}coin_icons/{this.Icon}"), iconFileFullName);
+                webClient.DownloadFileAsync(new Uri($"https://minerjson.{NTKeyword.CloudFileDomain}/coin_icons/{this.Icon}"), iconFileFullName);
             }
         }
 

+ 4 - 0
src/AppViews0/AppViews0.csproj

@@ -408,6 +408,10 @@
     <Compile Include="Views\Ucs\CoinPage.xaml.cs">
       <DependentUpon>CoinPage.xaml</DependentUpon>
     </Compile>
+    <Page Include="MinerStudio\Views\Design\QQGroupQrCodeViewModel.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="MinerStudio\Views\Design\ActionCountsViewModel.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 2 - 0
src/AppViews0/MinerStudio/Views/Design/QQGroupQrCodeViewModel.xaml

@@ -0,0 +1,2 @@
+<vm:QQGroupQrCodeViewModel xmlns:vm="clr-namespace:NTMiner.MinerStudio.Vms;assembly=AppModels">
+</vm:QQGroupQrCodeViewModel>

+ 2 - 1
src/AppViews0/MinerStudio/Views/Ucs/QQGroupQrCode.xaml

@@ -6,8 +6,9 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:sys="clr-namespace:System;assembly=mscorlib"
     xmlns:vm="clr-namespace:NTMiner.MinerStudio.Vms;assembly=AppModels"
+    d:DataContext="{d:DesignData Source=../Design/QQGroupQrCodeViewModel.xaml}"
     mc:Ignorable="d" d:DesignHeight="320" d:DesignWidth="280">
     <Grid>
-        <Image Source="https://minerjson.oss-cn-beijing.aliyuncs.com/NTMiner_QQGroupQrCode.png"></Image>
+        <Image Source="{Binding QQGroupQrCodeUrl}"></Image>
     </Grid>
 </UserControl>

+ 9 - 1
src/AppViews0/MinerStudio/Views/Ucs/QQGroupQrCode.xaml.cs

@@ -1,4 +1,5 @@
-using NTMiner.Views;
+using NTMiner.MinerStudio.Vms;
+using NTMiner.Views;
 using NTMiner.Vms;
 using System.Windows.Controls;
 
@@ -15,7 +16,14 @@ namespace NTMiner.MinerStudio.Views.Ucs {
             }, ucFactory: (window) => new QQGroupQrCode(), fixedSize: true);
         }
 
+        public QQGroupQrCodeViewModel Vm { get; private set; }
+
         public QQGroupQrCode() {
+            if (WpfUtil.IsInDesignMode) {
+                return;
+            }
+            this.Vm = new QQGroupQrCodeViewModel();
+            this.DataContext = this.Vm;
             InitializeComponent();
         }
     }

+ 2 - 0
src/NTMinerDataSchemas/NTKeyword.cs

@@ -19,6 +19,8 @@ namespace NTMiner {
         public const string Copyright = "Copyright ©  NTMiner";
         public const string Company = "开源矿工 https://github.com/ntminer/NtMiner";
 
+        public const string CloudFileDomain = "oss-cn-beijing.aliyuncs.com";
+
         public const string TempDirName = "NTMiner";
         public const string RootLockFileName = "home.lock";
         public const string RootConfigFileName = "home.config";

+ 1 - 1
src/NTMinerRpcClient/Services/OSS/AliyunOSSService.cs

@@ -9,7 +9,7 @@ namespace NTMiner.Services.OSS {
         internal AliyunOSSService() { }
 
         public void GetAliyunServerJson(Action<byte[]> callback) {
-            string serverJsonFileUrl = $"{OfficialServices.MinerJsonBucket}{HomePath.ExportServerJsonFileName}";
+            string serverJsonFileUrl = $"https://minerjson.{NTKeyword.CloudFileDomain}/{HomePath.ExportServerJsonFileName}";
             string fileUrl = serverJsonFileUrl + "?t=" + DateTime.Now.Ticks;
             Task.Factory.StartNew(() => {
                 try {

+ 0 - 2
src/NTMinerRpcClient/Services/OfficialServices.cs

@@ -2,8 +2,6 @@
     using Official;
 
     public class OfficialServices {
-        public const string MinerJsonBucket = "https://minerjson.oss-cn-beijing.aliyuncs.com/";
-
         public readonly WsServerNodeService WsServerNodeService = new WsServerNodeService();
         public readonly WebApiServerNodeService WebApiServerNodeService = new WebApiServerNodeService();
         public readonly FileUrlService FileUrlService = new FileUrlService();

+ 1 - 1
src/UnitTests/OSSTests.cs

@@ -9,7 +9,7 @@ namespace NTMiner {
     public class OSSTests {
         [TestMethod]
         public void AliGeneratePresignedUriTest() {
-            string ossEndpoint = "oss-cn-beijing.aliyuncs.com";
+            string ossEndpoint = NTKeyword.CloudFileDomain;
             string ossAccessKeyId = "ATAI4G7BGjsCjRF2ThyDdgBo";// 假的
             string ossAccessKeySecret = "A1VdRfHJ6k8NeklCtHjQlt7MYlRShE";// 假的
             var ossClient= new OssClient(ossEndpoint, ossAccessKeyId, ossAccessKeySecret);

+ 1 - 1
src/UnitTests/UnitTest1.cs

@@ -69,7 +69,7 @@ namespace NTMiner {
 
         [TestMethod]
         public void UriPathTest() {
-            string url = "http://ntminer.oss-cn-beijing.aliyuncs.com/NTMinerUpdater.exe?Expires=1583773008";
+            string url = $"http://ntminer.{NTKeyword.CloudFileDomain}/NTMinerUpdater.exe?Expires=1583773008";
             Uri uri = new Uri(url);
             Assert.AreEqual("/NTMinerUpdater.exe", uri.LocalPath);
             Assert.AreEqual("NTMinerUpdater.exe", Path.GetFileName(uri.LocalPath));