move all the deployment setup into 2.4 pr (#85)

* don't run build commands in release

* fix test file

* Set up CI with Azure Pipelines

[skip ci]

* Include fonts and fix automessage hidden command

* more project changes

* migration from bower to libman

* more lib man changes

* project update for sneaky commands

* add missing canvas.js dep
update projects not to have stupid extra dlls

include in previous

* update pipeline file

* update post publish script and pipeline definition

* fix broken yaml

* move encoding conversion to seperate script

* remove extra uneeded rank icons
remove garbage language files being created
remove frontend lib when done

* fix publish script path

* grab localizations through powershell

* fix broken batch 🤷

* actually fixed

* only include runtime compilation in debug mode for webfront

* don't deploy un minified css
use full jquery version

* add step to download the scss for open iconic
change the font path

* update mkdir for iconic path

* don't include old iconic css

* correct font path for real now

* copy script plugins

* lots of changes for deployment

* build the projects

* use projectdir instead of solution dir

* nerf script commands plugin
fix live radar left over command

* actually kill script command post build

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* fix the font file copy (I think)

* maybe fix delete folder issue

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines
This commit is contained in:
RaidMax 2019-12-02 15:52:36 -06:00 committed by GitHub
parent 56008e80c7
commit 3defd3f486
150 changed files with 5482 additions and 1251 deletions

3
.gitignore vendored
View File

@ -236,5 +236,4 @@ launchSettings.json
/Plugins/ScriptPlugins/VpnDetectionPrivate.js /Plugins/ScriptPlugins/VpnDetectionPrivate.js
**/Master/env_master **/Master/env_master
/GameLogServer/log_env /GameLogServer/log_env
/WebfrontCore/wwwroot/css/main.min.css **/*.css
/WebfrontCore/wwwroot/css/main.css

View File

@ -28,6 +28,7 @@
<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="Microsoft.Extensions.DependencyInjection" Version="3.0.1" />
<PackageReference Include="RestEase" Version="1.4.10" /> <PackageReference Include="RestEase" Version="1.4.10" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0" />
</ItemGroup> </ItemGroup>
@ -39,7 +40,7 @@
<AssemblyVersion>2.3.1.0</AssemblyVersion> <AssemblyVersion>2.3.1.0</AssemblyVersion>
<FileVersion>2.3.1.0</FileVersion> <FileVersion>2.3.1.0</FileVersion>
<LangVersion>7.1</LangVersion> <LangVersion>7.1</LangVersion>
<StartupObject /> <StartupObject></StartupObject>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
@ -52,10 +53,7 @@
<ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj"> <ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>true</Private> <Private>true</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\WebfrontCore\WebfrontCore.csproj"> <ProjectReference Include="..\WebfrontCore\WebfrontCore.csproj" />
<Private>true</Private>
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -65,17 +63,17 @@
</ItemGroup> </ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="call $(ProjectDir)BuildScripts\PreBuild.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(OutDir)" /> <Exec Command="if $(ConfigurationName) == Debug call $(ProjectDir)BuildScripts\PreBuild.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(OutDir)" />
</Target> </Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="CurrentAssembly" /> <Output TaskParameter="Assemblies" ItemName="CurrentAssembly" />
</GetAssemblyIdentity> </GetAssemblyIdentity>
<Exec Command="call $(ProjectDir)BuildScripts\PostBuild.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(OutDir) %(CurrentAssembly.Version)" /> <Exec Command="if $(ConfigurationName) == Debug call $(ProjectDir)BuildScripts\PostBuild.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(OutDir) %25(CurrentAssembly.Version)" />
</Target> </Target>
<Target Name="PostPublish" AfterTargets="Publish"> <Target Name="PostPublish" AfterTargets="Publish">
<Exec Command="call $(ProjectDir)BuildScripts\PostPublish.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(ConfigurationName)" /> <Exec Command="if $(ConfigurationName) == Debug call $(ProjectDir)BuildScripts\PostPublish.bat $(ProjectDir)..\ $(ProjectDir) $(TargetDir) $(ConfigurationName)" />
</Target> </Target>
</Project> </Project>

View File

@ -1,129 +1,42 @@
set SolutionDir=%1 set PublishDir=%1
set ProjectDir=%2 set SourceDir=%2
set TargetDir=%3
set CurrentConfiguration=%4
SET COPYCMD=/Y SET COPYCMD=/Y
echo Deleting extra language files echo deleting extra runtime files
if exist "%PublishDir%\runtimes\linux-arm" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\linux-arm'
if exist "%PublishDir%\runtimes\linux-arm64" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\linux-arm64'
if exist "%PublishDir%\runtimes\linux-armel" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\linux-armel'
if exist "%PublishDir%\runtimes\osx" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\osx'
if exist "%PublishDir%\runtimes\osx-x64" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\osx-x64'
if exist "%PublishDir%\runtimes\win-arm" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\win-arm'
if exist "%PublishDir%\runtimes\win-arm64" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\win-arm64'
if exist "%PublishDir%\runtimes\alpine-x64" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\alpine-x64'
if exist "%PublishDir%\runtimes\linux-musl-x64" powershell Remove-Item -Force -Recurse '%PublishDir%\runtimes\linux-musl-x64'
if exist "%SolutionDir%Publish\Windows\en-US\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\en-US' echo deleting misc files
if exist "%SolutionDir%Publish\Windows\de\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\de' if exist "%PublishDir%\web.config" del "%PublishDir%\web.config"
if exist "%SolutionDir%Publish\Windows\es\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\es' if exist "%PublishDir%\libman.json" del "%PublishDir%\libman.json"
if exist "%SolutionDir%Publish\Windows\fr\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\fr' del "%PublishDir%\*.exe"
if exist "%SolutionDir%Publish\Windows\it\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\it' del "%PublishDir%\*.pdb"
if exist "%SolutionDir%Publish\Windows\ja\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\ja'
if exist "%SolutionDir%Publish\Windows\ko\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\ko'
if exist "%SolutionDir%Publish\Windows\ru\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\ru'
if exist "%SolutionDir%Publish\Windows\zh-Hans\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\zh-Hans'
if exist "%SolutionDir%Publish\Windows\zh-Hant\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\zh-Hant'
if exist "%SolutionDir%Publish\Windows\cs\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\cs'
if exist "%SolutionDir%Publish\Windows\pl\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\pl'
if exist "%SolutionDir%Publish\Windows\tr\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\tr'
if exist "%SolutionDir%Publish\Windows\pt-BR\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\pt-BR'
if exist "%SolutionDir%Publish\WindowsPrerelease\en-US\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\en-US' echo setting up default folders
if exist "%SolutionDir%Publish\WindowsPrerelease\de\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\de' if not exist "%PublishDir%\Configuration" md "%PublishDir%\Configuration"
if exist "%SolutionDir%Publish\WindowsPrerelease\es\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\es' move "%PublishDir%\DefaultSettings.json" "%PublishDir%\Configuration\"
if exist "%SolutionDir%Publish\WindowsPrerelease\fr\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\fr' if not exist "%PublishDir%\Lib\" md "%PublishDir%\Lib\"
if exist "%SolutionDir%Publish\WindowsPrerelease\it\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\it' move "%PublishDir%\*.dll" "%PublishDir%\Lib\"
if exist "%SolutionDir%Publish\WindowsPrerelease\ja\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\ja' move "%PublishDir%\*.json" "%PublishDir%\Lib\"
if exist "%SolutionDir%Publish\WindowsPrerelease\ko\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\ko' move "%PublishDir%\runtimes" "%PublishDir%\Lib\runtimes"
if exist "%SolutionDir%Publish\WindowsPrerelease\ru\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\ru' if exist "%PublishDir%\refs" move "%PublishDir%\refs" "%PublishDir%\Lib\refs"
if exist "%SolutionDir%Publish\WindowsPrerelease\zh-Hans\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\zh-Hans' if not exist "%PublishDir%\Localization" md "%PublishDir%\Localization"
if exist "%SolutionDir%Publish\WindowsPrerelease\zh-Hant\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\zh-Hant'
if exist "%SolutionDir%Publish\WindowsPrerelease\cs\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\cs'
if exist "%SolutionDir%Publish\WindowsPrerelease\pl\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\pl'
if exist "%SolutionDir%Publish\WindowsPrerelease\tr\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\tr'
if exist "%SolutionDir%Publish\WindowsPrerelease\pt-BR\" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\pt-BR'
echo Deleting extra runtime files
if exist "%SolutionDir%Publish\Windows\runtimes\linux-arm" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\linux-arm'
if exist "%SolutionDir%Publish\Windows\runtimes\linux-arm64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\linux-arm64'
if exist "%SolutionDir%Publish\Windows\runtimes\linux-armel" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\linux-armel'
if exist "%SolutionDir%Publish\Windows\runtimes\osx" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\osx'
if exist "%SolutionDir%Publish\Windows\runtimes\osx-x64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\osx-x64'
if exist "%SolutionDir%Publish\Windows\runtimes\win-arm" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\win-arm'
if exist "%SolutionDir%Publish\Windows\runtimes\win-arm64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\Windows\runtimes\win-arm64'
if exist "%SolutionDir%Publish\WindowsPrerelease\runtimes\linux-arm" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\runtimes\linux-arm'
if exist "%SolutionDir%Publish\WindowsPrerelease\runtimes\linux-arm64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\runtimes\linux-arm64'
if exist "%SolutionDir%Publish\WindowsPrerelease\runtimes\linux-armel" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\runtimes\linux-armel'
if exist "%SolutionDir%Publish\WindowsPrerelease\runtimes\osx" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\runtimes\osx'
if exist "%SolutionDir%Publish\WindowsPrerelease\runtimes\osx-x64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\runtimes\osx-x64'
if exist "%SolutionDir%Publish\WindowsPrerelease\runtimes\win-arm" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\runtimes\win-arm'
if exist "%SolutionDir%Publish\WindowsPrerelease\runtimes\win-arm64" powershell Remove-Item -Force -Recurse '%SolutionDir%Publish\WindowsPrerelease\runtimes\win-arm64'
echo Deleting misc files
if exist "%SolutionDir%Publish\Windows\web.config" del "%SolutionDir%Publish\Windows\web.config"
del "%SolutionDir%Publish\Windows\*pdb"
if exist "%SolutionDir%Publish\WindowsPrerelease\web.config" del "%SolutionDir%Publish\WindowsPrerelease\web.config"
del "%SolutionDir%Publish\WindowsPrerelease\*pdb"
echo setting up library folders
if "%CurrentConfiguration%" == "Prerelease" (
echo PR-Config
if not exist "%SolutionDir%Publish\WindowsPrerelease\Configuration" md "%SolutionDir%Publish\WindowsPrerelease\Configuration"
move "%SolutionDir%Publish\WindowsPrerelease\DefaultSettings.json" "%SolutionDir%Publish\WindowsPrerelease\Configuration\"
)
if "%CurrentConfiguration%" == "Release" (
echo R-Config
if not exist "%SolutionDir%Publish\Windows\Configuration" md "%SolutionDir%Publish\Windows\Configuration"
if exist "%SolutionDir%Publish\Windows\DefaultSettings.json" move "%SolutionDir%Publish\Windows\DefaultSettings.json" "%SolutionDir%Publish\Windows\Configuration\DefaultSettings.json"
)
if "%CurrentConfiguration%" == "Prerelease" (
echo PR-LIB
if not exist "%SolutionDir%Publish\WindowsPrerelease\Lib\" md "%SolutionDir%Publish\WindowsPrerelease\Lib\"
move "%SolutionDir%Publish\WindowsPrerelease\*.dll" "%SolutionDir%Publish\WindowsPrerelease\Lib\"
move "%SolutionDir%Publish\WindowsPrerelease\*.json" "%SolutionDir%Publish\WindowsPrerelease\Lib\"
)
if "%CurrentConfiguration%" == "Release" (
echo R-LIB
if not exist "%SolutionDir%Publish\Windows\Lib\" md "%SolutionDir%Publish\Windows\Lib\"
move "%SolutionDir%Publish\Windows\*.dll" "%SolutionDir%Publish\Windows\Lib\"
move "%SolutionDir%Publish\Windows\*.json" "%SolutionDir%Publish\Windows\Lib\"
)
if "%CurrentConfiguration%" == "Prerelease" (
echo PR-RT
move "%SolutionDir%Publish\WindowsPrerelease\runtimes" "%SolutionDir%Publish\WindowsPrerelease\Lib\runtimes"
if exist "%SolutionDir%Publish\WindowsPrerelease\refs" move "%SolutionDir%Publish\WindowsPrerelease\refs" "%SolutionDir%Publish\WindowsPrerelease\Lib\refs"
)
if "%CurrentConfiguration%" == "Release" (
echo R-RT
move "%SolutionDir%Publish\Windows\runtimes" "%SolutionDir%Publish\Windows\Lib\runtimes"
if exist "%SolutionDir%Publish\Windows\refs" move "%SolutionDir%Publish\Windows\refs" "%SolutionDir%Publish\Windows\Lib\refs"
)
if "%CurrentConfiguration%" == "Prerelease" (
echo PR-LOC
if not exist "%SolutionDir%Publish\WindowsPrerelease\Localization" md "%SolutionDir%Publish\WindowsPrerelease\Localization"
)
if "%CurrentConfiguration%" == "Release" (
echo R-LOC
if not exist "%SolutionDir%Publish\Windows\Localization" md "%SolutionDir%Publish\Windows\Localization"
)
echo making start scripts echo making start scripts
@(echo @echo off && echo @title IW4MAdmin && echo set DOTNET_CLI_TELEMETRY_OPTOUT=1 && echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.cmd" @(echo @echo off && echo @title IW4MAdmin && echo set DOTNET_CLI_TELEMETRY_OPTOUT=1 && echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%PublishDir%\StartIW4MAdmin.cmd"
@(echo @echo off && echo @title IW4MAdmin && echo set DOTNET_CLI_TELEMETRY_OPTOUT=1 && echo dotnet Lib\IW4MAdmin.dll && echo pause) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.cmd" @(echo #!/bin/bash&& echo export DOTNET_CLI_TELEMETRY_OPTOUT=1&& echo dotnet Lib/IW4MAdmin.dll) > "%PublishDir%\StartIW4MAdmin.sh"
@(echo #!/bin/bash&& echo export DOTNET_CLI_TELEMETRY_OPTOUT=1&& echo dotnet Lib/IW4MAdmin.dll) > "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.sh" echo moving front-end library dependencies
dos2unix "%SolutionDir%Publish\WindowsPrerelease\StartIW4MAdmin.sh" if not exist "%PublishDir%\wwwroot\font" mkdir "%PublishDir%\wwwroot\font"
@(echo #!/bin/bash&& echo export DOTNET_CLI_TELEMETRY_OPTOUT=1&& echo dotnet Lib/IW4MAdmin.dll) > "%SolutionDir%Publish\Windows\StartIW4MAdmin.sh" move "WebfrontCore\wwwroot\lib\open-iconic\font\fonts\*.*" "%PublishDir%\wwwroot\font\"
dos2unix "%SolutionDir%Publish\Windows\StartIW4MAdmin.sh" if exist "%PublishDir%\wwwroot\lib" rd /s /q "%PublishDir%\wwwroot\lib"
echo setting permissions... echo setting permissions...
cacls "%SolutionDir%Publish\WindowsPrerelease" /t /e /p Everyone:F cacls "%PublishDir%" /t /e /p Everyone:F
cacls "%SolutionDir%Publish\Windows" /t /e /p Everyone:F

View File

@ -1,5 +1,7 @@
using IW4MAdmin.Application.Migration; using IW4MAdmin.Application.Migration;
using Microsoft.Extensions.DependencyInjection;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using System; using System;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
@ -66,6 +68,7 @@ namespace IW4MAdmin.Application
ServerManager.Logger.WriteInfo(Utilities.CurrentLocalization.LocalizationIndex["MANAGER_VERSION"].FormatExt(Version)); ServerManager.Logger.WriteInfo(Utilities.CurrentLocalization.LocalizationIndex["MANAGER_VERSION"].FormatExt(Version));
ConfigureServices();
await CheckVersion(); await CheckVersion();
await ServerManager.Init(); await ServerManager.Init();
} }
@ -230,5 +233,12 @@ namespace IW4MAdmin.Application
catch (OperationCanceledException) catch (OperationCanceledException)
{ } { }
} }
private static void ConfigureServices()
{
//var serviceProvider = new ServiceCollection();
//serviceProvider.AddSingleton<IManager>(ServerManager);
//serviceProvider.BuildServiceProvider();
}
} }
} }

View File

@ -8,6 +8,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
_commands.gsc = _commands.gsc _commands.gsc = _commands.gsc
_customcallbacks.gsc = _customcallbacks.gsc _customcallbacks.gsc = _customcallbacks.gsc
azure-pipelines.yml = azure-pipelines.yml
PostPublish.ps1 = PostPublish.ps1
README.md = README.md README.md = README.md
RunPublishPre.cmd = RunPublishPre.cmd RunPublishPre.cmd = RunPublishPre.cmd
RunPublishRelease.cmd = RunPublishRelease.cmd RunPublishRelease.cmd = RunPublishRelease.cmd
@ -286,7 +288,6 @@ Global
{B72DEBFB-9D48-4076-8FF5-1FD72A830845}.Release|x86.ActiveCfg = Release|Any CPU {B72DEBFB-9D48-4076-8FF5-1FD72A830845}.Release|x86.ActiveCfg = Release|Any CPU
{B72DEBFB-9D48-4076-8FF5-1FD72A830845}.Release|x86.Build.0 = Release|Any CPU {B72DEBFB-9D48-4076-8FF5-1FD72A830845}.Release|x86.Build.0 = Release|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|x64.ActiveCfg = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -294,7 +295,6 @@ Global
{6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|x86.ActiveCfg = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|x86.ActiveCfg = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|x86.Build.0 = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Debug|x86.Build.0 = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|Any CPU.ActiveCfg = Prerelease|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|Any CPU.ActiveCfg = Prerelease|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|Any CPU.Build.0 = Prerelease|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|Mixed Platforms.ActiveCfg = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|Mixed Platforms.Build.0 = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|Mixed Platforms.Build.0 = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|x64.ActiveCfg = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|x64.ActiveCfg = Debug|Any CPU
@ -302,7 +302,6 @@ Global
{6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|x86.ActiveCfg = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|x86.ActiveCfg = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|x86.Build.0 = Debug|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Prerelease|x86.Build.0 = Debug|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Release|Any CPU.ActiveCfg = Release|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Release|Any CPU.Build.0 = Release|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Release|Mixed Platforms.Build.0 = Release|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6C706CE5-A206-4E46-8712-F8C48D526091}.Release|x64.ActiveCfg = Release|Any CPU {6C706CE5-A206-4E46-8712-F8C48D526091}.Release|x64.ActiveCfg = Release|Any CPU

View File

@ -2,25 +2,19 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<LangVersion>7.1</LangVersion> <LangVersion>7.1</LangVersion>
<Configurations>Debug;Release;Prerelease</Configurations> <Configurations>Debug;Release;Prerelease</Configurations>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" /> <PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" />
</ItemGroup> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2.2.3" PrivateAssets="All" />
<ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="dotnet publish $(ProjectPath) -c $(ConfigurationName) -o $(ProjectDir)..\..\Build\Plugins --no-build --no-restore --no-dependencies" />
<Exec Command="copy &quot;$(TargetDir)Microsoft.SyndicationFeed.ReaderWriter.dll&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" />
</Target> </Target>
</Project> </Project>

View File

@ -1,4 +1,5 @@
using SharedLibraryCore; /*
using SharedLibraryCore;
using SharedLibraryCore.Database.Models; using SharedLibraryCore.Database.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -197,3 +198,4 @@ namespace IW4ScriptCommands.Commands
} }
} }
} }
*/

View File

@ -1,4 +1,4 @@
using IW4ScriptCommands.Commands; /*using IW4ScriptCommands.Commands;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore; using SharedLibraryCore;
using System; using System;
@ -51,3 +51,4 @@ namespace WebfrontCore.Controllers.API
} }
} }
} }
*/

View File

@ -9,10 +9,6 @@
<LangVersion>7.1</LangVersion> <LangVersion>7.1</LangVersion>
</PropertyGroup> </PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" />
</Target>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj"> <ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private> <Private>false</Private>

View File

@ -1,4 +1,4 @@
using SharedLibraryCore; /*using SharedLibraryCore;
using SharedLibraryCore.Interfaces; using SharedLibraryCore.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -47,3 +47,4 @@ namespace IW4ScriptCommands
public Task OnUnloadAsync() => Task.CompletedTask; public Task OnUnloadAsync() => Task.CompletedTask;
} }
} }
*/

View File

@ -2,8 +2,8 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using System.Linq; using System.Linq;
using WebfrontCore.Controllers;
namespace LiveRadar.Web.Controllers namespace LiveRadar.Web.Controllers
{ {
@ -15,14 +15,21 @@ namespace LiveRadar.Web.Controllers
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
}; };
private readonly IManager _manager;
public RadarController(IManager manager) : base(manager)
{
_manager = manager;
}
[HttpGet] [HttpGet]
[Route("Radar/{serverId}")] [Route("Radar/{serverId}")]
public IActionResult Index(long? serverId = null) public IActionResult Index(long? serverId = null)
{ {
ViewBag.IsFluid = true; ViewBag.IsFluid = true;
ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_RADAR_TITLE"]; ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_RADAR_TITLE"];
ViewBag.ActiveServerId = serverId ?? Manager.GetServers().FirstOrDefault()?.EndPoint; ViewBag.ActiveServerId = serverId ?? _manager.GetServers().FirstOrDefault()?.EndPoint;
ViewBag.Servers = Manager.GetServers() ViewBag.Servers = _manager.GetServers()
.Where(_server => _server.GameName == Server.Game.IW4) .Where(_server => _server.GameName == Server.Game.IW4)
.Select(_server => new ServerInfo() .Select(_server => new ServerInfo()
{ {
@ -37,7 +44,7 @@ namespace LiveRadar.Web.Controllers
[Route("Radar/{serverId}/Map")] [Route("Radar/{serverId}/Map")]
public IActionResult Map(long? serverId = null) public IActionResult Map(long? serverId = null)
{ {
var server = serverId == null ? Manager.GetServers().FirstOrDefault() : Manager.GetServers().FirstOrDefault(_server => _server.EndPoint == serverId); var server = serverId == null ? _manager.GetServers().FirstOrDefault() : _manager.GetServers().FirstOrDefault(_server => _server.EndPoint == serverId);
var map = Plugin.Config.Configuration().Maps.FirstOrDefault(_map => _map.Name == server.CurrentMap.Name); var map = Plugin.Config.Configuration().Maps.FirstOrDefault(_map => _map.Name == server.CurrentMap.Name);
if (map != null) if (map != null)
@ -55,7 +62,7 @@ namespace LiveRadar.Web.Controllers
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Data(long? serverId = null) public IActionResult Data(long? serverId = null)
{ {
var server = serverId == null ? Manager.GetServers()[0] : Manager.GetServers().First(_server => _server.EndPoint == serverId); var server = serverId == null ? _manager.GetServers()[0] : _manager.GetServers().First(_server => _server.EndPoint == serverId);
var radarInfo = server.GetClientsAsList().Select(_client => _client.GetAdditionalProperty<RadarEvent>("LiveRadar")).ToList(); var radarInfo = server.GetClientsAsList().Select(_client => _client.GetAdditionalProperty<RadarEvent>("LiveRadar")).ToList();
return Json(radarInfo); return Json(radarInfo);
} }
@ -65,7 +72,7 @@ namespace LiveRadar.Web.Controllers
public IActionResult Update(string payload) public IActionResult Update(string payload)
{ {
var radarUpdate = RadarEvent.Parse(payload); var radarUpdate = RadarEvent.Parse(payload);
var client = Manager.GetActiveClients().FirstOrDefault(_client => _client.NetworkId == radarUpdate.Guid); var client = _manager.GetActiveClients().FirstOrDefault(_client => _client.NetworkId == radarUpdate.Guid);
if (client != null) if (client != null)
{ {

View File

@ -1,20 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk.Razor"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild> <RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild>
<RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish> <RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish>
<PreserveCompilationContext Condition="'$(CONFIG)'!='Debug'">false</PreserveCompilationContext>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc> <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<Version>0.1.0.0</Version> <Version>0.1.0.0</Version>
<Configurations>Debug;Release;Prerelease</Configurations> <Configurations>Debug;Release;Prerelease</Configurations>
<LangVersion>7.1</LangVersion> <LangVersion>7.1</LangVersion>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj"> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2.2.3" PrivateAssets="All" />
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\WebfrontCore\WebfrontCore.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -24,11 +26,7 @@
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;&#xD;&#xA;copy &quot;$(TargetDir)$(TargetName).Views$(TargetExt)&quot; $(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="dotnet publish $(ProjectPath) -c $(ConfigurationName) -o $(ProjectDir)..\..\Build\Plugins --no-build --no-restore --no-dependencies" />
</Target>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="xcopy /S /E /H /Y /I &quot;$(ProjectDir)Views\Radar&quot; &quot;$(SolutionDir)WebfrontCore\Views\Plugins\Radar&quot;&#xD;&#xA;xcopy /S /E /H /Y /I &quot;$(ProjectDir)wwwroot\images&quot; &quot;$(SolutionDir)WebfrontCore\wwwroot\images\radar&quot;" />
</Target> </Target>
</Project> </Project>

View File

@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<ApplicationIcon /> <ApplicationIcon />
<StartupObject /> <StartupObject />
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<PackageId>RaidMax.IW4MAdmin.Plugins.Login</PackageId> <PackageId>RaidMax.IW4MAdmin.Plugins.Login</PackageId>
<Authors>RaidMax</Authors> <Authors>RaidMax</Authors>
<Company>Forever None</Company> <Company>Forever None</Company>
@ -17,14 +18,12 @@
<DefineConstants>TRACE;DEBUG;NETCOREAPP2_0</DefineConstants> <DefineConstants>TRACE;DEBUG;NETCOREAPP2_0</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="dotnet publish $(ProjectPath) -c $(ConfigurationName) -o $(ProjectDir)..\..\Build\Plugins --no-build --no-restore --no-dependencies" />
</Target> </Target>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2.2.3" PrivateAssets="All" />
</ItemGroup>
</Project> </Project>

View File

@ -16,13 +16,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj"> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2.2.3" PrivateAssets="All" />
<Private>false</Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="dotnet publish $(ProjectPath) -c $(ConfigurationName) -o $(ProjectDir)..\..\Build\Plugins --no-build --no-restore --no-dependencies" />
</Target> </Target>
</Project> </Project>

View File

@ -98,9 +98,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
.OrderByDescending(c => c.Performance) .OrderByDescending(c => c.Performance)
.Skip(start) .Skip(start)
.Take(count); .Take(count);
#if DEBUG == true
var clientRatingsSql = iqClientRatings.ToSql();
#endif
// materialized list // materialized list
var clientRatings = await iqClientRatings.ToListAsync(); var clientRatings = await iqClientRatings.ToListAsync();
@ -121,10 +119,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
rating.When rating.When
}; };
#if DEBUG == true
var ratingQuery = iqRatingInfo.ToSql();
#endif
var ratingInfo = (await iqRatingInfo.ToListAsync()) var ratingInfo = (await iqRatingInfo.ToListAsync())
.GroupBy(r => r.ClientId) .GroupBy(r => r.ClientId)
.Select(grp => new .Select(grp => new

View File

@ -16,15 +16,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj"> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2.2.3" PrivateAssets="All" />
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\WebfrontCore\WebfrontCore.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="dotnet publish $(ProjectPath) -c $(ConfigurationName) -o $(ProjectDir)..\..\Build\Plugins --no-build --no-restore --no-dependencies" />
</Target> </Target>
</Project> </Project>

View File

@ -14,7 +14,7 @@ namespace Tests
public override string Version => "test"; public override string Version => "test";
public override async Task<List<EFClient>> GetStatusAsync(Connection connection) public override async Task<(List<EFClient>, string)> GetStatusAsync(Connection connection)
{ {
var clientList = new List<EFClient>(); var clientList = new List<EFClient>();
@ -32,7 +32,7 @@ namespace Tests
}); });
} }
return clientList.Count > 0 ? clientList : FakeClients; return clientList.Count > 0 ? (clientList, "mp_rust") : (FakeClients, "mp_rust");
} }
} }
} }

View File

@ -1,24 +1,32 @@
using IW4MAdmin.Plugins.Stats.Helpers; using IW4MAdmin.Plugins.Stats;
using IW4MAdmin.Plugins.Stats.Helpers;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using System; using System;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using WebfrontCore.Controllers;
namespace IW4MAdmin.Plugins.Stats.Web.Controllers namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers
{ {
public class StatsController : BaseController public class StatsController : BaseController
{ {
private readonly IManager _manager;
public StatsController(IManager manager) : base(manager)
{
_manager = manager;
}
[HttpGet] [HttpGet]
public IActionResult TopPlayersAsync() public IActionResult TopPlayersAsync()
{ {
ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_STATS_INDEX_TITLE"]; ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_STATS_INDEX_TITLE"];
ViewBag.Description = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_STATS_INDEX_DESC"]; ViewBag.Description = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_STATS_INDEX_DESC"];
ViewBag.Servers = Manager.GetServers().Select(_server => new ServerInfo() { Name = _server.Hostname, ID = _server.EndPoint }); ViewBag.Servers = _manager.GetServers().Select(_server => new ServerInfo() { Name = _server.Hostname, ID = _server.EndPoint });
return View("Index"); return View("Index");
} }
@ -32,7 +40,7 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
serverId = null; serverId = null;
} }
var server = Manager.GetServers().FirstOrDefault(_server => _server.EndPoint == serverId); var server = _manager.GetServers().FirstOrDefault(_server => _server.EndPoint == serverId);
if (server != null) if (server != null)
{ {
@ -62,7 +70,7 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
using (var ctx = new SharedLibraryCore.Database.DatabaseContext(true)) using (var ctx = new SharedLibraryCore.Database.DatabaseContext(true))
{ {
var iqMessages = from message in ctx.Set<Models.EFClientMessage>() var iqMessages = from message in ctx.Set<Stats.Models.EFClientMessage>()
where message.ServerId == serverId where message.ServerId == serverId
where message.TimeSent >= whenLower where message.TimeSent >= whenLower
where message.TimeSent <= whenUpper where message.TimeSent <= whenUpper
@ -75,9 +83,6 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
ServerGame = message.Server.GameName ?? Server.Game.IW4 ServerGame = message.Server.GameName ?? Server.Game.IW4
}; };
#if DEBUG == true
var messagesSql = iqMessages.ToSql();
#endif
var messages = await iqMessages.ToListAsync(); var messages = await iqMessages.ToListAsync();
foreach (var message in messages) foreach (var message in messages)
@ -86,7 +91,7 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
{ {
try try
{ {
var quickMessages = Manager.GetApplicationSettings().Configuration() var quickMessages = _manager.GetApplicationSettings().Configuration()
.QuickMessages .QuickMessages
.First(_qm => _qm.Game == message.ServerGame); .First(_qm => _qm.Game == message.ServerGame);
message.Message = quickMessages.Messages[message.Message.Substring(1)]; message.Message = quickMessages.Messages[message.Message.Substring(1)];
@ -110,7 +115,7 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
.Select(_penalty => new { _penalty.OffenderId, _penalty.PenaltyId, _penalty.When, _penalty.AutomatedOffense }) .Select(_penalty => new { _penalty.OffenderId, _penalty.PenaltyId, _penalty.When, _penalty.AutomatedOffense })
.FirstOrDefaultAsync(_penalty => _penalty.PenaltyId == penaltyId); .FirstOrDefaultAsync(_penalty => _penalty.PenaltyId == penaltyId);
var iqSnapshotInfo = ctx.Set<Models.EFACSnapshot>() var iqSnapshotInfo = ctx.Set<Stats.Models.EFACSnapshot>()
.Where(s => s.ClientId == penalty.OffenderId) .Where(s => s.ClientId == penalty.OffenderId)
.Include(s => s.LastStrainAngle) .Include(s => s.LastStrainAngle)
.Include(s => s.HitOrigin) .Include(s => s.HitOrigin)
@ -121,9 +126,6 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
.OrderBy(s => s.When) .OrderBy(s => s.When)
.ThenBy(s => s.Hits); .ThenBy(s => s.Hits);
#if DEBUG == true
var sql = iqSnapshotInfo.ToSql();
#endif
var penaltyInfo = await iqSnapshotInfo.ToListAsync(); var penaltyInfo = await iqSnapshotInfo.ToListAsync();
if (penaltyInfo.Count > 0) if (penaltyInfo.Count > 0)

View File

@ -1,12 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Razor"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild> <RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild>
<RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish> <RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish>
<PreserveCompilationContext Condition="'$(CONFIG)'!='Debug'">false</PreserveCompilationContext>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc> <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<Configurations>Debug;Release;Prerelease</Configurations> <Configurations>Debug;Release;Prerelease</Configurations>
<LangVersion>7.1</LangVersion> <LangVersion>7.1</LangVersion>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2.2.3" PrivateAssets="All" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Stats\Stats.csproj"> <ProjectReference Include="..\..\Stats\Stats.csproj">
@ -20,12 +29,7 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="xcopy /E /K /Y /C /I &quot;$(ProjectDir)wwwroot\images&quot; &quot;$(SolutionDir)WebfrontCore\wwwroot\images&quot;" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="dotnet publish $(ProjectPath) -c $(ConfigurationName) -o $(ProjectDir)..\..\..\BUILD\Plugins --no-build --no-restore --no-dependencies" />
<Exec Command="copy &quot;$(TargetDir)$(ProjectName).Views$(TargetExt)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" />
</Target> </Target>
</Project> </Project>

View File

@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Stats.ViewComponents namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers
{ {
public class TopPlayersViewComponent : ViewComponent public class TopPlayersViewComponent : ViewComponent
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -16,13 +16,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\SharedLibraryCore\SharedLibraryCore.csproj"> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2.2.3" PrivateAssets="All" />
<Private>false</Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)BUILD\Plugins&quot;" /> <Exec Command="dotnet publish $(ProjectPath) -c $(ConfigurationName) -o $(ProjectDir)..\..\Build\Plugins --no-build --no-restore --no-dependencies" />
</Target> </Target>
</Project> </Project>

12
PostPublish.ps1 Normal file
View File

@ -0,0 +1,12 @@
param (
[string]$PublishDir = $(throw "-PublishDir is required.")
)
$localizations = @("en-US", "ru-RU", "es-EC", "pt-BR", "de-DE")
foreach($localization in $localizations)
{
$url = "http://api.raidmax.org:5000/localization/{0}" -f $localization
$filePath = "{0}\Localization\IW4MAdmin.{1}.json" -f $PublishDir, $localization
$response = Invoke-WebRequest $url
Out-File -FilePath $filePath -InputObject $response.Content -Encoding utf8
}

View File

@ -3,18 +3,17 @@ using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using SharedLibraryCore;
using SharedLibraryCore.Database; using SharedLibraryCore.Database;
using SharedLibraryCore.Database.Models; using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces; using SharedLibraryCore.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using WebfrontCore.ViewModels;
namespace WebfrontCore.Controllers namespace SharedLibraryCore
{ {
public class BaseController : Controller public class BaseController : Controller
{ {
@ -23,7 +22,7 @@ namespace WebfrontCore.Controllers
/// </summary> /// </summary>
private const int COOKIE_LIFESPAN = 3; private const int COOKIE_LIFESPAN = 3;
protected IManager Manager; public IManager Manager { get; private set; }
protected readonly DatabaseContext Context; protected readonly DatabaseContext Context;
protected bool Authorized { get; set; } protected bool Authorized { get; set; }
protected SharedLibraryCore.Localization.Index Localization { get; private set; } protected SharedLibraryCore.Localization.Index Localization { get; private set; }
@ -33,12 +32,9 @@ namespace WebfrontCore.Controllers
private static string SocialTitle; private static string SocialTitle;
protected List<Page> Pages; protected List<Page> Pages;
public BaseController() public BaseController(IManager manager)
{ {
if (Manager == null) Manager = manager;
{
Manager = Program.Manager;
}
if (Localization == null) if (Localization == null)
{ {

View File

@ -0,0 +1,8 @@
namespace SharedLibraryCore.Dtos
{
public class Page
{
public string Name { get; set; }
public string Location { get; set; }
}
}

View File

@ -6,7 +6,7 @@
<ApplicationIcon /> <ApplicationIcon />
<StartupObject /> <StartupObject />
<PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId> <PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId>
<Version>2.2.0</Version> <Version>2.2.3</Version>
<Authors>RaidMax</Authors> <Authors>RaidMax</Authors>
<Company>Forever None</Company> <Company>Forever None</Company>
<Configurations>Debug;Release;Prerelease</Configurations> <Configurations>Debug;Release;Prerelease</Configurations>
@ -19,6 +19,7 @@
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<Description>Shared Library for IW4MAdmin</Description>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
@ -38,27 +39,29 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Jint" Version="2.11.58" /> <PackageReference Include="Jint" Version="2.11.58" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0"> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.0.0" /> <PackageReference Include="Microsoft.Extensions.Localization" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0" /> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Npgsql" Version="4.1.1" /> <PackageReference Include="Npgsql" Version="4.1.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.0-rc3.final" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.0.0" />
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" /> <PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="if not exist &quot;$(ProjectDir)..\BUILD&quot; (&#xD;&#xA;md &quot;$(ProjectDir)..\BUILD&quot;&#xD;&#xA;)&#xD;&#xA;if not exist &quot;$(ProjectDir)..\BUILD\Plugins&quot; (&#xD;&#xA;md &quot;$(ProjectDir)..\BUILD\Plugins&quot;&#xD;&#xA;)" /> <Exec Command="if not exist &quot;$(ProjectDir)..\BUILD&quot; (&#xD;&#xA;if $(ConfigurationName) == Debug (&#xD;&#xA;md &quot;$(ProjectDir)..\BUILD&quot;&#xD;&#xA;)&#xD;&#xA;)&#xD;&#xA;if not exist &quot;$(ProjectDir)..\BUILD\Plugins&quot; (&#xD;&#xA;if $(ConfigurationName) == Debug (&#xD;&#xA;md &quot;$(ProjectDir)..\BUILD\Plugins&quot;&#xD;&#xA;)&#xD;&#xA;)" />
</Target> </Target>
</Project> </Project>

View File

@ -1,4 +0,0 @@
{
"directory": "wwwroot/lib",
"registry": "https://registry.bower.io"
}

View File

@ -1,12 +1,17 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Events; using SharedLibraryCore.Events;
using SharedLibraryCore.Interfaces;
using System.Linq; using System.Linq;
namespace WebfrontCore.Controllers.API namespace WebfrontCore.Controllers.API
{ {
public class ApiController : BaseController public class ApiController : BaseController
{ {
public ApiController(IManager manager) : base(manager)
{
}
public IActionResult Index() public IActionResult Index()
{ {
return Ok($"IW4MAdmin API"); return Ok($"IW4MAdmin API");

View File

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using System; using System;
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -11,6 +12,10 @@ namespace WebfrontCore.Controllers
{ {
public class AccountController : BaseController public class AccountController : BaseController
{ {
public AccountController(IManager manager) : base(manager)
{
}
[HttpGet] [HttpGet]
public async Task<IActionResult> LoginAsync(int clientId, string password) public async Task<IActionResult> LoginAsync(int clientId, string password)

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using WebfrontCore.ViewModels; using WebfrontCore.ViewModels;
using static SharedLibraryCore.Database.Models.EFClient; using static SharedLibraryCore.Database.Models.EFClient;
@ -12,6 +13,11 @@ namespace WebfrontCore.Controllers
{ {
public class ActionController : BaseController public class ActionController : BaseController
{ {
public ActionController(IManager manager) : base(manager)
{
}
public IActionResult BanForm() public IActionResult BanForm()
{ {
var info = new ActionInfo() var info = new ActionInfo()

View File

@ -2,6 +2,7 @@
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Database.Models; using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using SharedLibraryCore.Services; using SharedLibraryCore.Services;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -14,6 +15,11 @@ namespace WebfrontCore.Controllers
{ {
public class ClientController : BaseController public class ClientController : BaseController
{ {
public ClientController(IManager manager) : base(manager)
{
}
public async Task<IActionResult> ProfileAsync(int id) public async Task<IActionResult> ProfileAsync(int id)
{ {
var client = await Manager.GetClientService().Get(id); var client = await Manager.GetClientService().Get(id);

View File

@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore;
using SharedLibraryCore.Configuration; using SharedLibraryCore.Configuration;
using SharedLibraryCore.Interfaces;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using WebfrontCore.ViewModels; using WebfrontCore.ViewModels;
@ -10,6 +12,11 @@ namespace WebfrontCore.Controllers
[Authorize] [Authorize]
public class ConfigurationController : BaseController public class ConfigurationController : BaseController
{ {
public ConfigurationController(IManager manager) : base (manager)
{
}
public IActionResult Edit() public IActionResult Edit()
{ {
if (Client.Level < SharedLibraryCore.Database.Models.EFClient.Permission.Owner) if (Client.Level < SharedLibraryCore.Database.Models.EFClient.Permission.Owner)

View File

@ -2,6 +2,7 @@
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Database.Models; using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -10,6 +11,11 @@ namespace WebfrontCore.Controllers
{ {
public class ConsoleController : BaseController public class ConsoleController : BaseController
{ {
public ConsoleController(IManager manager) : base(manager)
{
}
public IActionResult Index() public IActionResult Index()
{ {
var activeServers = Manager.GetServers().Select(s => new ServerInfo() var activeServers = Manager.GetServers().Select(s => new ServerInfo()

View File

@ -1,4 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -12,6 +14,11 @@ namespace WebfrontCore.Controllers
{ {
private static readonly IDictionary<string, string> _fileCache = new Dictionary<string, string>(); private static readonly IDictionary<string, string> _fileCache = new Dictionary<string, string>();
public DynamicFileController(IManager manager) : base(manager)
{
}
[Route("css/{fileName}")] [Route("css/{fileName}")]
public async Task<IActionResult> Css(string fileName) public async Task<IActionResult> Css(string fileName)
{ {

View File

@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,6 +10,11 @@ namespace WebfrontCore.Controllers
{ {
public class HomeController : BaseController public class HomeController : BaseController
{ {
public HomeController(IManager manager) : base(manager)
{
}
public async Task<IActionResult> Index() public async Task<IActionResult> Index()
{ {
ViewBag.Description = "IW4MAdmin is a complete server administration tool for IW4x."; ViewBag.Description = "IW4MAdmin is a complete server administration tool for IW4x.";

View File

@ -2,20 +2,22 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Database; using SharedLibraryCore.Database;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Services; using SharedLibraryCore.Interfaces;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using WebfrontCore.ViewComponents;
using static SharedLibraryCore.Database.Models.EFPenalty; using static SharedLibraryCore.Database.Models.EFPenalty;
namespace WebfrontCore.Controllers namespace WebfrontCore.Controllers
{ {
public class PenaltyController : BaseController public class PenaltyController : BaseController
{ {
public PenaltyController(IManager manager) : base(manager)
{
}
public IActionResult List(PenaltyType showOnly = PenaltyType.Any) public IActionResult List(PenaltyType showOnly = PenaltyType.Any)
{ {
ViewBag.Description = "List of all the recent penalties (bans, kicks, warnings) on IW4MAdmin"; ViewBag.Description = "List of all the recent penalties (bans, kicks, warnings) on IW4MAdmin";

View File

@ -1,12 +1,18 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore; using SharedLibraryCore;
using SharedLibraryCore.Dtos; using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using System.Linq; using System.Linq;
namespace WebfrontCore.Controllers namespace WebfrontCore.Controllers
{ {
public class ServerController : BaseController public class ServerController : BaseController
{ {
public ServerController(IManager manager) : base(manager)
{
}
[HttpGet] [HttpGet]
[ResponseCache(NoStore = true, Duration = 0)] [ResponseCache(NoStore = true, Duration = 0)]
public IActionResult ClientActivity(long id) public IActionResult ClientActivity(long id)

View File

@ -7,6 +7,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using SharedLibraryCore.Database; using SharedLibraryCore.Database;
using SharedLibraryCore.Interfaces;
using WebfrontCore.Middleware; using WebfrontCore.Middleware;
namespace WebfrontCore namespace WebfrontCore
@ -57,7 +58,7 @@ namespace WebfrontCore
}); });
#if DEBUG #if DEBUG
mvcBuilder = mvcBuilder.AddRazorRuntimeCompilation(); //mvcBuilder = mvcBuilder.AddRazorRuntimeCompilation();
services.Configure<RazorViewEngineOptions>(_options => services.Configure<RazorViewEngineOptions>(_options =>
{ {
_options.ViewLocationFormats.Add(@"/Views/Plugins/{1}/{0}" + RazorViewEngine.ViewExtension); _options.ViewLocationFormats.Add(@"/Views/Plugins/{1}/{0}" + RazorViewEngine.ViewExtension);
@ -87,6 +88,8 @@ namespace WebfrontCore
_builder.AddDebug(); _builder.AddDebug();
}); });
#endif #endif
services.AddSingleton(Program.Manager);
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WebfrontCore.ViewModels
{
public class Page
{
public string Name { get; set; }
public string Location { get; set; }
}
}

View File

@ -18,8 +18,7 @@
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<environment include="Development"> <environment include="Development">
<link rel="stylesheet" href="~/dynamic/css/main.css" /> <link rel="stylesheet" href="~/dynamic/css/global.css" />
<link rel="stylesheet" href="~/lib/open-iconic/font/css/open-iconic-bootstrap.css" />
</environment> </environment>
<environment include="Production"> <environment include="Production">
<link rel="stylesheet" href="~/dynamic/css/global.min.css" /> <link rel="stylesheet" href="~/dynamic/css/global.min.css" />
@ -145,9 +144,10 @@
</footer> </footer>
</div> </div>
<environment include="Development"> <environment include="Development">
<script type="text/javascript" src="~/lib/jQuery/dist/jquery.js"></script> <script type="text/javascript" src="~/lib/jquery/jquery.js"></script>
<script type="text/javascript" src="~/lib/popper.js/popper.js"></script>
<script type="text/javascript" src="~/lib/moment/moment.js"></script> <script type="text/javascript" src="~/lib/moment/moment.js"></script>
<script type="text/javascript" src="~/lib/moment-timezone/builds/moment-timezone-with-data.js"></script> <script type="text/javascript" src="~/lib/moment-timezone/moment-timezone.js"></script>
<script type="text/javascript" src="~/lib/bootstrap/dist/js/bootstrap.js"></script> <script type="text/javascript" src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="~/lib/canvasjs/canvasjs.js"></script> <script type="text/javascript" src="~/lib/canvasjs/canvasjs.js"></script>
<script type="text/javascript" src="~/js/action.js"></script> <script type="text/javascript" src="~/js/action.js"></script>

View File

@ -5,7 +5,7 @@
<RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild> <RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild>
<RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish> <RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc> <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<PreserveCompilationContext>true</PreserveCompilationContext> <PreserveCompilationContext Condition="'$(CONFIG)'!='Debug'">false</PreserveCompilationContext>
<TypeScriptToolsVersion>2.6</TypeScriptToolsVersion> <TypeScriptToolsVersion>2.6</TypeScriptToolsVersion>
<PackageId>RaidMax.IW4MAdmin.WebfrontCore</PackageId> <PackageId>RaidMax.IW4MAdmin.WebfrontCore</PackageId>
<Version>2.0.0</Version> <Version>2.0.0</Version>
@ -19,7 +19,7 @@
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin</RepositoryUrl> <RepositoryUrl>https://github.com/RaidMax/IW4M-Admin</RepositoryUrl>
<PackageIconUrl>https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png</PackageIconUrl> <PackageIconUrl>https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png</PackageIconUrl>
<ApplicationIcon /> <ApplicationIcon />
<OutputType>Exe</OutputType> <OutputType>Library</OutputType>
<StartupObject /> <StartupObject />
<Configurations>Debug;Release;Prerelease</Configurations> <Configurations>Debug;Release;Prerelease</Configurations>
</PropertyGroup> </PropertyGroup>
@ -43,7 +43,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="bower.json" />
<None Include="bundleconfig.json" /> <None Include="bundleconfig.json" />
<None Include="compilerconfig.json" /> <None Include="compilerconfig.json" />
<None Include="Views\Plugins\Stats\Components\TopPlayers\_List.cshtml" /> <None Include="Views\Plugins\Stats\Components\TopPlayers\_List.cshtml" />
@ -51,32 +50,50 @@
<None Include="Views\Plugins\Stats\_MessageContext.cshtml" /> <None Include="Views\Plugins\Stats\_MessageContext.cshtml" />
<None Include="Views\Plugins\Stats\_PenaltyInfo.cshtml" /> <None Include="Views\Plugins\Stats\_PenaltyInfo.cshtml" />
<None Include="Views\Plugins\_ViewImports.cshtml" /> <None Include="Views\Plugins\_ViewImports.cshtml" />
<None Include="wwwroot\css\src\global.css" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Update="wwwroot\**\*.*" CopyToPublishDirectory="Never" /> <Content Update="wwwroot\**\*.*" CopyToPublishDirectory="Never" />
<Content Update="wwwroot\css\src\global.css" CopyToPublishDirectory="Never" />
<Content Update="wwwroot\css\src\global.min.css" CopyToPublishDirectory="Never" />
<Content Update="Views\*.*" CopyToPublishDirectory="Never" /> <Content Update="Views\*.*" CopyToPublishDirectory="Never" />
<None Include="wwwroot\css\global.min.css" CopyToPublishDirectory="Always" /> <None Include="wwwroot\css\global.min.css" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\js\global.min.js" CopyToPublishDirectory="Always" /> <None Include="wwwroot\js\global.min.js" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\images\icon.png" CopyToPublishDirectory="Always" /> <None Include="wwwroot\images\**\*.*" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\images\icons\**\*.png" CopyToPublishDirectory="Always" />
<_ContentIncludedByDefault Remove="wwwroot\css\main.min.css" />
<None Include="wwwroot\lib\open-iconic\font\fonts\open-iconic.ttf" CopyToPublishDirectory="Always" />
<None Include="wwwroot\lib\open-iconic\font\fonts\open-iconic.woff" CopyToPublishDirectory="Always" />
<None Include="wwwroot\lib\open-iconic\font\fonts\open-iconic.otf" CopyToPublishDirectory="Always" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Bower" Version="1.3.11" /> <PackageReference Include="BuildBundlerMinifier" Version="3.2.435" />
<PackageReference Include="BuildBundlerMinifier" Version="3.0.415" /> <PackageReference Include="BuildWebCompiler" Version="1.12.405" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.0.96" />
</ItemGroup>
<ItemGroup Condition="'$(CONFIG)'=='Debug'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj"> <Folder Include="wwwroot\lib\canvas.js\" />
<Private></Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions> <ItemGroup>
<ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="libman.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties />
</VisualStudio>
</ProjectExtensions>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="if $(ConfigurationName) == Debug ( &#xD;&#xA;powershell -Command wget https://raw.githubusercontent.com/iconic/open-iconic/master/font/css/open-iconic-bootstrap.scss -o $(ProjectDir)wwwroot\lib\open-iconic\font\css\open-iconic-bootstrap.scss&#xD;&#xA;)" />
</Target>
</Project> </Project>

View File

@ -1,15 +0,0 @@
{
"name": "asp.net",
"private": true,
"dependencies": {
"bootstrap": "v4.1.1",
"jquery": "3.3.1",
"popper.js": "v1.12.9",
"open-iconic": "1.1.1",
"moment-timezone": "0.5.14"
},
"resolutions": {
"bootstrap": "v4.1.1",
"jquery": "3.3.1"
}
}

View File

@ -5,18 +5,18 @@
"outputFileName": "wwwroot/css/global.min.css", "outputFileName": "wwwroot/css/global.min.css",
// An array of relative input file paths. Globbing patterns supported // An array of relative input file paths. Globbing patterns supported
"inputFiles": [ "inputFiles": [
"wwwroot/css/main.css", "wwwroot/css/global.css"
"wwwroot/lib/open-iconic/font/css/open-iconic-bootstrap.css"
] ]
}, },
{ {
"outputFileName": "wwwroot/js/global.min.js", "outputFileName": "wwwroot/js/global.min.js",
"inputFiles": [ "inputFiles": [
"wwwroot/lib/jQuery/dist/jquery.min.js", "wwwroot/lib/jquery/jquery.min.js",
"wwwroot/lib/bootstrap/dist/js/bootstrap.min.js", "wwwroot/lib/popper.js/umd/popper.js",
"wwwroot/lib/moment/min/moment.min.js", "wwwroot/lib/moment.js/moment.min.js",
"wwwroot/lib/moment-timezone/builds/moment-timezone.min.js", "wwwroot/lib/moment-timezone/moment-timezone.min.js",
"wwwroot/lib/canvasjs/canvasjs.js", "wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js",
"wwwroot/lib/canvas.js/canvasjs.js",
"wwwroot/js/action.js", "wwwroot/js/action.js",
"wwwroot/js/console.js", "wwwroot/js/console.js",
"wwwroot/js/penalty.js", "wwwroot/js/penalty.js",

View File

@ -1,14 +1,7 @@
[ [
{ {
"outputFile": "wwwroot/css/bootstrap-custom.css", "outputFile": "wwwroot/css/global.css",
"inputFile": "wwwroot/css/bootstrap-custom.scss" "inputFile": "wwwroot/css/src/main.scss",
}, "sourceMap": false
{
"outputFile": "wwwroot/js/server.es5.js",
"inputFile": "wwwroot/js/server.js"
},
{
"outputFile": "wwwroot/css/main.css",
"inputFile": "wwwroot/css/main.scss"
} }
] ]

31
WebfrontCore/libman.json Normal file
View File

@ -0,0 +1,31 @@
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "jquery@3.3.1",
"destination": "wwwroot/lib/jquery/"
},
{
"library": "popper.js@1.14.7",
"destination": "wwwroot/lib/popper.js/"
},
{
"library": "moment-timezone@0.5.26",
"destination": "wwwroot/lib/moment-timezone/"
},
{
"library": "open-iconic@1.1.1",
"destination": "wwwroot/lib/open-iconic/"
},
{
"provider": "jsdelivr",
"library": "bootstrap@4.3.1",
"destination": "wwwroot/lib/bootstrap/"
},
{
"library": "moment.js@2.24.0",
"destination": "wwwroot/lib/moment.js/"
}
]
}

View File

@ -23,7 +23,6 @@ $h5-font-size: $font-size-base * 1.25 !default;
$h1-font-size: $font-size-base * 2.5 !default; $h1-font-size: $font-size-base * 2.5 !default;
$navbar-brand-font-size: $h1-font-size !default; $navbar-brand-font-size: $h1-font-size !default;
$navbar-toggler-font-size: $h5-font-size !default; $navbar-toggler-font-size: $h5-font-size !default;
$navbar-dark-hover-color: $primary !default; $navbar-dark-hover-color: $primary !default;
@import '../lib/bootstrap/scss/bootstrap.scss'; @import '../../lib/bootstrap/scss/bootstrap.scss';

View File

@ -1,6 +1,9 @@
@import 'bootstrap-custom.scss'; @import 'bootstrap-custom.scss';
@import 'profile.scss'; @import 'profile.scss';
$icon-font-path: '/font/' !default;
@import '../../lib/open-iconic/font/css/open-iconic-bootstrap.scss';
.navbar-nav .nav-link:hover { .navbar-nav .nav-link:hover {
background-color: $body-bg; background-color: $body-bg;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Some files were not shown because too many files have changed in this diff Show More