Skip to content

Commit a88aa29

Browse files
authored
switched site to blazor
1 parent 9a433f6 commit a88aa29

File tree

91 files changed

+1500
-3928
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1500
-3928
lines changed

BuildLauncher.sln

+18-17
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "src\Tests\Tests.cs
1414
EndProject
1515
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tools", "src\Tools\Tools.csproj", "{D1712DC4-7DDF-4FCB-A00D-F7771F03F9BB}"
1616
EndProject
17-
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "Web.Client", "Web.Client\Web.Client.esproj", "{D570BACE-EB12-489E-824E-D61008033109}"
18-
EndProject
19-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Web.Server", "Web.Server\Web.Server.csproj", "{C26F0C56-F36B-4F40-8B41-F50484CE1841}"
20-
EndProject
2117
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientCommon", "src\ClientCommon\ClientCommon.csproj", "{44EFB9C2-62DD-4F50-8FFA-AA97B83BF8B5}"
2218
EndProject
2319
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Core", "src\Avalonia\Core\Avalonia.Core.csproj", "{4FA0986B-DA87-48AC-BF8B-1D9606085F85}"
2420
EndProject
2521
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Desktop", "src\Avalonia\Desktop\Avalonia.Desktop.csproj", "{BAB09C82-3BEF-4DB4-98D3-5AD89CE93915}"
2622
EndProject
23+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Web.Blazor", "Web.Blazor\Web.Blazor.csproj", "{604FE3A0-9DD3-43E3-83D4-C456AFCE7935}"
24+
EndProject
2725
Global
2826
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2927
Debug|Any CPU = Debug|Any CPU
@@ -34,6 +32,10 @@ Global
3432
{4FA0986B-DA87-48AC-BF8B-1D9606085F85}.Debug|Any CPU.Build.0 = Debug|Any CPU
3533
{4FA0986B-DA87-48AC-BF8B-1D9606085F85}.Release|Any CPU.ActiveCfg = Release|Any CPU
3634
{4FA0986B-DA87-48AC-BF8B-1D9606085F85}.Release|Any CPU.Build.0 = Release|Any CPU
35+
{604FE3A0-9DD3-43E3-83D4-C456AFCE7935}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36+
{604FE3A0-9DD3-43E3-83D4-C456AFCE7935}.Debug|Any CPU.Build.0 = Debug|Any CPU
37+
{604FE3A0-9DD3-43E3-83D4-C456AFCE7935}.Release|Any CPU.ActiveCfg = Release|Any CPU
38+
{604FE3A0-9DD3-43E3-83D4-C456AFCE7935}.Release|Any CPU.Build.0 = Release|Any CPU
3739
{B7D765A0-7B23-474A-AA7B-E2CDC29078FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3840
{B7D765A0-7B23-474A-AA7B-E2CDC29078FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
3941
{B7D765A0-7B23-474A-AA7B-E2CDC29078FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -62,16 +64,6 @@ Global
6264
{D1712DC4-7DDF-4FCB-A00D-F7771F03F9BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
6365
{D1712DC4-7DDF-4FCB-A00D-F7771F03F9BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
6466
{D1712DC4-7DDF-4FCB-A00D-F7771F03F9BB}.Release|Any CPU.Build.0 = Release|Any CPU
65-
{D570BACE-EB12-489E-824E-D61008033109}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
66-
{D570BACE-EB12-489E-824E-D61008033109}.Debug|Any CPU.Build.0 = Debug|Any CPU
67-
{D570BACE-EB12-489E-824E-D61008033109}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
68-
{D570BACE-EB12-489E-824E-D61008033109}.Release|Any CPU.ActiveCfg = Release|Any CPU
69-
{D570BACE-EB12-489E-824E-D61008033109}.Release|Any CPU.Build.0 = Release|Any CPU
70-
{D570BACE-EB12-489E-824E-D61008033109}.Release|Any CPU.Deploy.0 = Release|Any CPU
71-
{C26F0C56-F36B-4F40-8B41-F50484CE1841}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72-
{C26F0C56-F36B-4F40-8B41-F50484CE1841}.Debug|Any CPU.Build.0 = Debug|Any CPU
73-
{C26F0C56-F36B-4F40-8B41-F50484CE1841}.Release|Any CPU.ActiveCfg = Release|Any CPU
74-
{C26F0C56-F36B-4F40-8B41-F50484CE1841}.Release|Any CPU.Build.0 = Release|Any CPU
7567
{44EFB9C2-62DD-4F50-8FFA-AA97B83BF8B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7668
{44EFB9C2-62DD-4F50-8FFA-AA97B83BF8B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
7769
{44EFB9C2-62DD-4F50-8FFA-AA97B83BF8B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -84,9 +76,17 @@ Global
8476
SolutionGuid = {48D7012C-36C8-4BB1-B61F-BE38BB907CCD}
8577
EndGlobalSection
8678
EndGlobal
87-
-A792-EB452258E92E}.Debug|Any CPU.Build.0 = Debug|Any CPU
88-
{6490431F-3AA7-4D56-A792-EB452258E92E}.Release|Any CPU.ActiveCfg = Release|Any CPU
89-
{6490431F-3AA7-4D56-A792-EB452258E92E}.Release|Any CPU.Build.0 = Release|Any CPU
79+
Release|Any CPU.ActiveCfg = Release|Any CPU
80+
{D570BACE-EB12-489E-824E-D61008033109}.Release|Any CPU.Build.0 = Release|Any CPU
81+
{D570BACE-EB12-489E-824E-D61008033109}.Release|Any CPU.Deploy.0 = Release|Any CPU
82+
{C26F0C56-F36B-4F40-8B41-F50484CE1841}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
83+
{C26F0C56-F36B-4F40-8B41-F50484CE1841}.Debug|Any CPU.Build.0 = Debug|Any CPU
84+
{C26F0C56-F36B-4F40-8B41-F50484CE1841}.Release|Any CPU.ActiveCfg = Release|Any CPU
85+
{C26F0C56-F36B-4F40-8B41-F50484CE1841}.Release|Any CPU.Build.0 = Release|Any CPU
86+
{44EFB9C2-62DD-4F50-8FFA-AA97B83BF8B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
87+
{44EFB9C2-62DD-4F50-8FFA-AA97B83BF8B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
88+
{44EFB9C2-62DD-4F50-8FFA-AA97B83BF8B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
89+
{44EFB9C2-62DD-4F50-8FFA-AA97B83BF8B5}.Release|Any CPU.Build.0 = Release|Any CPU
9090
EndGlobalSection
9191
GlobalSection(SolutionProperties) = preSolution
9292
HideSolutionNode = FALSE
@@ -95,6 +95,7 @@ EndGlobal
9595
SolutionGuid = {48D7012C-36C8-4BB1-B61F-BE38BB907CCD}
9696
EndGlobalSection
9797
EndGlobal
98+
9899
8BB907CCD}
99100
EndGlobalSection
100101
EndGlobal

Directory.Packages.props

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
2626
<PackageVersion Include="xunit" Version="2.8.1" />
2727
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
28-
<PackageVersion Include="AWSSDK.S3" Version="3.7.309.7" />
28+
<PackageVersion Include="AWSSDK.S3" Version="3.7.309.12" />
2929
<PackageVersion Include="ConfigureAwaitAnalyzer" Version="1.0.3" />
3030
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.6.2" />
3131
<PackageVersion Include="Microsoft.AspNetCore.SpaProxy" Version="8.0.6" />
32-
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
32+
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
3333
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
34+
<PackageVersion Include="Markdig" Version="0.37.0" />
3435
</ItemGroup>
3536
</Project>

Dockerfile

+7-15
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

33
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
4-
USER app
54
WORKDIR /app
65
EXPOSE 8080
76
EXPOSE 8081
87

9-
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS with-node
10-
RUN apt-get update
11-
RUN apt-get install curl
12-
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash
13-
RUN apt-get -y install nodejs
14-
15-
16-
FROM with-node AS build
8+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
179
ARG BUILD_CONFIGURATION=Release
1810
WORKDIR /src
19-
COPY ["Web.Server/Web.Server.csproj", "Web.Server/"]
20-
RUN dotnet restore "./Web.Server/Web.Server.csproj"
11+
COPY ["Web.Blazor/Web.Blazor.csproj", "Web.Blazor/"]
12+
RUN dotnet restore "./Web.Blazor/Web.Blazor.csproj"
2113
COPY . .
22-
WORKDIR "/src/Web.Server"
23-
RUN dotnet build "./Web.Server.csproj" -c $BUILD_CONFIGURATION -o /app/build
14+
WORKDIR "/src/Web.Blazor"
15+
RUN dotnet build "./Web.Blazor.csproj" -c $BUILD_CONFIGURATION -o /app/build
2416

2517
FROM build AS publish
2618
ARG BUILD_CONFIGURATION=Release
27-
RUN dotnet publish "./Web.Server.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
19+
RUN dotnet publish "./Web.Blazor.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
2820

2921
FROM base AS final
3022
WORKDIR /app
3123
COPY --from=publish /app/publish .
32-
ENTRYPOINT ["dotnet", "BuildLauncher.Web.Server.dll"]
24+
ENTRYPOINT ["dotnet", "Web.Blazor.dll"]

Web.Blazor/App.razor

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</Router>
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
@using Common.Entities
2+
@using Common.Enums
3+
@using Markdig
4+
@using Web.Blazor.Providers
5+
6+
@inject AddonsProvider AddonsProvider
7+
8+
@if (_addons == null)
9+
{
10+
<p><em>Loading...</em></p>
11+
}
12+
else
13+
{
14+
<table style="margin-left: auto; margin-right: auto; table-layout:fixed; width: 100%;">
15+
16+
<tr>
17+
<th style="padding: 15px;vertical-align:top">TCs</th>
18+
<th style="padding: 15px;vertical-align:top">Maps</th>
19+
<th style="padding: 15px;vertical-align:top">Mods</th>
20+
</tr>
21+
22+
<tr>
23+
<td style="padding: 15px;vertical-align:top">
24+
@foreach (var addon in _addons.Where(x => x.AddonType is Common.Enums.AddonTypeEnum.TC).OrderBy(x => x.Title))
25+
{
26+
if (addon.Title.Equals("Death Wish"))
27+
{
28+
<h4>@addon.Title v.@addon.Version</h4>
29+
}
30+
else
31+
{
32+
<h4>@addon.Title</h4>
33+
}
34+
35+
<br />
36+
<div>@((MarkupString)@Markdown.ToHtml(addon.Description))</div>
37+
<a href="@addon.DownloadUrl">Download</a>
38+
<br />
39+
<br />
40+
}
41+
</td>
42+
<td style="padding: 15px;vertical-align:top">
43+
@foreach (var addon in _addons.Where(x => x.AddonType is Common.Enums.AddonTypeEnum.Map).OrderBy(x => x.Title))
44+
{
45+
<h4>@addon.Title</h4>
46+
<br />
47+
<div>@((MarkupString)@Markdown.ToHtml(addon.Description))</div>
48+
<a href="@addon.DownloadUrl">Download</a>
49+
<br />
50+
<br />
51+
}
52+
</td>
53+
<td style="padding: 15px;vertical-align:top">
54+
@foreach (var addon in _addons.Where(x => x.AddonType is Common.Enums.AddonTypeEnum.Mod).OrderBy(x => x.Title))
55+
{
56+
<h4>@addon.Title</h4>
57+
<br />
58+
<div>@((MarkupString)@Markdown.ToHtml(addon.Description))</div>
59+
<a href="@addon.DownloadUrl">Download</a>
60+
<br />
61+
<br />
62+
}
63+
</td>
64+
</tr>
65+
</table>
66+
}
67+
68+
69+
@code {
70+
[Parameter]
71+
public GameEnum Game { get; set; }
72+
73+
private List<DownloadableAddonEntity>? _addons;
74+
75+
protected override void OnInitialized()
76+
{
77+
_addons = AddonsProvider.GetAddons(Game);
78+
}
79+
}

Web.Server/Controllers/AddonsController.cs Web.Blazor/Controllers/AddonsController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Common.Entities;
22
using Common.Enums;
33
using Microsoft.AspNetCore.Mvc;
4-
using Web.Server.Providers;
4+
using Web.Blazor.Providers;
55

6-
namespace Web.Server.Controllers
6+
namespace Web.Blazor.Controllers
77
{
88
[ApiController]
99
[Route("api/addons")]

Web.Server/Controllers/ReleasesController.cs Web.Blazor/Controllers/ReleasesController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Common.Entities;
22
using Common.Enums;
33
using Microsoft.AspNetCore.Mvc;
4-
using Web.Server.Providers;
4+
using Web.Blazor.Providers;
55

6-
namespace Web.Server.Controllers
6+
namespace Web.Blazor.Controllers
77
{
88
[ApiController]
99
[Route("api/releases")]

Web.Server/Controllers/StorageController.cs Web.Blazor/Controllers/StorageController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Microsoft.AspNetCore.Mvc;
22
using System.Web;
3-
using Web.Server.Helpers;
3+
using Web.Blazor.Helpers;
44

5-
namespace Web.Server.Controllers
5+
namespace Web.Blazor.Controllers
66
{
77
[ApiController]
88
[Route("api/storage")]

Web.Server/Database/DatabaseContext.cs Web.Blazor/Database/DatabaseContext.cs

+16-14
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
using Common.Enums;
33
using Microsoft.EntityFrameworkCore;
44
using System.Text.Json;
5-
using Web.Server.DbEntities;
6-
using Web.Server.Helpers;
5+
using Web.Blazor.DbEntities;
6+
using Web.Blazor.Helpers;
77

8-
namespace Web.Server.Database
8+
namespace Web.Blazor.Database
99
{
1010
public sealed class DatabaseContext : DbContext
1111
{
@@ -26,7 +26,7 @@ public DatabaseContext()
2626
{
2727
if (!_isRunOnce)
2828
{
29-
Database.EnsureDeleted();
29+
//Database.EnsureDeleted();
3030
_isRunOnce = true;
3131
}
3232
}
@@ -41,16 +41,18 @@ public DatabaseContext()
4141

4242
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
4343
{
44-
#if DEBUG
45-
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=buildlauncher;Username=postgres;Password=123;Include Error Detail=True");
46-
#else
47-
48-
string dbip = Environment.GetEnvironmentVariable("DbIp")!;
49-
string dbport = Environment.GetEnvironmentVariable("DbPort")!;
50-
string user = Environment.GetEnvironmentVariable("DbUser")!;
51-
string password = Environment.GetEnvironmentVariable("DbPass")!;
52-
optionsBuilder.UseNpgsql($"Host={dbip};Port={dbport};Database=buildlauncher;Username={user};Password={password}");
53-
#endif
44+
if (ServerProperties.IsDevMode)
45+
{
46+
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=buildlauncher;Username=postgres;Password=123;Include Error Detail=True");
47+
}
48+
else
49+
{
50+
var dbip = Environment.GetEnvironmentVariable("DbIp")!;
51+
var dbport = Environment.GetEnvironmentVariable("DbPort")!;
52+
var user = Environment.GetEnvironmentVariable("DbUser")!;
53+
var password = Environment.GetEnvironmentVariable("DbPass")!;
54+
optionsBuilder.UseNpgsql($"Host={dbip};Port={dbport};Database=buildlauncher;Username={user};Password={password}");
55+
}
5456
}
5557

5658
[Obsolete]

Web.Server/DbEntities/AddonTypeDbEntity.cs Web.Blazor/DbEntities/AddonTypeDbEntity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.ComponentModel.DataAnnotations;
22
using System.ComponentModel.DataAnnotations.Schema;
33

4-
namespace Web.Server.DbEntities
4+
namespace Web.Blazor.DbEntities
55
{
66
[Table(name: "addon_type", Schema = "main")]
77
public sealed class AddonTypeDbEntity

Web.Server/DbEntities/AddonsDbEntity.cs Web.Blazor/DbEntities/AddonsDbEntity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.ComponentModel.DataAnnotations;
33
using System.ComponentModel.DataAnnotations.Schema;
44

5-
namespace Web.Server.DbEntities
5+
namespace Web.Blazor.DbEntities
66
{
77
[Index(nameof(GameId))]
88
[Index(nameof(AddonType))]

Web.Server/DbEntities/DependenciesDbEntity.cs Web.Blazor/DbEntities/DependenciesDbEntity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.ComponentModel.DataAnnotations;
33
using System.ComponentModel.DataAnnotations.Schema;
44

5-
namespace Web.Server.DbEntities
5+
namespace Web.Blazor.DbEntities
66
{
77
[Index(nameof(AddonVersionId))]
88
[Table(name: "dependencies", Schema = "main")]

Web.Server/DbEntities/GamesDbEntity.cs Web.Blazor/DbEntities/GamesDbEntity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.ComponentModel.DataAnnotations;
33
using System.ComponentModel.DataAnnotations.Schema;
44

5-
namespace Web.Server.DbEntities
5+
namespace Web.Blazor.DbEntities
66
{
77
[Index(nameof(Name))]
88
[Table(name: "games", Schema = "main")]

Web.Server/DbEntities/InstallsDbEntity.cs Web.Blazor/DbEntities/InstallsDbEntity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.ComponentModel.DataAnnotations;
22
using System.ComponentModel.DataAnnotations.Schema;
33

4-
namespace Web.Server.DbEntities
4+
namespace Web.Blazor.DbEntities
55
{
66
[Table(name: "installs", Schema = "main")]
77
public sealed class InstallsDbEntity

Web.Server/DbEntities/RatingsDbEntity.cs Web.Blazor/DbEntities/RatingsDbEntity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.ComponentModel.DataAnnotations;
33
using System.ComponentModel.DataAnnotations.Schema;
44

5-
namespace Web.Server.DbEntities
5+
namespace Web.Blazor.DbEntities
66
{
77
[Table(name: "ratings", Schema = "main")]
88
public sealed class RatingsDbEntity

Web.Server/DbEntities/ReportsDbEntity.cs Web.Blazor/DbEntities/ReportsDbEntity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.ComponentModel.DataAnnotations;
33
using System.ComponentModel.DataAnnotations.Schema;
44

5-
namespace Web.Server.DbEntities
5+
namespace Web.Blazor.DbEntities
66
{
77
[Index(nameof(AddonId))]
88
[Table(name: "reports", Schema = "main")]

Web.Server/DbEntities/VersionsDbEntity.cs Web.Blazor/DbEntities/VersionsDbEntity.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.ComponentModel.DataAnnotations;
44
using System.ComponentModel.DataAnnotations.Schema;
55

6-
namespace Web.Server.DbEntities
6+
namespace Web.Blazor.DbEntities
77
{
88
[Index(nameof(AddonId))]
99
[Table(name: "versions", Schema = "main")]

Web.Server/Helpers/DatabaseContextFactory.cs Web.Blazor/Helpers/DatabaseContextFactory.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using Web.Server.Database;
1+
using Web.Blazor.Database;
22

3-
namespace Web.Server.Helpers
3+
namespace Web.Blazor.Helpers
44
{
55
public class DatabaseContextFactory
66
{

0 commit comments

Comments
 (0)