diff --git a/MarketDataServer/MarketDataServer.sln b/MarketDataServer/MarketDataServer.sln new file mode 100644 index 0000000..e8efa87 --- /dev/null +++ b/MarketDataServer/MarketDataServer.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.2.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarketDataServer", "MarketDataServer.csproj", "{95632102-7AD8-9B9D-1583-0C986A476083}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95632102-7AD8-9B9D-1583-0C986A476083}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95632102-7AD8-9B9D-1583-0C986A476083}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95632102-7AD8-9B9D-1583-0C986A476083}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95632102-7AD8-9B9D-1583-0C986A476083}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {216F126F-209B-4547-90B2-17250197CD7D} + EndGlobalSection +EndGlobal diff --git a/MarketDataServer/Program.cs b/MarketDataServer/Program.cs index dfb9285..94bded3 100755 --- a/MarketDataServer/Program.cs +++ b/MarketDataServer/Program.cs @@ -40,7 +40,17 @@ namespace MarketDataServer config.ResolveConflictingActions (apiDescriptions => apiDescriptions.First ()); }); + builder.Services.AddCors(options => + { + options.AddPolicy("corsPolicy", + builder => + { + builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod().SetIsOriginAllowedToAllowWildcardSubdomains(); + }); + }); + WebApplication webApplication = builder.Build(); + webApplication.UseCors("corsPolicy"); // Configure the HTTP request pipeline. if (webApplication.Environment.IsDevelopment()||webApplication.Environment.IsProduction() ) diff --git a/README.md b/README.md index 156d14c..12a36f0 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Restart=always RestartSec=5 # Seconds to wait before restarting (optional) KillMode=process # Ensures the service is killed gracefully Environment=DOTNET_ROOT=/opt/dotnet +StandardOutput=null [Install] WantedBy=multi-user.target diff --git a/eNavigator/Notes/notes.txt b/eNavigator/Notes/notes.txt index b75ad92..228c35c 100755 --- a/eNavigator/Notes/notes.txt +++ b/eNavigator/Notes/notes.txt @@ -1,5 +1,8 @@ + + **************** PUBLISHING +pi@Dia:~/ARM64/eNavigator $ dotnet publish -c Release dotnet publish -c Release I might not understand this all correctly but I got it to work. when you dotnet publish -c Release @@ -7,18 +10,19 @@ There will be output here.. /home/pi/Projects/Blazor/eNavigator/eNavigatorUI/bin/Release/net8.0 There is a publish folder as well as a wwroot folder open the publish folder and then the wwroot folder within -copy the contents of this folder to /var/www/html on the apache server +copy the contents of this (wwroot) folder to /var/www/html on the apache server +sudo cp -r --verbose /home/pi/Media/Boneyard/publish/wwwroot/* . +sudo cp --verbose -r /home/pi/Media/Boneyard/wwwroot/_framework . + now look at the wwwroot folder and notice that there is also a _framework folder here as well -copy this _framework folder to /var/www/html (yes overwriting the previous _framework that you coped) +copy this _framework folder to /var/www/html (yes overwriting the previous _framework that you copied) + restart the apache web server -service apache2 restart +sudo service apache2 restart goto web site http://www.diversified-software.com all should be working. - - - ************************** diff --git a/eNavigator/eNavigatorUI/Interfaces/IMarketDataServiceClient.cs b/eNavigator/eNavigatorUI/Interfaces/IMarketDataServiceClient.cs index eb2ee37..c64c50e 100644 --- a/eNavigator/eNavigatorUI/Interfaces/IMarketDataServiceClient.cs +++ b/eNavigator/eNavigatorUI/Interfaces/IMarketDataServiceClient.cs @@ -5,6 +5,7 @@ namespace eNavigator.Interfaces public interface IMarketDataServiceClient { public Task Ping(); + public Task GetSystemInfo(); public Task Login(String user, String password); public Task IsAuthorized(); public Task GetDistinctConsumerPriceIndices(); diff --git a/eNavigator/eNavigatorUI/Service/MarketDataServiceClient.cs b/eNavigator/eNavigatorUI/Service/MarketDataServiceClient.cs index 39687e1..33cb3d1 100755 --- a/eNavigator/eNavigatorUI/Service/MarketDataServiceClient.cs +++ b/eNavigator/eNavigatorUI/Service/MarketDataServiceClient.cs @@ -61,6 +61,25 @@ namespace eNavigator.Service } } + public async Task GetSystemInfo() + { + try + { + StringBuilder sb = new StringBuilder(); + sb.Append("/api/Ping/GetSystemInfo"); + String json = await httpClient.GetStringAsync(sb.ToString()); + json=ToConformimgJson(json); + String accessToken = JsonConvert.DeserializeObject(json); + return new ServiceResult(accessToken); + } + catch (Exception exception) + { + exceptions.Add(exception); + Console.WriteLine(exception.ToString()); + return new ServiceResult(false,exception.ToString()); + } + } + public async Task Login(String user, String password) { try @@ -73,6 +92,7 @@ namespace eNavigator.Service sb.Append("&password=").Append(password); Console.WriteLine(httpClient.BaseAddress+sb.ToString()); String json = await httpClient.GetStringAsync(sb.ToString()); + json=ToConformimgJson(json); AccessToken = JsonConvert.DeserializeObject(json); if(default == AccessToken)return new ServiceResult(false); return new ServiceResult(AccessToken){ElapsedTimeMS=profiler.End()}; @@ -502,5 +522,13 @@ namespace eNavigator.Service return new ServiceResult(false,exception.ToString()); } } + private static String ToConformimgJson(String json) + { + if(String.IsNullOrEmpty(json))return json; + if(json.StartsWith("\"") && json.EndsWith("\""))return json; + if(json.StartsWith("[") && json.EndsWith("]"))return json; + if(json.StartsWith("{") && json.EndsWith("}"))return json; + return Utility.AddQuotes(json); + } } } diff --git a/eNavigator/eNavigatorUI/eNavigatorUI.sln b/eNavigator/eNavigatorUI/eNavigatorUI.sln new file mode 100644 index 0000000..5f9b93f --- /dev/null +++ b/eNavigator/eNavigatorUI/eNavigatorUI.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.2.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eNavigator", "eNavigator.csproj", "{761D4A8A-CC84-EDB8-3B37-A4566C635D5D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {761D4A8A-CC84-EDB8-3B37-A4566C635D5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {761D4A8A-CC84-EDB8-3B37-A4566C635D5D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {761D4A8A-CC84-EDB8-3B37-A4566C635D5D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {761D4A8A-CC84-EDB8-3B37-A4566C635D5D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {20BF51CE-862A-47B3-981B-AA43CAC69A1B} + EndGlobalSection +EndGlobal