mirror of
				https://github.com/9ParsonsB/Pulsar.git
				synced 2025-10-30 22:24:58 -04:00 
			
		
		
		
	Fix Dev Proxy
Setup User Secrets for config
This commit is contained in:
		| @@ -7,6 +7,6 @@ public class StatusController(IStatusService status) : ControllerBase | |||||||
|     [HttpGet] |     [HttpGet] | ||||||
|     public async Task<IActionResult> Get() |     public async Task<IActionResult> Get() | ||||||
|     { |     { | ||||||
|         return Ok(status.Get()); |         return Ok(await status.Get()); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,8 +1,21 @@ | |||||||
| using Lamar.Microsoft.DependencyInjection; | using Lamar.Microsoft.DependencyInjection; | ||||||
| using Microsoft.AspNetCore.Cors.Infrastructure; | using Microsoft.AspNetCore.Cors.Infrastructure; | ||||||
|  | using Microsoft.Extensions.FileProviders; | ||||||
| using Pulsar.Features; | using Pulsar.Features; | ||||||
|  |  | ||||||
| var builder = WebApplication.CreateBuilder(args); |  | ||||||
|  | var builder = WebApplication.CreateBuilder(new WebApplicationOptions() | ||||||
|  | { | ||||||
|  |     Args = args, WebRootPath = "static", ContentRootPath = "WebApp", ApplicationName = "Pulsar", EnvironmentName = | ||||||
|  | #if DEBUG | ||||||
|  |         "Development" | ||||||
|  |     #else | ||||||
|  |     "Production" | ||||||
|  | #endif  | ||||||
|  |      | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | var currentDirFileProvider = new PhysicalFileProvider(Directory.GetCurrentDirectory()); | ||||||
|  |  | ||||||
| builder.Host.UseLamar((_, registry) => registry.Scan(scan => | builder.Host.UseLamar((_, registry) => registry.Scan(scan => | ||||||
| { | { | ||||||
| @@ -10,7 +23,15 @@ builder.Host.UseLamar((_, registry) => registry.Scan(scan => | |||||||
|     scan.WithDefaultConventions(); |     scan.WithDefaultConventions(); | ||||||
|     scan.LookForRegistries(); |     scan.LookForRegistries(); | ||||||
| })); | })); | ||||||
| builder.Services.AddControllersWithViews(); |  | ||||||
|  | builder.Configuration.AddJsonFile(currentDirFileProvider,"appsettings.json", optional: false, reloadOnChange: true); | ||||||
|  | builder.Configuration.AddJsonFile(currentDirFileProvider, $"appsettings.{builder.Environment.EnvironmentName.ToLowerInvariant()}.json", optional: true, reloadOnChange: true); | ||||||
|  |  | ||||||
|  | builder.Configuration.AddUserSecrets<Program>(); | ||||||
|  |  | ||||||
|  | builder.Services.Configure<PulsarConfiguration>(builder.Configuration.GetSection("Pulsar")); | ||||||
|  |  | ||||||
|  | builder.Services.AddControllers(); | ||||||
| builder.Services.AddCors(options => | builder.Services.AddCors(options => | ||||||
| { | { | ||||||
|     options.AddDefaultPolicy(new CorsPolicy() |     options.AddDefaultPolicy(new CorsPolicy() | ||||||
| @@ -19,22 +40,20 @@ builder.Services.AddCors(options => | |||||||
| builder.Services.AddSignalR().AddJsonProtocol(options => | builder.Services.AddSignalR().AddJsonProtocol(options => | ||||||
|     options.PayloadSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull); |     options.PayloadSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull); | ||||||
| builder.Services.AddDbContext<PulsarContext>(); | builder.Services.AddDbContext<PulsarContext>(); | ||||||
| builder.Services.Configure<PulsarConfiguration>(builder.Configuration.GetSection(nameof(Pulsar))); |  | ||||||
| builder.Services.Configure<JsonOptions>(options => | builder.Services.Configure<JsonOptions>(options => | ||||||
|     options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull); |     options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull); | ||||||
| builder.Services.AddReverseProxy().LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); | builder.Services.AddReverseProxy().LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); | ||||||
| builder.Services.AddSpaYarp(); |  | ||||||
|  | builder.Services.AddHttpForwarder(); | ||||||
| builder.Services.AddHostedService<FileWatcherService>(); | builder.Services.AddHostedService<FileWatcherService>(); | ||||||
|  |  | ||||||
| var app = builder.Build(); | var app = builder.Build(); | ||||||
|  |  | ||||||
|  | app.UseWebSockets(); | ||||||
| app.UseRouting(); | app.UseRouting(); | ||||||
| app.MapReverseProxy(); | app.MapReverseProxy(); | ||||||
| app.MapControllers(); | app.MapControllers(); | ||||||
| app.MapDefaultControllerRoute(); |  | ||||||
| app.UseWebSockets(); |  | ||||||
| app.MapHub<EventsHub>("api/events"); | app.MapHub<EventsHub>("api/events"); | ||||||
| app.UseSpaYarp(); | app.MapFallbackToFile("index.html").AllowAnonymous(); | ||||||
| app.MapFallbackToFile("index.html"); |  | ||||||
|  |  | ||||||
| await app.RunAsync(); | await app.RunAsync(); | ||||||
| @@ -9,6 +9,7 @@ | |||||||
|         <LangVersion>latest</LangVersion> |         <LangVersion>latest</LangVersion> | ||||||
|         <SpaRoot>WebApp/</SpaRoot> |         <SpaRoot>WebApp/</SpaRoot> | ||||||
|         <SpaClientUrl>http://localhost:5173</SpaClientUrl> |         <SpaClientUrl>http://localhost:5173</SpaClientUrl> | ||||||
|  |         <UserSecretsId>73ec530f-725a-43be-ae2e-b43eeb61cb04</UserSecretsId> | ||||||
|     </PropertyGroup> |     </PropertyGroup> | ||||||
|      |      | ||||||
|     <ItemGroup> |     <ItemGroup> | ||||||
| @@ -16,7 +17,6 @@ | |||||||
|     </ItemGroup> |     </ItemGroup> | ||||||
|     |     | ||||||
|     <ItemGroup> |     <ItemGroup> | ||||||
|       <PackageReference Include="AspNetCore.SpaYarp" Version="2.0.1" /> |  | ||||||
|       <PackageReference Include="Lamar" Version="13.0.3" /> |       <PackageReference Include="Lamar" Version="13.0.3" /> | ||||||
|       <PackageReference Include="Lamar.Microsoft.DependencyInjection" Version="13.0.3" /> |       <PackageReference Include="Lamar.Microsoft.DependencyInjection" Version="13.0.3" /> | ||||||
|       <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" /> |       <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" /> | ||||||
|   | |||||||
| @@ -1,6 +1,9 @@ | |||||||
|  | using System.ComponentModel.DataAnnotations; | ||||||
|  |  | ||||||
| namespace Pulsar; | namespace Pulsar; | ||||||
|  |  | ||||||
| public class PulsarConfiguration | public class PulsarConfiguration | ||||||
| { | { | ||||||
|  |     [Required] | ||||||
|     public string JournalDirectory { get; set; } |     public string JournalDirectory { get; set; } | ||||||
| } | } | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
|     import * as signalR from "@microsoft/signalr" |     import * as signalR from "@microsoft/signalr" | ||||||
|     import {onMount} from "svelte"; |     import {onMount} from "svelte"; | ||||||
|     let x = $state(null); |     let x: string | null = $state(null); | ||||||
|     let textarea = $state(""); |     let textarea = $state(""); | ||||||
|  |  | ||||||
|     const connection = new signalR.HubConnectionBuilder() |     const connection = new signalR.HubConnectionBuilder() | ||||||
|   | |||||||
| @@ -2,9 +2,9 @@ | |||||||
|   "Logging": { |   "Logging": { | ||||||
|     "LogLevel": { |     "LogLevel": { | ||||||
|       "Default": "Information", |       "Default": "Information", | ||||||
|       "Microsoft": "Warning", |       "Microsoft": "Information", | ||||||
|       "Microsoft.Hosting.Lifetime": "Information", |       "Microsoft.Hosting.Lifetime": "Information", | ||||||
|         "Microsoft.AspNetCore": "Debug" |       "Microsoft.AspNetCore": "Information" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "ReverseProxy": { |   "ReverseProxy": { | ||||||
| @@ -17,7 +17,7 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "Clusters": { |     "Clusters": { | ||||||
|       "spaDev": { |       "spaDevCluster": { | ||||||
|         "Destinations": { |         "Destinations": { | ||||||
|           "spaDevServer": { |           "spaDevServer": { | ||||||
|             "Address": "http://localhost:5173" |             "Address": "http://localhost:5173" | ||||||
|   | |||||||
| @@ -1,6 +1,5 @@ | |||||||
| { | { | ||||||
|   "Pulsar": { |   "Pulsar": { | ||||||
|     // C:\Users\User Name\Saved Games\Frontier Developments\Elite Dangerous\ |     "JournalDirectory": "C:\\Users\\User Name\\Saved Games\\Frontier Developments\\Elite Dangerous\\" | ||||||
|     "JournalDirectory": "/home/minijack/Games/lutris/elite-dangerous/drive_c/users/minijack/Saved Games/Frontier Developments/Elite Dangerous/", |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user