Add about/community info guidelines/social page
This commit is contained in:
parent
a01543c89b
commit
3916278422
@ -57,6 +57,7 @@ namespace SharedLibraryCore
|
|||||||
ViewBag.Version = Manager.Version;
|
ViewBag.Version = Manager.Version;
|
||||||
ViewBag.IsFluid = false;
|
ViewBag.IsFluid = false;
|
||||||
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
|
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
|
||||||
|
ViewBag.Language = Utilities.CurrentLocalization.Culture.TwoLetterISOLanguageName;
|
||||||
|
|
||||||
Client ??= new EFClient()
|
Client ??= new EFClient()
|
||||||
{
|
{
|
||||||
@ -125,6 +126,9 @@ namespace SharedLibraryCore
|
|||||||
SignInAsync(new ClaimsPrincipal(claimsIdentity)).Wait();
|
SignInAsync(new ClaimsPrincipal(claimsIdentity)).Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var communityName = Manager.GetApplicationSettings().Configuration().CommunityInformation?.Name;
|
||||||
|
var shouldUseCommunityName = !string.IsNullOrWhiteSpace(communityName) && !communityName.Contains("IW4MAdmin");
|
||||||
|
|
||||||
ViewBag.Authorized = Authorized;
|
ViewBag.Authorized = Authorized;
|
||||||
ViewBag.Url = Manager.GetApplicationSettings().Configuration().WebfrontUrl;
|
ViewBag.Url = Manager.GetApplicationSettings().Configuration().WebfrontUrl;
|
||||||
ViewBag.User = Client;
|
ViewBag.User = Client;
|
||||||
@ -133,7 +137,9 @@ namespace SharedLibraryCore
|
|||||||
ViewBag.SocialTitle = SocialTitle;
|
ViewBag.SocialTitle = SocialTitle;
|
||||||
ViewBag.Pages = Pages;
|
ViewBag.Pages = Pages;
|
||||||
ViewBag.Localization = Utilities.CurrentLocalization.LocalizationIndex;
|
ViewBag.Localization = Utilities.CurrentLocalization.LocalizationIndex;
|
||||||
ViewBag.CustomBranding = Manager.GetApplicationSettings().Configuration().WebfrontCustomBranding ?? "IW4MAdmin";
|
ViewBag.CustomBranding = shouldUseCommunityName
|
||||||
|
? communityName
|
||||||
|
: Manager.GetApplicationSettings().Configuration().WebfrontCustomBranding ?? "IW4MAdmin";
|
||||||
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
|
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
|
||||||
ViewBag.EnablePrivilegedUserPrivacy = Manager.GetApplicationSettings().Configuration().EnablePrivilegedUserPrivacy;
|
ViewBag.EnablePrivilegedUserPrivacy = Manager.GetApplicationSettings().Configuration().EnablePrivilegedUserPrivacy;
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ namespace SharedLibraryCore.Configuration
|
|||||||
{
|
{
|
||||||
public class ApplicationConfiguration : IBaseConfiguration
|
public class ApplicationConfiguration : IBaseConfiguration
|
||||||
{
|
{
|
||||||
|
[ConfigurationIgnore]
|
||||||
|
public CommunityInformationConfiguration CommunityInformation { get; set; } = new CommunityInformationConfiguration();
|
||||||
|
|
||||||
[LocalizedDisplayName("SETUP_ENABLE_WEBFRONT")]
|
[LocalizedDisplayName("SETUP_ENABLE_WEBFRONT")]
|
||||||
[ConfigurationLinked("WebfrontBindUrl", "ManualWebfrontUrl", "WebfrontPrimaryColor", "WebfrontSecondaryColor",
|
[ConfigurationLinked("WebfrontBindUrl", "ManualWebfrontUrl", "WebfrontPrimaryColor", "WebfrontSecondaryColor",
|
||||||
"WebfrontCustomBranding")]
|
"WebfrontCustomBranding")]
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
namespace SharedLibraryCore.Configuration
|
||||||
|
{
|
||||||
|
public class CommunityInformationConfiguration
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = "IW4MAdmin - Configure In IW4MAdminSettings.json";
|
||||||
|
public string Description { get; set; } =
|
||||||
|
"IW4MAdmin is an administration tool for IW4x, Pluto T6, Pluto IW5, CoD4x, TeknoMW3, and most Call of Duty® dedicated servers. It allows complete control of your server; from changing maps, to banning players, IW4MAdmin monitors and records activity on your server(s). With plugin support, extending its functionality is a breeze.";
|
||||||
|
public bool EnableBanner { get; set; } = true;
|
||||||
|
|
||||||
|
public SocialAccountConfiguration[] SocialAccounts { get; set; } =
|
||||||
|
{
|
||||||
|
new SocialAccountConfiguration
|
||||||
|
{
|
||||||
|
Title = "IW4MAdmin Website",
|
||||||
|
Url = "https://raidmax.org/IW4MAdmin",
|
||||||
|
IconId = "oi-globe"
|
||||||
|
},
|
||||||
|
new SocialAccountConfiguration
|
||||||
|
{
|
||||||
|
Title = "IW4MAdmin Github",
|
||||||
|
Url = "https://github.com/RaidMax/IW4M-Admin/",
|
||||||
|
IconUrl = "github.svg"
|
||||||
|
},
|
||||||
|
new SocialAccountConfiguration
|
||||||
|
{
|
||||||
|
Title = "IW4MAdmin Youtube",
|
||||||
|
Url = "https://www.youtube.com/watch?v=xpxEO4Qi0cQ",
|
||||||
|
IconUrl = "https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/youtube.svg"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SocialAccountConfiguration
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string Url { get; set; }
|
||||||
|
public string IconUrl { get; set; }
|
||||||
|
public string IconId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
44
WebfrontCore/Controllers/AboutController.cs
Normal file
44
WebfrontCore/Controllers/AboutController.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SharedLibraryCore;
|
||||||
|
using SharedLibraryCore.Configuration;
|
||||||
|
using SharedLibraryCore.Interfaces;
|
||||||
|
using WebfrontCore.Extensions;
|
||||||
|
using WebfrontCore.ViewModels;
|
||||||
|
|
||||||
|
namespace WebfrontCore.Controllers
|
||||||
|
{
|
||||||
|
public class AboutController : BaseController
|
||||||
|
{
|
||||||
|
private readonly ApplicationConfiguration _appConfig;
|
||||||
|
|
||||||
|
public AboutController(IManager manager, ApplicationConfiguration appConfig) : base(manager)
|
||||||
|
{
|
||||||
|
_appConfig = appConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
ViewBag.Description = Localization["WEBFRONT_DESCRIPTION_ABOUT"].FormatExt(
|
||||||
|
_appConfig.ShouldUseFallbackBranding()
|
||||||
|
? _appConfig.WebfrontCustomBranding
|
||||||
|
: _appConfig.CommunityInformation.Name);
|
||||||
|
ViewBag.Title = _appConfig.ShouldUseFallbackBranding()
|
||||||
|
? Localization["WEBFRONT_NAV_ABOUT"]
|
||||||
|
: _appConfig.CommunityInformation.Name;
|
||||||
|
|
||||||
|
var info = new CommunityInfo
|
||||||
|
{
|
||||||
|
GlobalRules = _appConfig.GlobalRules,
|
||||||
|
ServerRules =
|
||||||
|
_appConfig.Servers.ToDictionary(
|
||||||
|
config => Manager.GetServers().FirstOrDefault(server =>
|
||||||
|
server.IP == config.IPAddress && server.Port == config.Port)?.Hostname,
|
||||||
|
config => config.Rules),
|
||||||
|
CommunityInformation = _appConfig.CommunityInformation
|
||||||
|
};
|
||||||
|
|
||||||
|
return View(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
WebfrontCore/Extensions/WebfrontExtensions.cs
Normal file
10
WebfrontCore/Extensions/WebfrontExtensions.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using SharedLibraryCore.Configuration;
|
||||||
|
|
||||||
|
namespace WebfrontCore.Extensions
|
||||||
|
{
|
||||||
|
public static class WebfrontExtensions
|
||||||
|
{
|
||||||
|
public static bool ShouldUseFallbackBranding(this ApplicationConfiguration appConfig) =>
|
||||||
|
string.IsNullOrWhiteSpace(appConfig?.CommunityInformation?.Name) || appConfig.CommunityInformation.Name.Contains("IW4MAdmin");
|
||||||
|
}
|
||||||
|
}
|
12
WebfrontCore/ViewModels/CommunityInfo.cs
Normal file
12
WebfrontCore/ViewModels/CommunityInfo.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using SharedLibraryCore.Configuration;
|
||||||
|
|
||||||
|
namespace WebfrontCore.ViewModels
|
||||||
|
{
|
||||||
|
public class CommunityInfo
|
||||||
|
{
|
||||||
|
public string[] GlobalRules { get; set; }
|
||||||
|
public Dictionary<string, string[]> ServerRules { get; set; }
|
||||||
|
public CommunityInformationConfiguration CommunityInformation { get; set; }
|
||||||
|
}
|
||||||
|
}
|
70
WebfrontCore/Views/About/Index.cshtml
Normal file
70
WebfrontCore/Views/About/Index.cshtml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
@model WebfrontCore.ViewModels.CommunityInfo
|
||||||
|
@{
|
||||||
|
var allRules = Model.ServerRules.Prepend(new KeyValuePair<string, string[]>(ViewBag.Localization["WEBFRONT_ABOUT_GLOBAL_RULES"], Model.GlobalRules));
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
@if (Model.CommunityInformation.EnableBanner)
|
||||||
|
{
|
||||||
|
<img class="img-fluid mb-3" style="max-height: 250px" src="images/community/banner.png"/>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Name))
|
||||||
|
{
|
||||||
|
<h2 class="mb-4 ml-auto mr-auto ml-md-0">
|
||||||
|
<color-code value="@Model.CommunityInformation.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||||
|
</h2>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Description))
|
||||||
|
{
|
||||||
|
<div class="p-4 bg-dark border border-primary mb-4 text-white-50">
|
||||||
|
<h4 class="text-primary">@ViewBag.Localization["WEBFRONT_ABOUT_TITLE"]</h4>
|
||||||
|
<color-code value="@Model.CommunityInformation.Description" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||||
|
<div class="mt-3">
|
||||||
|
@foreach (var social in Model.CommunityInformation.SocialAccounts)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<a href="@social.Url" target="_blank" title="@social.Title">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(social.IconId))
|
||||||
|
{
|
||||||
|
<span class="oi @social.IconId"></span>
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrWhiteSpace(social.IconUrl))
|
||||||
|
{
|
||||||
|
var url = Uri.TryCreate(social.IconUrl, UriKind.Absolute, out _) ? social.IconUrl : $"images/community/{social.IconUrl}";
|
||||||
|
<img class="img-fluid" style="max-width: 1rem; fill: white" src="@url" alt="@social.Title"/>
|
||||||
|
}
|
||||||
|
<span>@social.Title</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2 class="pb-3 ml-auto mr-auto ml-md-0">@ViewBag.Localization["WEBFRONT_ABOUT_COMMUNITY_GUIDELINES"]</h2>
|
||||||
|
|
||||||
|
@foreach (var (serverName, rules) in allRules)
|
||||||
|
{
|
||||||
|
if (rules?.Length == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var start = 1;
|
||||||
|
<div class="col-12 bg-dark p-4 border border-primary mb-4">
|
||||||
|
<div class="text-primary h4">
|
||||||
|
<color-code value="@serverName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||||
|
</div>
|
||||||
|
@foreach (var rule in rules)
|
||||||
|
{
|
||||||
|
<div class="text-white-50">
|
||||||
|
<span class="text-white">@start.</span>
|
||||||
|
<color-code value="@rule" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||||
|
</div>
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
@ -2,7 +2,7 @@
|
|||||||
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
|
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
|
||||||
}
|
}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/html">
|
<html xmlns="http://www.w3.org/1999/html" lang="@ViewBag.Language">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
@ -34,23 +34,47 @@
|
|||||||
</button>
|
</button>
|
||||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_HOME"], "Index", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "Index", "Home", new {area = ""}, new {@class = "nav-link nav-icon oi oi-hard-drive", title=@loc["WEBFRONT_NAV_SERVERS"]})</li>
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_PENALTIES"], "List", "Penalty", new { area = "" }, new { @class = "nav-link" })</li>
|
<li class="nav-item text-center d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_SERVERS"], "Index", "Home", new {area = ""}, new {@class = "nav-link"})</li>
|
||||||
|
|
||||||
|
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "Index", "About", new {area = ""}, new {@class = "nav-link nav-icon oi oi-list-rich", title=loc["WEBFRONT_NAV_ABOUT"]})</li>
|
||||||
|
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_ABOUT"], "Index", "About", new {area = ""}, new {@class = "nav-link"})</li>
|
||||||
|
|
||||||
|
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "List", "Penalty", new {area = ""}, new {@class = "nav-link nav-icon oi oi-lock-locked", title=loc["WEBFRONT_NAV_PENALTIES"]})</li>
|
||||||
|
<li class="nav-item text-center d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_PENALTIES"], "List", "Penalty", new {area = ""}, new {@class = "nav-link"})</li>
|
||||||
|
|
||||||
@if (ViewBag.Authorized)
|
@if (ViewBag.Authorized)
|
||||||
{
|
{
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
|
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link nav-icon oi oi-people", title=loc["WEBFRONT_NAV_PRIVILEGED"]})</li>
|
||||||
|
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
|
||||||
}
|
}
|
||||||
else if (!ViewBag.Authorized && !ViewBag.EnablePrivilegedUserPrivacy)
|
else if (!ViewBag.Authorized && !ViewBag.EnablePrivilegedUserPrivacy)
|
||||||
{
|
{
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
|
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link nav-icon oi oi-people", title=loc["WEBFRONT_NAV_PRIVILEGED"]})</li>
|
||||||
|
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_PRIVILEGED"], "PrivilegedAsync", "Client", new {area = ""}, new {@class = "nav-link"})</li>
|
||||||
}
|
}
|
||||||
<li class="nav-item text-center text-lg-left">@Html.ActionLink(loc["WEBFRONT_NAV_HELP"], "Help", "Home", new { area = "" }, new { @class = "nav-link" })</li>
|
|
||||||
|
<li class="nav-item d-none d-lg-inline-block d-xl-none">@Html.ActionLink("", "Help", "Home", new {area = ""}, new {@class = "nav-link nav-icon oi oi-question-mark", title=loc["WEBFRONT_NAV_HELP"]})</li>
|
||||||
|
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">@Html.ActionLink(loc["WEBFRONT_NAV_HELP"], "Help", "Home", new {area = ""}, new {@class = "nav-link"})</li>
|
||||||
|
|
||||||
@foreach (var _page in ViewBag.Pages)
|
@foreach (var _page in ViewBag.Pages)
|
||||||
|
{
|
||||||
|
if (_page.Location == "/Stats/TopPlayersAsync")
|
||||||
|
{
|
||||||
|
<li class="nav-item d-none d-lg-inline-block d-xl-none">
|
||||||
|
<a class="nav-link nav-icon oi oi-bar-chart" href="@_page.Location" title="@_page.Name"></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item text-center text-lg-left d-lg-none d-xl-inline-block">
|
||||||
|
<a class="nav-link" href="@_page.Location">@_page.Name</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
<li class="nav-item text-center text-lg-left">
|
<li class="nav-item text-center text-lg-left">
|
||||||
<a class="nav-link" href="@_page.Location">@_page.Name</a>
|
<a class="nav-link" href="@_page.Location">@_page.Name</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
<li class="nav-item text-center text-lg-left"></li>
|
<li class="nav-item text-center text-lg-left"></li>
|
||||||
@if (!string.IsNullOrEmpty(ViewBag.SocialLink))
|
@if (!string.IsNullOrEmpty(ViewBag.SocialLink))
|
||||||
{
|
{
|
||||||
|
@ -449,3 +449,9 @@ div.card {
|
|||||||
.text-light-green {
|
.text-light-green {
|
||||||
color: #88aa82;
|
color: #88aa82;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-icon {
|
||||||
|
padding-left: 1rem !important;
|
||||||
|
padding-right: 1rem !important;
|
||||||
|
line-height: 1.45rem !important;
|
||||||
|
}
|
BIN
WebfrontCore/wwwroot/images/community/banner.png
Normal file
BIN
WebfrontCore/wwwroot/images/community/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
1
WebfrontCore/wwwroot/images/community/github.svg
Normal file
1
WebfrontCore/wwwroot/images/community/github.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg role="img" fill="white" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>
|
After Width: | Height: | Size: 835 B |
Loading…
Reference in New Issue
Block a user