diff --git a/.gitignore b/.gitignore index ff4c3c136..c9003467c 100644 --- a/.gitignore +++ b/.gitignore @@ -299,11 +299,9 @@ __pycache__/ **/updateFiles/** usersettings.json -**/Embystat.Web/config/** **/issues.json **/coverage/** **/ClientApp/build/** -EmbyStat.Web/ClientApp/.eslintcache **/logs *.db-shm @@ -311,7 +309,10 @@ EmbyStat.Web/ClientApp/.eslintcache *.db-wal EmbyStat.Web/ClientApp/junit.xml - +EmbyStat.Web/ClientApp/.eslintcache EmbyStat.Web/ClientApp/report.json - EmbyStat.Web/ClientApp/test-report.xml + +EmbyStat.Hosts.Cmd/config/ +EmbyStat.Hosts.Cmd/data/ +EmbyStat.Hosts.Cmd/logs/ diff --git a/EmbyStat.Common/Models/StartupOptions.cs b/EmbyStat.Common/Models/StartupOptions.cs index a8fee6117..51ee8d45a 100644 --- a/EmbyStat.Common/Models/StartupOptions.cs +++ b/EmbyStat.Common/Models/StartupOptions.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using CommandLine; diff --git a/EmbyStat.Controllers/About/AboutController.cs b/EmbyStat.Controllers/About/AboutController.cs index cb1b3e6a3..1e7b2630c 100644 --- a/EmbyStat.Controllers/About/AboutController.cs +++ b/EmbyStat.Controllers/About/AboutController.cs @@ -1,5 +1,4 @@ using AutoMapper; -using EmbyStat.Core.About; using EmbyStat.Core.About.Interfaces; using Microsoft.AspNetCore.Mvc; diff --git a/EmbyStat.Controllers/Account/AccountController.cs b/EmbyStat.Controllers/Account/AccountController.cs index a61d8f58a..8a9e71a28 100644 --- a/EmbyStat.Controllers/Account/AccountController.cs +++ b/EmbyStat.Controllers/Account/AccountController.cs @@ -1,7 +1,6 @@ using System.Linq; using System.Threading.Tasks; using EmbyStat.Common.Models.Account; -using EmbyStat.Core.Account; using EmbyStat.Core.Account.Interfaces; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/EmbyStat.Web/ApplicationModes.cs b/EmbyStat.Hosts.Cmd/ApplicationModes.cs similarity index 78% rename from EmbyStat.Web/ApplicationModes.cs rename to EmbyStat.Hosts.Cmd/ApplicationModes.cs index 823a05dcf..07f7652b1 100644 --- a/EmbyStat.Web/ApplicationModes.cs +++ b/EmbyStat.Hosts.Cmd/ApplicationModes.cs @@ -1,4 +1,4 @@ -namespace EmbyStat.Web; +namespace EmbyStat.Hosts.Cmd; public enum ApplicationModes { diff --git a/EmbyStat.Web/DefaultConfig.cs b/EmbyStat.Hosts.Cmd/DefaultConfig.cs similarity index 97% rename from EmbyStat.Web/DefaultConfig.cs rename to EmbyStat.Hosts.Cmd/DefaultConfig.cs index ee0f46c71..80b8650b7 100644 --- a/EmbyStat.Web/DefaultConfig.cs +++ b/EmbyStat.Hosts.Cmd/DefaultConfig.cs @@ -1,9 +1,8 @@ -using System; -using EmbyStat.Common.Enums; +using EmbyStat.Common.Enums; using EmbyStat.Common.Generators; using EmbyStat.Configuration; -namespace EmbyStat.Web; +namespace EmbyStat.Hosts.Cmd; public static class DefaultConfig { diff --git a/EmbyStat.Hosts.Cmd/EmbyStat.Hosts.Cmd.csproj b/EmbyStat.Hosts.Cmd/EmbyStat.Hosts.Cmd.csproj new file mode 100644 index 000000000..065bd7ab6 --- /dev/null +++ b/EmbyStat.Hosts.Cmd/EmbyStat.Hosts.Cmd.csproj @@ -0,0 +1,100 @@ + + + net6.0 + enable + enable + false + ..\branding\NSIS\install.ico + false + AnyCPU;x64;x86 + 1.2.3.4 + 1.2.3.4 + 1.2.3.4 + false + EmbyStat + {1D5D997D-34AE-45BE-9935-14E0D63EAC02} + false + + ..\EmbyStat.Web\ClientApp\ + $(DefaultItemExcludes);$(SpaRoot)node_modules\** + false + true + Latest + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + + + + + + + + ../EmbyStat.Web/ClientApp/report.json + + + true + + + ../EmbyStat.Web/ClientApp/coverage/lcov.info + + + ../EmbyStat.Web/ClientApp/tsconfig.json + + + + + + + + + ES2019 + React + AMD + True + False + True + + + False + True + True + + + + + diff --git a/EmbyStat.Web/Program.cs b/EmbyStat.Hosts.Cmd/Program.cs similarity index 96% rename from EmbyStat.Web/Program.cs rename to EmbyStat.Hosts.Cmd/Program.cs index 0b5026e61..b733c7aa6 100644 --- a/EmbyStat.Web/Program.cs +++ b/EmbyStat.Hosts.Cmd/Program.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.IO; -using System.Linq; using System.Reflection; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; @@ -11,11 +7,7 @@ using EmbyStat.Common.Generators; using EmbyStat.Common.Models; using EmbyStat.Configuration; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting.WindowsServices; -using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Serilog; @@ -26,7 +18,7 @@ // ReSharper disable All -namespace EmbyStat.Web; +namespace EmbyStat.Hosts.Cmd; public class Program { @@ -51,10 +43,15 @@ public static int Main(string[] args) return 0; } - StartupOptions options = null; + StartupOptions? options = null; parseResult.MapResult(opt => options = opt, NotParedOptions); options = CheckEnvironmentVariables(options); + if (options == null) + { + return 1; + } + var mode = GetApplicationMode(); switch (mode) { @@ -82,7 +79,7 @@ public static int Main(string[] args) } } - private static StartupOptions NotParedOptions(IEnumerable errs) + private static StartupOptions? NotParedOptions(IEnumerable errs) { var errors = errs.ToList(); if (errors.Any(x => x is HelpRequestedError)) @@ -138,7 +135,7 @@ private static ApplicationModes GetApplicationMode() return ApplicationModes.Interactive; } - private static IHost BuildConsoleHost(StartupOptions options) + private static IHost BuildConsoleHost(StartupOptions? options) { var memoryConfig = options.ToKeyValuePairs(); var dicConfig = memoryConfig.ToDictionary(x => x.Key, x => x.Value); @@ -151,7 +148,7 @@ private static IHost BuildConsoleHost(StartupOptions options) .Build(); var config = configurationRoot.Get(); - + //Dirs in options object worden hier genegeerd! CreateFolder(config.SystemConfig.Dirs.Logs); @@ -346,8 +343,13 @@ private static string GetEnvironmentName() return str; } - private static StartupOptions CheckEnvironmentVariables(StartupOptions options) + private static StartupOptions? CheckEnvironmentVariables(StartupOptions? options) { + if (options == null) + { + return null; + } + var portStr = Environment.GetEnvironmentVariable("EMBYSTAT_PORT"); if (portStr != null && int.TryParse(portStr, out var port)) { diff --git a/EmbyStat.Web/Startup.cs b/EmbyStat.Hosts.Cmd/Startup.cs similarity index 97% rename from EmbyStat.Web/Startup.cs rename to EmbyStat.Hosts.Cmd/Startup.cs index 2b1cd28f9..9ec6c5847 100644 --- a/EmbyStat.Web/Startup.cs +++ b/EmbyStat.Hosts.Cmd/Startup.cs @@ -1,18 +1,11 @@ using EmbyStat.Jobs; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; using Rollbar; using Rollbar.NetCore.AspNet; -using System; using System.IdentityModel.Tokens.Jwt; -using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Text; -using System.Threading.Tasks; using EmbyStat.Clients.Base; using EmbyStat.Clients.Base.Api; using EmbyStat.Common; @@ -23,7 +16,6 @@ using EmbyStat.Configuration.Interfaces; using EmbyStat.Controllers; using EmbyStat.Controllers.Middleware; -using EmbyStat.Core.Account; using EmbyStat.Core.Account.Interfaces; using EmbyStat.Core.DataStore; using EmbyStat.Core.Hubs; @@ -41,14 +33,12 @@ using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; using Refit; using Rollbar.DTOs; -namespace EmbyStat.Web; +namespace EmbyStat.Hosts.Cmd; public class Startup { @@ -282,7 +272,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApp { if (env.IsDevelopment()) { - spa.Options.SourcePath = "ClientApp"; + spa.Options.SourcePath = Path.Combine("..", "EmbyStat.Web", "ClientApp"); spa.UseReactDevelopmentServer("start"); } else diff --git a/EmbyStat.Web/EmbyStat.Web.csproj b/EmbyStat.Web/EmbyStat.Web.csproj index 3eba09ac4..25e3572a6 100644 --- a/EmbyStat.Web/EmbyStat.Web.csproj +++ b/EmbyStat.Web/EmbyStat.Web.csproj @@ -1,104 +1,11 @@ - + net6.0 - true - Latest false - ClientApp\ - ..\branding\NSIS\install.ico - $(DefaultItemExcludes);$(SpaRoot)node_modules\** - false - - - false AnyCPU;x64;x86 - 1.2.3.4 - 1.2.3.4 - 1.2.3.4 - false - EmbyStat - + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 {1D5D997D-34AE-45BE-9935-13E0D63EAC02} - false - - - - - - ClientApp/report.json - - - true - - - ClientApp/coverage/lcov.info - - - ClientApp/tsconfig.json - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ContentIncludedByDefault Remove="config\config.json" /> - - - - ES2019 - React - AMD - True - False - True - - - False - True - True - - diff --git a/EmbyStat.Web/GitVersion.yml b/EmbyStat.Web/GitVersion.yml deleted file mode 100644 index c350fc5c9..000000000 --- a/EmbyStat.Web/GitVersion.yml +++ /dev/null @@ -1,10 +0,0 @@ -assembly-versioning-scheme: MajorMinorPatch -mode: ContinuousDeployment -branches: - dev(elop)?(ment)?$: - mode: ContinuousDeployment - tag: dev - master: - mode: ContinuousDelivery -ignore: - sha: [] diff --git a/EmbyStat.Web/web.config b/EmbyStat.Web/web.config deleted file mode 100644 index 9f8940a6b..000000000 --- a/EmbyStat.Web/web.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/EmbyStat.sln b/EmbyStat.sln index 957a15be9..44c198f04 100644 --- a/EmbyStat.sln +++ b/EmbyStat.sln @@ -35,6 +35,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbyStat.Core", "EmbyStat.C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbyStat.Configuration", "EmbyStat.Configuration\EmbyStat.Configuration.csproj", "{6829F708-CA6A-4EB8-99F1-27D1B64FA7EE}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Clients", "Clients", "{8DAC8CBE-F698-4A63-85B1-47A4C9838A5D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbyStat.Hosts.Cmd", "EmbyStat.Hosts.Cmd\EmbyStat.Hosts.Cmd.csproj", "{32FC6B2C-A907-4BE3-88FA-789060FCD73B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosts", "Hosts", "{013D866F-2C9A-4927-B8DA-B5E0A2424F55}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -336,6 +342,24 @@ Global {6829F708-CA6A-4EB8-99F1-27D1B64FA7EE}.Release|x64.Build.0 = Release|Any CPU {6829F708-CA6A-4EB8-99F1-27D1B64FA7EE}.Release|x86.ActiveCfg = Release|Any CPU {6829F708-CA6A-4EB8-99F1-27D1B64FA7EE}.Release|x86.Build.0 = Release|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Debug|x64.ActiveCfg = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Debug|x64.Build.0 = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Debug|x86.ActiveCfg = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Debug|x86.Build.0 = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.DefaultBuild|x64.Build.0 = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.DefaultBuild|x86.Build.0 = Debug|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Release|Any CPU.Build.0 = Release|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Release|x64.ActiveCfg = Release|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Release|x64.Build.0 = Release|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Release|x86.ActiveCfg = Release|Any CPU + {32FC6B2C-A907-4BE3-88FA-789060FCD73B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -343,4 +367,12 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FE1E7FBB-D938-4C37-A040-661A869C95DA} EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {CC92EA4C-6E0D-49AD-B795-C15BF9D7EB24} = {8DAC8CBE-F698-4A63-85B1-47A4C9838A5D} + {0145B376-DB18-42A2-B2AF-98B4A952002F} = {8DAC8CBE-F698-4A63-85B1-47A4C9838A5D} + {7243326A-D3F9-4C14-BAAD-86BF66D4F223} = {8DAC8CBE-F698-4A63-85B1-47A4C9838A5D} + {38FB4C9E-D2AE-49E2-A25A-DCC403D0459D} = {8DAC8CBE-F698-4A63-85B1-47A4C9838A5D} + {4D486D10-E1D4-478A-BDFE-B600FEAC0A92} = {8DAC8CBE-F698-4A63-85B1-47A4C9838A5D} + {32FC6B2C-A907-4BE3-88FA-789060FCD73B} = {013D866F-2C9A-4927-B8DA-B5E0A2424F55} + EndGlobalSection EndGlobal diff --git a/Tests.Unit/Builders/ViewModels/ConfigViewModelBuilder.cs b/Tests.Unit/Builders/ViewModels/ConfigViewModelBuilder.cs index b368cd646..1053bf696 100644 --- a/Tests.Unit/Builders/ViewModels/ConfigViewModelBuilder.cs +++ b/Tests.Unit/Builders/ViewModels/ConfigViewModelBuilder.cs @@ -1,6 +1,5 @@ using EmbyStat.Configuration; using EmbyStat.Controllers.Settings; -using FluentAssertions; namespace Tests.Unit.Builders.ViewModels; diff --git a/Tests.Unit/Controllers/SettingsControllerTests.cs b/Tests.Unit/Controllers/SettingsControllerTests.cs index fb6bf496e..06d839886 100644 --- a/Tests.Unit/Controllers/SettingsControllerTests.cs +++ b/Tests.Unit/Controllers/SettingsControllerTests.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using AutoMapper; -using EmbyStat.Common.Enums; using EmbyStat.Common.Models.Entities; using EmbyStat.Configuration; using EmbyStat.Configuration.Interfaces; @@ -15,7 +14,6 @@ using Tests.Unit.Builders; using Tests.Unit.Builders.ViewModels; using Xunit; -using Rollbar = EmbyStat.Configuration.Rollbar; namespace Tests.Unit.Controllers; diff --git a/Tests.Unit/Services/SystemServiceTests.cs b/Tests.Unit/Services/SystemServiceTests.cs index 1e34f8fd8..22cba0cc1 100644 --- a/Tests.Unit/Services/SystemServiceTests.cs +++ b/Tests.Unit/Services/SystemServiceTests.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using EmbyStat.Common.Enums; -using EmbyStat.Configuration; using EmbyStat.Configuration.Interfaces; using EmbyStat.Core.Filters.Interfaces; using EmbyStat.Core.Genres.Interfaces; diff --git a/Tests.Unit/Tests.Unit.csproj b/Tests.Unit/Tests.Unit.csproj index 5c710a9b5..dc6c01650 100644 --- a/Tests.Unit/Tests.Unit.csproj +++ b/Tests.Unit/Tests.Unit.csproj @@ -15,6 +15,7 @@ + @@ -33,6 +34,8 @@ + +