mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2025-04-30 15:34:06 +02:00
Add version and git hash to assemblies & website menu
This commit is contained in:
parent
1c96afaa3c
commit
e51844d798
Agent/Phantom.Agent
Directory.Build.propsDirectory.Build.targetsServer
Phantom.Server.Services
Phantom.Server.Web
Phantom.Server
Utils/Phantom.Utils.Runtime
@ -1,4 +1,5 @@
|
|||||||
using Phantom.Agent;
|
using System.Reflection;
|
||||||
|
using Phantom.Agent;
|
||||||
using Phantom.Agent.Rpc;
|
using Phantom.Agent.Rpc;
|
||||||
using Phantom.Agent.Services;
|
using Phantom.Agent.Services;
|
||||||
using Phantom.Agent.Services.Rpc;
|
using Phantom.Agent.Services.Rpc;
|
||||||
@ -19,6 +20,7 @@ PosixSignals.RegisterCancellation(cancellationTokenSource, static () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
PhantomLogger.Root.InformationHeading("Initializing Phantom Panel agent...");
|
PhantomLogger.Root.InformationHeading("Initializing Phantom Panel agent...");
|
||||||
|
PhantomLogger.Root.Information("Agent version: {Version}", AssemblyAttributes.GetFullVersion(Assembly.GetExecutingAssembly()));
|
||||||
|
|
||||||
var (serverHost, serverPort, javaSearchPath, authToken, authTokenFilePath, agentName, maxInstances, maxMemory, allowedServerPorts, allowedRconPorts) = Variables.LoadOrExit();
|
var (serverHost, serverPort, javaSearchPath, authToken, authTokenFilePath, agentName, maxInstances, maxMemory, allowedServerPorts, allowedRconPorts) = Variables.LoadOrExit();
|
||||||
|
|
||||||
|
5
Directory.Build.props
Normal file
5
Directory.Build.props
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Version>0.0.1</Version>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
@ -1,3 +1,11 @@
|
|||||||
<Project>
|
<Project>
|
||||||
|
|
||||||
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />
|
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />
|
||||||
|
|
||||||
|
<Target Name="SetSourceRevisionId" BeforeTargets="InitializeSourceControlInformation">
|
||||||
|
<Exec Command="git describe --always --abbrev=8" ConsoleToMSBuild="True" IgnoreExitCode="False">
|
||||||
|
<Output PropertyName="SourceRevisionId" TaskParameter="ConsoleOutput" />
|
||||||
|
</Exec>
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
namespace Phantom.Server.Services;
|
namespace Phantom.Server.Services;
|
||||||
|
|
||||||
public sealed record ServiceConfiguration(
|
public sealed record ServiceConfiguration(
|
||||||
|
string Version,
|
||||||
byte[] AdministratorToken,
|
byte[] AdministratorToken,
|
||||||
CancellationToken CancellationToken
|
CancellationToken CancellationToken
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<div class="navbar navbar-dark">
|
@using Phantom.Server.Services
|
||||||
|
@inject ServiceConfiguration Configuration
|
||||||
|
|
||||||
|
<div class="navbar navbar-dark">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="">Phantom Panel</a>
|
<a class="navbar-brand" href="">Phantom Panel</a>
|
||||||
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
||||||
@ -7,8 +10,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
|
<div class="navbar-menu @NavMenuCssClass" @onclick="ToggleNavMenu">
|
||||||
<nav class="flex-column">
|
<nav>
|
||||||
<NavMenuItem Label="Home" Icon="home" Match="NavLinkMatch.All" />
|
<NavMenuItem Label="Home" Icon="home" Match="NavLinkMatch.All" />
|
||||||
<AuthorizeView>
|
<AuthorizeView>
|
||||||
<NotAuthorized>
|
<NotAuthorized>
|
||||||
@ -21,6 +24,9 @@
|
|||||||
</Authorized>
|
</Authorized>
|
||||||
</AuthorizeView>
|
</AuthorizeView>
|
||||||
</nav>
|
</nav>
|
||||||
|
<footer>
|
||||||
|
Build @Configuration.Version
|
||||||
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
@ -7,13 +7,34 @@
|
|||||||
background-color: rgba(255, 255, 255, 0.15);
|
background-color: rgba(255, 255, 255, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin: 0 0.75rem 0.5rem;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
text-align: right;
|
||||||
|
color: #d9d9d9;
|
||||||
|
}
|
||||||
|
|
||||||
@media (min-width: 960px) {
|
@media (min-width: 960px) {
|
||||||
.navbar-toggler {
|
.navbar-toggler {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapse {
|
.navbar-menu {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-menu, nav {
|
||||||
|
flex: 1 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-menu.collapse {
|
||||||
/* Never collapse the sidebar for wide screens */
|
/* Never collapse the sidebar for wide screens */
|
||||||
display: block;
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin: 0.25rem 0;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 250px;
|
width: 250px;
|
||||||
height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using System.Reflection;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Phantom.Common.Logging;
|
using Phantom.Common.Logging;
|
||||||
using Phantom.Server;
|
using Phantom.Server;
|
||||||
@ -22,7 +23,10 @@ PosixSignals.RegisterCancellation(cancellationTokenSource, static () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
var fullVersion = AssemblyAttributes.GetFullVersion(Assembly.GetExecutingAssembly());
|
||||||
|
|
||||||
PhantomLogger.Root.InformationHeading("Initializing Phantom Panel server...");
|
PhantomLogger.Root.InformationHeading("Initializing Phantom Panel server...");
|
||||||
|
PhantomLogger.Root.Information("Server version: {Version}", fullVersion);
|
||||||
|
|
||||||
var (webServerHost, webServerPort, webBasePath, rpcServerHost, rpcServerPort, sqlConnectionString) = Variables.LoadOrExit();
|
var (webServerHost, webServerPort, webBasePath, rpcServerHost, rpcServerPort, sqlConnectionString) = Variables.LoadOrExit();
|
||||||
|
|
||||||
@ -55,7 +59,7 @@ try {
|
|||||||
PhantomLogger.Root.Information("Your administrator token is: {AdministratorToken}", administratorToken);
|
PhantomLogger.Root.Information("Your administrator token is: {AdministratorToken}", administratorToken);
|
||||||
PhantomLogger.Root.Information("For administrator setup, visit: {HttpUrl}{SetupPath}", webConfiguration.HttpUrl, webConfiguration.BasePath + "setup");
|
PhantomLogger.Root.Information("For administrator setup, visit: {HttpUrl}{SetupPath}", webConfiguration.HttpUrl, webConfiguration.BasePath + "setup");
|
||||||
|
|
||||||
var serviceConfiguration = new ServiceConfiguration(TokenGenerator.GetBytesOrThrow(administratorToken), cancellationTokenSource.Token);
|
var serviceConfiguration = new ServiceConfiguration(fullVersion, TokenGenerator.GetBytesOrThrow(administratorToken), cancellationTokenSource.Token);
|
||||||
var webConfigurator = new WebConfigurator(serviceConfiguration, taskManager, agentToken);
|
var webConfigurator = new WebConfigurator(serviceConfiguration, taskManager, agentToken);
|
||||||
var webApplication = await WebLauncher.CreateApplication(webConfiguration, webConfigurator, options => options.UseNpgsql(sqlConnectionString, static options => {
|
var webApplication = await WebLauncher.CreateApplication(webConfiguration, webConfigurator, options => options.UseNpgsql(sqlConnectionString, static options => {
|
||||||
options.CommandTimeout(10).MigrationsAssembly(typeof(ApplicationDbContextDesignFactory).Assembly.FullName);
|
options.CommandTimeout(10).MigrationsAssembly(typeof(ApplicationDbContextDesignFactory).Assembly.FullName);
|
||||||
|
9
Utils/Phantom.Utils.Runtime/AssemblyAttributes.cs
Normal file
9
Utils/Phantom.Utils.Runtime/AssemblyAttributes.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Phantom.Utils.Runtime;
|
||||||
|
|
||||||
|
public static class AssemblyAttributes {
|
||||||
|
public static string GetFullVersion(Assembly assembly) {
|
||||||
|
return assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Replace('+', '/') ?? string.Empty;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user