diff --git a/Squirrowse.Client/Program.cs b/Squirrowse.Client/Program.cs index 2498c3d..ee56a67 100644 --- a/Squirrowse.Client/Program.cs +++ b/Squirrowse.Client/Program.cs @@ -1,10 +1,8 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Squirrowse.Client.Service; - -namespace Squirrowse.Client +namespace squirrowse.client { - public class Program + class Program { public static void Main(string[] args) { @@ -17,11 +15,13 @@ namespace Squirrowse.Client .ConfigureServices((hostContext, services) => { services.AddHostedService(); - services.AddSingleton(x=> new ConnectionManager("http://localhost", 44366)); //keep as transient for now - services.AddSingleton< ICameraService, CameraService >(x=>new CameraService(new Camera())); - services.AddTransient(); + services.AddSingleton(x => + new ConnectionManager("http://squirrowse.azurewebsites.net", 80)); //keep as transient for now + + // new ConnectionManager("http://192.168.0.13", 5000)); //keep as transient for now }); } + } -} \ No newline at end of file +} diff --git a/Squirrowse.Client/Squirrowse.Client.csproj b/Squirrowse.Client/Squirrowse.Client.csproj index d909f40..677cb2a 100644 --- a/Squirrowse.Client/Squirrowse.Client.csproj +++ b/Squirrowse.Client/Squirrowse.Client.csproj @@ -1,24 +1,17 @@ - + - netcoreapp3.0 - dotnet-Squirrowse.Client-D6805387-040A-46DF-9DAE-926B46C981A6 + Exe + netcoreapp3.1 - - - - + + + + + + - - - - - - - Always - - - \ No newline at end of file + diff --git a/Squirrowse.Client/Worker.cs b/Squirrowse.Client/Worker.cs index 77420ee..d236911 100644 --- a/Squirrowse.Client/Worker.cs +++ b/Squirrowse.Client/Worker.cs @@ -1,42 +1,36 @@ -using System; +using System; +using System.Collections.Generic; +using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR.Client; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using Squirrowse.Client.Service; -using Squirrowse.Core.Models; -using Squirrowse.Core.Services; -namespace Squirrowse.Client +namespace squirrowse.client { public class Worker : IHostedService { - private readonly IConnectionManager _connectionManager; private readonly ILogger logger; - private readonly IActionDispatcher _actionDispatcher; - public Worker(ILogger logger, IConnectionManager connectionManager,IActionDispatcher act) + private readonly IConnectionManager _connectionManager; + private Connection con =new Connection(); + public Worker(ILogger logger, IConnectionManager connectionManager) { this.logger = logger; _connectionManager = connectionManager; - _actionDispatcher = act; + } public async Task StartAsync(CancellationToken cancellationToken) { - while (true) + await _connectionManager.InitConnection(); + + //var d = _connectionManager.GetConnection(); + if (_connectionManager.IsConnected()) { - try - { - await _connectionManager.InitConnection(ConnectionType.Client); - - } - catch - { - await Task.Delay(1111); - } + var d =await _connectionManager.GetConnection(); + await d.SendAsync("UploadStream", con.clientStreamData()); } - // await Task.Delay(10000);//for debug - } public async Task StopAsync(CancellationToken cancellationToken) @@ -44,4 +38,4 @@ namespace Squirrowse.Client await _connectionManager.Disconnect(); } } -} \ No newline at end of file +} diff --git a/Squirrowse.Core/Squirrowse.Core.csproj b/Squirrowse.Core/Squirrowse.Core.csproj index c5e93a9..d826af5 100644 --- a/Squirrowse.Core/Squirrowse.Core.csproj +++ b/Squirrowse.Core/Squirrowse.Core.csproj @@ -1,13 +1,17 @@  - netcoreapp3.0 + netstandard2.0 + - - - - - + + + + + + + + \ No newline at end of file diff --git a/Squirrowse.Web/App.razor b/Squirrowse.Web/App.razor index c0dff01..4d637a8 100644 --- a/Squirrowse.Web/App.razor +++ b/Squirrowse.Web/App.razor @@ -1,4 +1,4 @@ - + diff --git a/Squirrowse.Web/Pages/Index.razor b/Squirrowse.Web/Pages/Index.razor index 73d0d8b..19db2ea 100644 --- a/Squirrowse.Web/Pages/Index.razor +++ b/Squirrowse.Web/Pages/Index.razor @@ -2,4 +2,4 @@

Hello, world!

-Welcome to your new app. \ No newline at end of file +Welcome to aws. \ No newline at end of file diff --git a/Squirrowse.Web/Pages/_Host.cshtml b/Squirrowse.Web/Pages/_Host.cshtml index c1dd224..8409015 100644 --- a/Squirrowse.Web/Pages/_Host.cshtml +++ b/Squirrowse.Web/Pages/_Host.cshtml @@ -1,22 +1,179 @@ @page "/" -@namespace Squirrowse.Web.Pages +@namespace squirrowse.web.Pages @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@{ + Layout = null; +} + - Squirrowse.Web + squirrowse.web + + + - @(await Html.RenderComponentAsync(RenderMode.ServerPrerendered)) + +
+ + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + Reload + 🗙 +
+ + + \ No newline at end of file diff --git a/Squirrowse.Web/Program.cs b/Squirrowse.Web/Program.cs index 950d8dd..db9cdd7 100644 --- a/Squirrowse.Web/Program.cs +++ b/Squirrowse.Web/Program.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; -namespace Squirrowse.Web +namespace squirrowse.web { public class Program { @@ -13,7 +13,7 @@ namespace Squirrowse.Web public static IHostBuilder CreateHostBuilder(string[] args) { return Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); + .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup().UseUrls("http://0.0.0.0:5000"); }); } } -} \ No newline at end of file +} diff --git a/Squirrowse.Web/Properties/launchSettings.json b/Squirrowse.Web/Properties/launchSettings.json index f31c9a9..2d12a77 100644 --- a/Squirrowse.Web/Properties/launchSettings.json +++ b/Squirrowse.Web/Properties/launchSettings.json @@ -3,8 +3,8 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:56422", - "sslPort": 44381 + "applicationUrl": "http://192.168.0.13:8000", + "sslPort": 443 } }, "profiles": { @@ -15,13 +15,21 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "Squirrowse.Web": { + "squirrowse.web": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "https://localhost:5003;http://localhost:5002", + "useSSL": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://192.168.0.13:8000" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "publishAllPorts": true, + "useSSL": true } } } \ No newline at end of file diff --git a/Squirrowse.Web/Shared/MainLayout.razor b/Squirrowse.Web/Shared/MainLayout.razor index 5029de9..d5a56e2 100644 --- a/Squirrowse.Web/Shared/MainLayout.razor +++ b/Squirrowse.Web/Shared/MainLayout.razor @@ -6,7 +6,7 @@
- About + About
diff --git a/Squirrowse.Web/Shared/NavMenu.razor b/Squirrowse.Web/Shared/NavMenu.razor index d652aa5..26c3df0 100644 --- a/Squirrowse.Web/Shared/NavMenu.razor +++ b/Squirrowse.Web/Shared/NavMenu.razor @@ -1,33 +1,38 @@  + + +
-
- -
+
+ +
- @code { - bool collapseNavMenu = true; +@code { + private bool collapseNavMenu = true; - string NavMenuCssClass => collapseNavMenu ? "collapse" : null; + private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; - void ToggleNavMenu() - { - collapseNavMenu = !collapseNavMenu; - } + private void ToggleNavMenu() + { + collapseNavMenu = !collapseNavMenu; + } - } \ No newline at end of file +} \ No newline at end of file diff --git a/Squirrowse.Web/Squirrowse.Web.csproj b/Squirrowse.Web/Squirrowse.Web.csproj index 826d236..815b50a 100644 --- a/Squirrowse.Web/Squirrowse.Web.csproj +++ b/Squirrowse.Web/Squirrowse.Web.csproj @@ -1,22 +1,44 @@  - netcoreapp3.0 - Squirrowse.Web.Program + netcoreapp3.1 + e06d99cb-4df6-41f0-8639-cd34df940830 + Linux - + + + + + + + + + - + + + + + + Always - + + + Always + + + Always + - - - + + + + + - + \ No newline at end of file diff --git a/Squirrowse.Web/Startup.cs b/Squirrowse.Web/Startup.cs index 4884482..9347b86 100644 --- a/Squirrowse.Web/Startup.cs +++ b/Squirrowse.Web/Startup.cs @@ -1,11 +1,15 @@ +using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Squirrowse.Core; +using squirrowse.db; +using squirrowse.web.Cognitive; +using squirrowse.web.Data; -namespace Squirrowse.Web +namespace squirrowse.web { public class Startup { @@ -21,10 +25,20 @@ namespace Squirrowse.Web public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); + services.AddServerSideBlazor().AddHubOptions(x => + { + x.EnableDetailedErrors = true; + x.MaximumReceiveMessageSize = short.MaxValue; + }); - services.AddServerSideBlazor().AddHubOptions(x => x.MaximumReceiveMessageSize = 102400000); - services.AddCoreModule(); - services.AddSignalR().AddMessagePackProtocol(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSignalR(x => x.MaximumReceiveMessageSize = ((int)(int.MaxValue / 2))).AddMessagePackProtocol(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -41,15 +55,16 @@ namespace Squirrowse.Web app.UseHsts(); } + app.UsePathBase(new PathString("/extra")); app.UseHttpsRedirection(); app.UseStaticFiles(); - app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host"); + endpoints.MapHub("hub"); }); } } diff --git a/Squirrowse.Web/_Imports.razor b/Squirrowse.Web/_Imports.razor index f216765..c24d5c2 100644 --- a/Squirrowse.Web/_Imports.razor +++ b/Squirrowse.Web/_Imports.razor @@ -5,5 +5,5 @@ @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web @using Microsoft.JSInterop -@using Squirrowse.Web -@using Squirrowse.Web.Shared \ No newline at end of file +@using squirrowse.web +@using squirrowse.web.Shared \ No newline at end of file diff --git a/Squirrowse.Web/appsettings.Development.json b/Squirrowse.Web/appsettings.Development.json index f999bc2..5a3cede 100644 --- a/Squirrowse.Web/appsettings.Development.json +++ b/Squirrowse.Web/appsettings.Development.json @@ -1,9 +1,10 @@ { + "DetailedErrors": true, "Logging": { "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" } } } \ No newline at end of file diff --git a/Squirrowse.Web/wwwroot/css/site.css b/Squirrowse.Web/wwwroot/css/site.css index 253bf47..afe27d2 100644 --- a/Squirrowse.Web/wwwroot/css/site.css +++ b/Squirrowse.Web/wwwroot/css/site.css @@ -30,7 +30,15 @@ app { justify-content: flex-end; } -.main .top-row > a { margin-left: 1.5rem; } +.main .top-row > a, .main .top-row .btn-link { + margin-left: 1.5rem; + white-space: nowrap; +} + +.main .top-row a:first-child { + overflow: hidden; + text-overflow: ellipsis; +} .sidebar { background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); } @@ -45,16 +53,16 @@ app { width: 2rem; } -.nav-item { +.sidebar .nav-item { font-size: 0.9rem; padding-bottom: 0.5rem; } -.nav-item:first-of-type { padding-top: 1rem; } +.sidebar .nav-item:first-of-type { padding-top: 1rem; } -.nav-item:last-of-type { padding-bottom: 1rem; } +.sidebar .nav-item:last-of-type { padding-bottom: 1rem; } -.nav-item a { +.sidebar .nav-item a { align-items: center; border-radius: 4px; color: #d7d7d7; @@ -63,12 +71,12 @@ app { line-height: 3rem; } -.nav-item a.active { +.sidebar .nav-item a.active { background-color: rgba(255, 255, 255, 0.25); color: white; } -.nav-item a:hover { +.sidebar .nav-item a:hover { background-color: rgba(255, 255, 255, 0.1); color: white; } @@ -83,8 +91,31 @@ app { .validation-message { color: red; } +#blazor-error-ui { + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + +#blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 0.75rem; + top: 0.5rem; +} + @media (max-width: 767.98px) { - .main .top-row { display: none; } + .main .top-row:not(.auth) { display: none; } + + .main .top-row.auth { justify-content: space-between; } + + .main .top-row a, .main .top-row .btn-link { margin-left: 0; } } @media (min-width: 768px) { diff --git a/Squirrowse.sln b/Squirrowse.sln index a5f8c94..65ccb28 100644 --- a/Squirrowse.sln +++ b/Squirrowse.sln @@ -1,22 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 -VisualStudioVersion = 16.0.29411.108 +VisualStudioVersion = 16.0.29806.167 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrowse.Service", "Squirrowse.Service\Squirrowse.Service.csproj", "{8C085621-BAAA-4E96-B027-561BC18751EE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "squirrowse.web", "squirrowse.web\squirrowse.web.csproj", "{8A3C08CE-2DB6-4339-9A72-6EB58AD2300F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrowse.Client", "Squirrowse.Client\Squirrowse.Client.csproj", "{558A5917-6AD3-4C40-ACA1-EE3B8B8927C8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "squirrowse.db", "squirrowse.db\squirrowse.db.csproj", "{322D1CFC-AEC6-4C8A-9561-8CB25F3C8A4F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrowse.Core", "Squirrowse.Core\Squirrowse.Core.csproj", "{D0989FCC-484E-4ADB-BA5E-1020894F9C09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "squirrowse.core", "squirrowse.core\squirrowse.core.csproj", "{0C908BE8-729C-4DCA-92DE-07FB7346EBB7}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BB569A06-F4D1-4927-87AB-86C4BD2AFBC5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squirrowse.Core.Tests", "Squirrowse.Core.Tests\Squirrowse.Core.Tests.csproj", "{CFA96677-EAA7-4871-AAD8-E6336973366F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Squirrowse.Web", "Squirrowse.Web\Squirrowse.Web.csproj", "{5FEF6EDF-3327-48B1-9298-26A24D023924}" - ProjectSection(ProjectDependencies) = postProject - {D0989FCC-484E-4ADB-BA5E-1020894F9C09} = {D0989FCC-484E-4ADB-BA5E-1020894F9C09} - EndProjectSection +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "squirrowse.client", "squirrowse.client\squirrowse.client.csproj", "{89E3C9E7-94E5-4976-97C0-0703F6C9DF49}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -24,34 +17,27 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8C085621-BAAA-4E96-B027-561BC18751EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C085621-BAAA-4E96-B027-561BC18751EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C085621-BAAA-4E96-B027-561BC18751EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C085621-BAAA-4E96-B027-561BC18751EE}.Release|Any CPU.Build.0 = Release|Any CPU - {558A5917-6AD3-4C40-ACA1-EE3B8B8927C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {558A5917-6AD3-4C40-ACA1-EE3B8B8927C8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {558A5917-6AD3-4C40-ACA1-EE3B8B8927C8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {558A5917-6AD3-4C40-ACA1-EE3B8B8927C8}.Release|Any CPU.Build.0 = Release|Any CPU - {D0989FCC-484E-4ADB-BA5E-1020894F9C09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D0989FCC-484E-4ADB-BA5E-1020894F9C09}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D0989FCC-484E-4ADB-BA5E-1020894F9C09}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D0989FCC-484E-4ADB-BA5E-1020894F9C09}.Release|Any CPU.Build.0 = Release|Any CPU - {CFA96677-EAA7-4871-AAD8-E6336973366F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CFA96677-EAA7-4871-AAD8-E6336973366F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CFA96677-EAA7-4871-AAD8-E6336973366F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CFA96677-EAA7-4871-AAD8-E6336973366F}.Release|Any CPU.Build.0 = Release|Any CPU - {5FEF6EDF-3327-48B1-9298-26A24D023924}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5FEF6EDF-3327-48B1-9298-26A24D023924}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5FEF6EDF-3327-48B1-9298-26A24D023924}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5FEF6EDF-3327-48B1-9298-26A24D023924}.Release|Any CPU.Build.0 = Release|Any CPU + {8A3C08CE-2DB6-4339-9A72-6EB58AD2300F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A3C08CE-2DB6-4339-9A72-6EB58AD2300F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A3C08CE-2DB6-4339-9A72-6EB58AD2300F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A3C08CE-2DB6-4339-9A72-6EB58AD2300F}.Release|Any CPU.Build.0 = Release|Any CPU + {322D1CFC-AEC6-4C8A-9561-8CB25F3C8A4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {322D1CFC-AEC6-4C8A-9561-8CB25F3C8A4F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {322D1CFC-AEC6-4C8A-9561-8CB25F3C8A4F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {322D1CFC-AEC6-4C8A-9561-8CB25F3C8A4F}.Release|Any CPU.Build.0 = Release|Any CPU + {0C908BE8-729C-4DCA-92DE-07FB7346EBB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C908BE8-729C-4DCA-92DE-07FB7346EBB7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C908BE8-729C-4DCA-92DE-07FB7346EBB7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C908BE8-729C-4DCA-92DE-07FB7346EBB7}.Release|Any CPU.Build.0 = Release|Any CPU + {89E3C9E7-94E5-4976-97C0-0703F6C9DF49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89E3C9E7-94E5-4976-97C0-0703F6C9DF49}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89E3C9E7-94E5-4976-97C0-0703F6C9DF49}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89E3C9E7-94E5-4976-97C0-0703F6C9DF49}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {CFA96677-EAA7-4871-AAD8-E6336973366F} = {BB569A06-F4D1-4927-87AB-86C4BD2AFBC5} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1CC5C3B8-3825-4EB5-ACFF-73B4CAC8945D} + SolutionGuid = {8CE6F2C5-E801-4DB6-8A77-7CA7DB88E070} EndGlobalSection EndGlobal