1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2026-01-14 05:50:30 +01:00

2 Commits

Author SHA1 Message Date
ea66f9f056 Prevent Ctrl-C from killing Agent's child processes on Windows 2025-12-30 04:02:46 +01:00
9a69a6b2bb Update to .NET 10 and C# 14 2025-12-29 23:26:51 +01:00
10 changed files with 29 additions and 33 deletions

View File

@@ -3,11 +3,11 @@
"isRoot": true, "isRoot": true,
"tools": { "tools": {
"dotnet-ef": { "dotnet-ef": {
"version": "9.0.9", "version": "10.0.1",
"commands": [ "commands": [
"dotnet-ef" "dotnet-ef"
], ],
"rollForward": false "rollForward": false
} }
} }
} }

View File

@@ -11,7 +11,6 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="System.Linq.Async" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,8 +1,8 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<LangVersion>13</LangVersion> <LangVersion>14</LangVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@@ -1,7 +1,7 @@
# +---------------+ # +---------------+
# | Prepare build | # | Prepare build |
# +---------------+ # +---------------+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/nightly/sdk:9.0 AS phantom-builder FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/nightly/sdk:10.0 AS phantom-builder
ARG TARGETARCH ARG TARGETARCH
ADD . /app ADD . /app
@@ -19,7 +19,7 @@ RUN find .artifacts/publish/*/* -maxdepth 0 -execdir mv '{}' 'release' \;
# +---------------------+ # +---------------------+
# | Phantom Agent image | # | Phantom Agent image |
# +---------------------+ # +---------------------+
FROM mcr.microsoft.com/dotnet/nightly/runtime:9.0 AS phantom-agent FROM mcr.microsoft.com/dotnet/nightly/runtime:10.0 AS phantom-agent
RUN mkdir /data && chmod 777 /data RUN mkdir /data && chmod 777 /data
WORKDIR /data WORKDIR /data
@@ -46,7 +46,7 @@ ENTRYPOINT ["dotnet", "/app/Phantom.Agent.dll"]
# +--------------------------+ # +--------------------------+
# | Phantom Controller image | # | Phantom Controller image |
# +--------------------------+ # +--------------------------+
FROM mcr.microsoft.com/dotnet/nightly/runtime:9.0 AS phantom-controller FROM mcr.microsoft.com/dotnet/nightly/runtime:10.0 AS phantom-controller
RUN mkdir /data && chmod 777 /data RUN mkdir /data && chmod 777 /data
WORKDIR /data WORKDIR /data

View File

@@ -1,15 +1,14 @@
<Project> <Project>
<ItemGroup> <ItemGroup>
<PackageReference Update="Microsoft.AspNetCore.Components.Authorization" Version="9.0.9" /> <PackageReference Update="Microsoft.AspNetCore.Components.Authorization" Version="10.0.1" />
<PackageReference Update="Microsoft.AspNetCore.Components.Web" Version="9.0.9" /> <PackageReference Update="Microsoft.AspNetCore.Components.Web" Version="10.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="9.0.9" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Tools" Version="10.0.1" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Tools" Version="9.0.9" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="10.0.1" />
<PackageReference Update="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" /> <PackageReference Update="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
<PackageReference Update="System.Linq.Async" Version="6.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -23,7 +22,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Update="Serilog" Version="4.3.0" /> <PackageReference Update="Serilog" Version="4.3.0" />
<PackageReference Update="Serilog.AspNetCore" Version="9.0.0" /> <PackageReference Update="Serilog.AspNetCore" Version="10.0.0" />
<PackageReference Update="Serilog.Sinks.Async" Version="2.1.0" /> <PackageReference Update="Serilog.Sinks.Async" Version="2.1.0" />
<PackageReference Update="Serilog.Sinks.Console" Version="6.0.0" /> <PackageReference Update="Serilog.Sinks.Console" Version="6.0.0" />
</ItemGroup> </ItemGroup>

View File

@@ -2,17 +2,9 @@
namespace Phantom.Utils.Processes; namespace Phantom.Utils.Processes;
public sealed class OneShotProcess { public sealed class OneShotProcess(ILogger logger, ProcessConfigurator configurator) {
private readonly ILogger logger;
private readonly ProcessConfigurator configurator;
public event EventHandler<Process.Output>? OutputReceived; public event EventHandler<Process.Output>? OutputReceived;
public OneShotProcess(ILogger logger, ProcessConfigurator configurator) {
this.logger = logger;
this.configurator = configurator;
}
public async Task<bool> Run(CancellationToken cancellationToken) { public async Task<bool> Run(CancellationToken cancellationToken) {
using var process = configurator.CreateProcess(); using var process = configurator.CreateProcess();
process.OutputReceived += OutputReceived; process.OutputReceived += OutputReceived;

View File

@@ -31,6 +31,12 @@ public sealed class ProcessConfigurator {
set => startInfo.UseShellExecute = value; set => startInfo.UseShellExecute = value;
} }
public ProcessConfigurator() {
if (OperatingSystem.IsWindows()) {
startInfo.CreateNewProcessGroup = true;
}
}
public Process CreateProcess() { public Process CreateProcess() {
return new Process(new System.Diagnostics.Process { StartInfo = startInfo }); return new Process(new System.Diagnostics.Process { StartInfo = startInfo });
} }

View File

@@ -1,8 +1,9 @@
@using Phantom.Web.Services @using Phantom.Web.Errors
@using Phantom.Web.Services
@inject Navigation Navigation @inject Navigation Navigation
<CascadingAuthenticationState> <CascadingAuthenticationState>
<Router AppAssembly="@typeof(App).Assembly"> <Router AppAssembly="@typeof(App).Assembly" NotFoundPage="typeof(NotFound)">
<Found Context="routeData"> <Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"> <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
<NotAuthorized> <NotAuthorized>
@@ -17,11 +18,5 @@
</AuthorizeRouteView> </AuthorizeRouteView>
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> <FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found> </Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<h1>Not Found</h1>
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router> </Router>
</CascadingAuthenticationState> </CascadingAuthenticationState>

View File

@@ -0,0 +1,5 @@
@page "/error/404"
@layout MainLayout
<h1>Not Found</h1>
<p role="alert">Sorry, there's nothing at this address.</p>

View File

@@ -1,6 +1,6 @@
{ {
"sdk": { "sdk": {
"version": "9.0.0", "version": "10.0.0",
"rollForward": "latestMinor", "rollForward": "latestMinor",
"allowPrerelease": true "allowPrerelease": true
} }