diff --git a/Moonlight.ApiServer/Configuration/AppConfiguration.cs b/Moonlight.ApiServer/Configuration/AppConfiguration.cs index 761e5f03..f800332b 100644 --- a/Moonlight.ApiServer/Configuration/AppConfiguration.cs +++ b/Moonlight.ApiServer/Configuration/AppConfiguration.cs @@ -9,6 +9,12 @@ public class AppConfiguration public DatabaseConfig Database { get; set; } = new(); public AuthenticationConfig Authentication { get; set; } = new(); public DevelopmentConfig Development { get; set; } = new(); + public ClientConfig Client { get; set; } = new(); + + public class ClientConfig + { + public bool Enable { get; set; } = true; + } public class DatabaseConfig { diff --git a/Moonlight.ApiServer/Dockerfile b/Moonlight.ApiServer/Dockerfile index 016478a6..205c7879 100644 --- a/Moonlight.ApiServer/Dockerfile +++ b/Moonlight.ApiServer/Dockerfile @@ -3,21 +3,31 @@ USER $APP_UID WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build + ARG BUILD_CONFIGURATION=Release + WORKDIR /src + COPY ["Moonlight.ApiServer/Moonlight.ApiServer.csproj", "Moonlight.ApiServer/"] COPY ["Moonlight.Client/Moonlight.Client.csproj", "Moonlight.Client/"] COPY ["Moonlight.Shared/Moonlight.Shared.csproj", "Moonlight.Shared/"] + RUN dotnet restore "Moonlight.ApiServer/Moonlight.ApiServer.csproj" + COPY . . + WORKDIR "/src/Moonlight.ApiServer" + RUN dotnet build "Moonlight.ApiServer.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish + ARG BUILD_CONFIGURATION=Release + RUN dotnet publish "Moonlight.ApiServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false FROM base AS final + WORKDIR /app COPY --from=publish /app/publish . diff --git a/Moonlight.ApiServer/Program.cs b/Moonlight.ApiServer/Program.cs index 9834d12b..2b56e739 100644 --- a/Moonlight.ApiServer/Program.cs +++ b/Moonlight.ApiServer/Program.cs @@ -131,11 +131,14 @@ var app = builder.Build(); await Startup.PrepareDatabase(app); -if (app.Environment.IsDevelopment()) - app.UseWebAssemblyDebugging(); +if (config.Client.Enable) +{ + if (app.Environment.IsDevelopment()) + app.UseWebAssemblyDebugging(); -app.UseBlazorFrameworkFiles(); -app.UseStaticFiles(); + app.UseBlazorFrameworkFiles(); + app.UseStaticFiles(); +} app.UseRouting(); @@ -184,6 +187,8 @@ foreach (var endpointStartup in endpointStartupInterfaces) } app.MapControllers(); -app.MapFallbackToFile("index.html"); + +if(config.Client.Enable) + app.MapFallbackToFile("index.html"); app.Run(); \ No newline at end of file diff --git a/Moonlight.Client/Moonlight.Client.csproj b/Moonlight.Client/Moonlight.Client.csproj index 8ef7a1f1..6cb8f19d 100644 --- a/Moonlight.Client/Moonlight.Client.csproj +++ b/Moonlight.Client/Moonlight.Client.csproj @@ -5,6 +5,7 @@ enable enable service-worker-assets.js + Linux diff --git a/Moonlight.Client/UI/Screens/AuthenticationScreen.razor b/Moonlight.Client/UI/Screens/AuthenticationScreen.razor index cd6298a2..ae28892a 100644 --- a/Moonlight.Client/UI/Screens/AuthenticationScreen.razor +++ b/Moonlight.Client/UI/Screens/AuthenticationScreen.razor @@ -131,8 +131,10 @@ else $"&redirect_uri={authStartData.RedirectUri}" + $"&response_type=code"; - //Navigation.NavigateTo(uri, true); - //return; + Navigation.NavigateTo(uri, true); + return; + + // TODO: Make this configurable try {