Merge branch 'main' into dhcp-server
# Conflicts: # LANCommander/LANCommander.csprojdhcp-server
commit
4dd98fd8c5
|
@ -5,8 +5,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.52" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.11.53" />
|
||||||
<PackageReference Include="System.Text.Json" Version="5.0.1" />
|
<PackageReference Include="System.Text.Json" Version="7.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
<Reference Include="BeaconLib, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="BeaconLib, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\rix0rrr.BeaconLib.1.0.2\lib\net40\BeaconLib.dll</HintPath>
|
<HintPath>..\packages\rix0rrr.BeaconLib.1.0.2\lib\net40\BeaconLib.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Playnite.SDK, Version=6.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Playnite.SDK, Version=6.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\PlayniteSDK.6.9.0\lib\net462\Playnite.SDK.dll</HintPath>
|
<HintPath>..\packages\PlayniteSDK.6.9.0\lib\net462\Playnite.SDK.dll</HintPath>
|
||||||
|
@ -70,11 +70,11 @@
|
||||||
<Reference Include="System.Text.Encoding.CodePages, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Text.Encoding.CodePages, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Text.Encoding.CodePages.7.0.0\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
|
<HintPath>..\packages\System.Text.Encoding.CodePages.7.0.0\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Text.Encodings.Web, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Text.Encodings.Web.5.0.0\lib\net461\System.Text.Encodings.Web.dll</HintPath>
|
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Text.Json, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Text.Json, Version=7.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Text.Json.5.0.1\lib\net461\System.Text.Json.dll</HintPath>
|
<HintPath>..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.1" newVersion="5.0.0.1" />
|
<bindingRedirect oldVersion="0.0.0.0-7.0.0.3" newVersion="7.0.0.3" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
@ -22,6 +22,14 @@
|
||||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net462" />
|
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net462" />
|
||||||
<package id="NuGet.CommandLine" version="4.4.3" targetFramework="net462" developmentDependency="true" />
|
<package id="NuGet.CommandLine" version="6.7.0" targetFramework="net462" developmentDependency="true" />
|
||||||
<package id="PlayniteSDK" version="6.9.0" targetFramework="net462" />
|
<package id="PlayniteSDK" version="6.9.0" targetFramework="net462" />
|
||||||
<package id="PowerShellStandard.Library" version="5.1.1" targetFramework="net462" />
|
<package id="PowerShellStandard.Library" version="5.1.1" targetFramework="net462" />
|
||||||
<package id="RestSharp" version="106.15.0" targetFramework="net462" />
|
<package id="RestSharp" version="106.15.0" targetFramework="net462" />
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
|
||||||
<package id="System.Text.Encoding.CodePages" version="7.0.0" targetFramework="net462" />
|
<package id="System.Text.Encoding.CodePages" version="7.0.0" targetFramework="net462" />
|
||||||
<package id="System.Text.Encodings.Web" version="5.0.0" targetFramework="net462" />
|
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net462" />
|
||||||
<package id="System.Text.Json" version="5.0.1" targetFramework="net462" />
|
<package id="System.Text.Json" version="7.0.3" targetFramework="net462" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||||
<package id="YamlDotNet" version="5.4.0" targetFramework="net462" />
|
<package id="YamlDotNet" version="5.4.0" targetFramework="net462" />
|
||||||
|
|
|
@ -18,12 +18,14 @@ namespace LANCommander.Controllers.Api
|
||||||
private readonly GameSaveService GameSaveService;
|
private readonly GameSaveService GameSaveService;
|
||||||
private readonly GameService GameService;
|
private readonly GameService GameService;
|
||||||
private readonly UserManager<User> UserManager;
|
private readonly UserManager<User> UserManager;
|
||||||
|
private readonly LANCommanderSettings Settings;
|
||||||
|
|
||||||
public GameSavesController(GameSaveService gameSaveService, GameService gameService, UserManager<User> userManager)
|
public GameSavesController(GameSaveService gameSaveService, GameService gameService, UserManager<User> userManager)
|
||||||
{
|
{
|
||||||
GameSaveService = gameSaveService;
|
GameSaveService = gameSaveService;
|
||||||
GameService = gameService;
|
GameService = gameService;
|
||||||
UserManager = userManager;
|
UserManager = userManager;
|
||||||
|
Settings = SettingService.GetSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
|
@ -65,7 +67,7 @@ namespace LANCommander.Controllers.Api
|
||||||
public async Task<IActionResult> Upload(Guid id, [FromForm] SaveUpload save)
|
public async Task<IActionResult> Upload(Guid id, [FromForm] SaveUpload save)
|
||||||
{
|
{
|
||||||
// Arbitrary file size limit of 25MB
|
// Arbitrary file size limit of 25MB
|
||||||
if (save.File.Length > (ByteSizeLib.ByteSize.BytesInMebiByte * 25))
|
if (save.File.Length > (ByteSizeLib.ByteSize.BytesInMebiByte * Settings.UserSaves.MaxSize))
|
||||||
return BadRequest("Save file archive is too large");
|
return BadRequest("Save file archive is too large");
|
||||||
|
|
||||||
var game = await GameService.Get(id);
|
var game = await GameService.Get(id);
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using LANCommander.Services;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace LANCommander.Controllers
|
||||||
|
{
|
||||||
|
public class ServerController : Controller
|
||||||
|
{
|
||||||
|
private readonly ServerService ServerService;
|
||||||
|
|
||||||
|
public ServerController(ServerService serverService)
|
||||||
|
{
|
||||||
|
this.ServerService = serverService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/Server/{id:guid}/{*path}")]
|
||||||
|
public async Task<IActionResult> Web(Guid id, string path)
|
||||||
|
{
|
||||||
|
var server = await ServerService.Get(id);
|
||||||
|
|
||||||
|
if (server == null)
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
path = path.Replace('/', Path.DirectorySeparatorChar);
|
||||||
|
|
||||||
|
var filename = Path.Combine(server.HTTPRootPath, path);
|
||||||
|
|
||||||
|
if (!System.IO.File.Exists(filename))
|
||||||
|
return NotFound();
|
||||||
|
|
||||||
|
return File(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read), "application/octet-stream", Path.GetFileName(filename));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using LANCommander.Services;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace LANCommander.Data.Models
|
namespace LANCommander.Data.Models
|
||||||
|
@ -19,7 +20,9 @@ namespace LANCommander.Data.Models
|
||||||
|
|
||||||
public string GetUploadPath()
|
public string GetUploadPath()
|
||||||
{
|
{
|
||||||
return Path.Combine("Saves", UserId.ToString(), GameId.ToString(), Id.ToString());
|
var settings = SettingService.GetSettings();
|
||||||
|
|
||||||
|
return Path.Combine(settings.UserSaves.StoragePath, UserId.ToString(), GameId.ToString(), Id.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,9 @@ namespace LANCommander.Data.Models
|
||||||
public bool Autostart { get; set; }
|
public bool Autostart { get; set; }
|
||||||
public int AutostartDelay { get; set; }
|
public int AutostartDelay { get; set; }
|
||||||
|
|
||||||
|
public bool EnableHTTP { get; set; }
|
||||||
|
public string HTTPRootPath { get; set; }
|
||||||
|
|
||||||
public Guid? GameId { get; set; }
|
public Guid? GameId { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[ForeignKey(nameof(GameId))]
|
[ForeignKey(nameof(GameId))]
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Identity;
|
using LANCommander.Services;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
@ -53,7 +54,9 @@ namespace LANCommander.Data.Models
|
||||||
|
|
||||||
public string GetGameSaveUploadPath()
|
public string GetGameSaveUploadPath()
|
||||||
{
|
{
|
||||||
return Path.Combine("Saves", Id.ToString());
|
var settings = SettingService.GetSettings();
|
||||||
|
|
||||||
|
return Path.Combine(settings.UserSaves.StoragePath, Id.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AntDesign" Version="0.15.4" />
|
<PackageReference Include="AntDesign" Version="0.15.5" />
|
||||||
<PackageReference Include="AntDesign.Charts" Version="0.3.1" />
|
<PackageReference Include="AntDesign.Charts" Version="0.3.1" />
|
||||||
<PackageReference Include="Blazor-ApexCharts" Version="0.9.18-beta" />
|
<PackageReference Include="Blazor-ApexCharts" Version="1.0.1" />
|
||||||
<PackageReference Include="BlazorMonaco" Version="3.1.0" />
|
<PackageReference Include="BlazorMonaco" Version="3.1.0" />
|
||||||
<PackageReference Include="ByteSize" Version="2.1.1" />
|
<PackageReference Include="ByteSize" Version="2.1.1" />
|
||||||
<PackageReference Include="CoreRCON" Version="5.0.5" />
|
<PackageReference Include="CoreRCON" Version="5.0.5" />
|
||||||
|
@ -34,15 +34,14 @@
|
||||||
<PackageReference Include="Hangfire.InMemory" Version="0.5.1" />
|
<PackageReference Include="Hangfire.InMemory" Version="0.5.1" />
|
||||||
<PackageReference Include="IGDB" Version="2.3.2" />
|
<PackageReference Include="IGDB" Version="2.3.2" />
|
||||||
<PackageReference Include="IPXRelayDotNet" Version="1.0.0" />
|
<PackageReference Include="IPXRelayDotNet" Version="1.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.11" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.11" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.11" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="7.0.11" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.11" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.10" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.11" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.11" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.10" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.11">
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
@ -51,10 +50,10 @@
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.9" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.10" />
|
||||||
<PackageReference Include="NetworkPrimitives" Version="1.1.0" />
|
<PackageReference Include="NetworkPrimitives" Version="1.1.0" />
|
||||||
<PackageReference Include="NLog" Version="5.2.3" />
|
<PackageReference Include="NLog" Version="5.2.4" />
|
||||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.3" />
|
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.4" />
|
||||||
<PackageReference Include="rix0rrr.BeaconLib" Version="1.0.2" />
|
<PackageReference Include="rix0rrr.BeaconLib" Version="1.0.2" />
|
||||||
<PackageReference Include="swashbuckle" Version="5.6.0" />
|
<PackageReference Include="swashbuckle" Version="5.6.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,40 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace LANCommander.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddServerHTTPSupport : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "EnableHTTP",
|
||||||
|
table: "Servers",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "HTTPRootPath",
|
||||||
|
table: "Servers",
|
||||||
|
type: "TEXT",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "EnableHTTP",
|
||||||
|
table: "Servers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "HTTPRootPath",
|
||||||
|
table: "Servers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -678,9 +678,16 @@ namespace LANCommander.Migrations
|
||||||
b.Property<DateTime>("CreatedOn")
|
b.Property<DateTime>("CreatedOn")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("EnableHTTP")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<Guid?>("GameId")
|
b.Property<Guid?>("GameId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("HTTPRootPath")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace LANCommander.Models
|
||||||
public LANCommanderTheme Theme { get; set; } = LANCommanderTheme.Light;
|
public LANCommanderTheme Theme { get; set; } = LANCommanderTheme.Light;
|
||||||
|
|
||||||
public LANCommanderAuthenticationSettings Authentication { get; set; } = new LANCommanderAuthenticationSettings();
|
public LANCommanderAuthenticationSettings Authentication { get; set; } = new LANCommanderAuthenticationSettings();
|
||||||
|
public LANCommanderUserSaveSettings UserSaves { get; set; } = new LANCommanderUserSaveSettings();
|
||||||
public LANCommanderArchiveSettings Archives { get; set; } = new LANCommanderArchiveSettings();
|
public LANCommanderArchiveSettings Archives { get; set; } = new LANCommanderArchiveSettings();
|
||||||
public LANCommanderIPXRelaySettings IPXRelay { get; set; } = new LANCommanderIPXRelaySettings();
|
public LANCommanderIPXRelaySettings IPXRelay { get; set; } = new LANCommanderIPXRelaySettings();
|
||||||
public LANCommanderDHCPServerSettings DHCPServer { get; set; } = new LANCommanderDHCPServerSettings();
|
public LANCommanderDHCPServerSettings DHCPServer { get; set; } = new LANCommanderDHCPServerSettings();
|
||||||
|
@ -35,6 +36,12 @@ namespace LANCommander.Models
|
||||||
public int PasswordRequiredLength { get; set; } = 8;
|
public int PasswordRequiredLength { get; set; } = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LANCommanderUserSaveSettings
|
||||||
|
{
|
||||||
|
public string StoragePath { get; set; } = "Saves";
|
||||||
|
public int MaxSize { get; set; } = 25;
|
||||||
|
}
|
||||||
|
|
||||||
public class LANCommanderArchiveSettings
|
public class LANCommanderArchiveSettings
|
||||||
{
|
{
|
||||||
public bool EnablePatching { get; set; } = false;
|
public bool EnablePatching { get; set; } = false;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
var totalStorageSize = drives.Where(d => d.IsReady && d.Name == root).Sum(d => d.TotalSize);
|
var totalStorageSize = drives.Where(d => d.IsReady && d.Name == root).Sum(d => d.TotalSize);
|
||||||
var totalAvailableFreeSpace = drives.Where(d => d.IsReady && d.Name == root).Sum(d => d.AvailableFreeSpace);
|
var totalAvailableFreeSpace = drives.Where(d => d.IsReady && d.Name == root).Sum(d => d.AvailableFreeSpace);
|
||||||
var totalUploadDirectorySize = new DirectoryInfo(settings.Archives.StoragePath).EnumerateFiles().Sum(f => f.Length);
|
var totalUploadDirectorySize = new DirectoryInfo(settings.Archives.StoragePath).EnumerateFiles().Sum(f => f.Length);
|
||||||
var totalSaveDirectorySize = new DirectoryInfo("Saves").EnumerateFiles().Sum(f => f.Length);
|
var totalSaveDirectorySize = new DirectoryInfo(settings.UserSaves.StoragePath).EnumerateFiles().Sum(f => f.Length);
|
||||||
|
|
||||||
Data = new object[]
|
Data = new object[]
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<Sider Width="200">
|
<Sider Width="200">
|
||||||
<Menu Mode="@MenuMode.Inline" Style="height: 100%;">
|
<Menu Mode="@MenuMode.Inline" Style="height: 100%;">
|
||||||
<MenuItem RouterLink="@($"/Servers/{Server.Id}/General")">General</MenuItem>
|
<MenuItem RouterLink="@($"/Servers/{Server.Id}/General")">General</MenuItem>
|
||||||
|
<MenuItem RouterLink="@($"/Servers/{Server.Id}/HTTP")">HTTP</MenuItem>
|
||||||
@if (Server != null && Server.Id != Guid.Empty)
|
@if (Server != null && Server.Id != Guid.Empty)
|
||||||
{
|
{
|
||||||
<MenuItem RouterLink="@($"/Servers/{Server.Id}/Consoles")">Consoles</MenuItem>
|
<MenuItem RouterLink="@($"/Servers/{Server.Id}/Consoles")">Consoles</MenuItem>
|
||||||
|
@ -116,6 +116,23 @@
|
||||||
</Form>
|
</Form>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (Panel == "HTTP")
|
||||||
|
{
|
||||||
|
<Form Model="@Server" Layout="@FormLayout.Vertical">
|
||||||
|
<FormItem Label="Enable HTTP">
|
||||||
|
<Switch @bind-Checked="context.EnableHTTP" />
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem Label="Root Path">
|
||||||
|
<FilePicker Root="@RootPath" Title="Choose Root Path" OkText="Select Directory" EntrySelectable="x => x is FileManagerDirectory" @bind-Value="@context.HTTPRootPath" />
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem>
|
||||||
|
<Button Type="@ButtonType.Primary" OnClick="Save" Icon="@IconType.Fill.Save">Save</Button>
|
||||||
|
</FormItem>
|
||||||
|
</Form>
|
||||||
|
}
|
||||||
|
|
||||||
@if (Panel == "Monitor")
|
@if (Panel == "Monitor")
|
||||||
{
|
{
|
||||||
@if (LogId == "Console") {
|
@if (LogId == "Console") {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<MenuItem RouterLink="/Settings/General">General</MenuItem>
|
<MenuItem RouterLink="/Settings/General">General</MenuItem>
|
||||||
<MenuItem RouterLink="/Settings/Users">Users</MenuItem>
|
<MenuItem RouterLink="/Settings/Users">Users</MenuItem>
|
||||||
<MenuItem RouterLink="/Settings/Authentication">Authentication</MenuItem>
|
<MenuItem RouterLink="/Settings/Authentication">Authentication</MenuItem>
|
||||||
|
<MenuItem RouterLink="/Settings/UserSaves">User Saves</MenuItem>
|
||||||
<MenuItem RouterLink="/Settings/Archives">Archives</MenuItem>
|
<MenuItem RouterLink="/Settings/Archives">Archives</MenuItem>
|
||||||
<MenuItem RouterLink="/Settings/IPXRelay">IPX Relay</MenuItem>
|
<MenuItem RouterLink="/Settings/IPXRelay">IPX Relay</MenuItem>
|
||||||
<SubMenu Key="DHCP" Title="DHCP">
|
<SubMenu Key="DHCP" Title="DHCP">
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
@page "/Settings/UserSaves"
|
||||||
|
@using LANCommander.Components.FileManagerComponents;
|
||||||
|
@using LANCommander.Models;
|
||||||
|
@layout SettingsLayout
|
||||||
|
@inject SettingService SettingService
|
||||||
|
@inject IMessageService MessageService
|
||||||
|
@attribute [Authorize(Roles = "Administrator")]
|
||||||
|
|
||||||
|
<PageHeader Title="User Saves" />
|
||||||
|
|
||||||
|
<div style="padding: 0 24px;">
|
||||||
|
<Form Model="Settings" Layout="@FormLayout.Vertical">
|
||||||
|
<FormItem Label="Storage Path">
|
||||||
|
<FilePicker Root="@RootPath" EntrySelectable="x => x is FileManagerDirectory" @bind-Value="@context.UserSaves.StoragePath" OkText="Select Path" Title="Choose Path" OnSelected="OnPathSelected" />
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem Label="Max Size (MB)">
|
||||||
|
<AntDesign.InputNumber @bind-Value="context.UserSaves.MaxSize" Min="1" DefaultValue="25" />
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem>
|
||||||
|
<Button OnClick="Save" Type="@ButtonType.Primary">Save</Button>
|
||||||
|
</FormItem>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
LANCommanderSettings Settings;
|
||||||
|
|
||||||
|
string RootPath = Path.GetPathRoot(Directory.GetCurrentDirectory());
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
Settings = SettingService.GetSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Save()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SettingService.SaveSettings(Settings);
|
||||||
|
MessageService.Success("Settings saved!");
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
MessageService.Error("An unknown error occurred.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPathSelected(string path)
|
||||||
|
{
|
||||||
|
var appPath = Directory.GetCurrentDirectory();
|
||||||
|
|
||||||
|
if (path != null && path.StartsWith(appPath))
|
||||||
|
path = path.Substring(appPath.Length).TrimStart(Path.DirectorySeparatorChar).TrimEnd(Path.DirectorySeparatorChar);
|
||||||
|
|
||||||
|
Settings.UserSaves.StoragePath = path;
|
||||||
|
}
|
||||||
|
}
|
|
@ -191,8 +191,8 @@ if (!Directory.Exists(settings.Archives.StoragePath))
|
||||||
if (!Directory.Exists("Icon"))
|
if (!Directory.Exists("Icon"))
|
||||||
Directory.CreateDirectory("Icon");
|
Directory.CreateDirectory("Icon");
|
||||||
|
|
||||||
if (!Directory.Exists("Saves"))
|
if (!Directory.Exists(settings.UserSaves.StoragePath))
|
||||||
Directory.CreateDirectory("Saves");
|
Directory.CreateDirectory(settings.UserSaves.StoragePath);
|
||||||
|
|
||||||
if (!Directory.Exists("Snippets"))
|
if (!Directory.Exists("Snippets"))
|
||||||
Directory.CreateDirectory("Snippets");
|
Directory.CreateDirectory("Snippets");
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
using LANCommander.Data;
|
using LANCommander.Data;
|
||||||
using LANCommander.Data.Models;
|
using LANCommander.Data.Models;
|
||||||
using LANCommander.Helpers;
|
using LANCommander.Helpers;
|
||||||
|
using LANCommander.Models;
|
||||||
|
|
||||||
namespace LANCommander.Services
|
namespace LANCommander.Services
|
||||||
{
|
{
|
||||||
public class GameSaveService : BaseDatabaseService<GameSave>
|
public class GameSaveService : BaseDatabaseService<GameSave>
|
||||||
{
|
{
|
||||||
private readonly SettingService SettingService;
|
private readonly LANCommanderSettings Settings;
|
||||||
|
|
||||||
public GameSaveService(DatabaseContext dbContext, IHttpContextAccessor httpContextAccessor, SettingService settingService) : base(dbContext, httpContextAccessor)
|
public GameSaveService(DatabaseContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||||
{
|
{
|
||||||
SettingService = settingService;
|
Settings = SettingService.GetSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task Delete(GameSave entity)
|
public override Task Delete(GameSave entity)
|
||||||
|
@ -36,14 +37,14 @@ namespace LANCommander.Services
|
||||||
var save = Get(gs => gs.Id == id).FirstOrDefault();
|
var save = Get(gs => gs.Id == id).FirstOrDefault();
|
||||||
|
|
||||||
if (save == null)
|
if (save == null)
|
||||||
return null;;
|
return null;
|
||||||
|
|
||||||
return GetSavePath(save);
|
return GetSavePath(save);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetSavePath(GameSave save)
|
public string GetSavePath(GameSave save)
|
||||||
{
|
{
|
||||||
return Path.Combine("Save", save.UserId.ToString(), $"{save.Id}.zip");
|
return Path.Combine(Settings.UserSaves.StoragePath, save.UserId.ToString(), $"{save.Id}.zip");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue