Add ban list window (#12574)

This commit is contained in:
DrSmugleaf
2022-11-14 20:06:55 +01:00
committed by GitHub
parent 29a1c7d12d
commit da29a01846
25 changed files with 535 additions and 79 deletions

View File

@@ -0,0 +1,15 @@
<controls:BanListControl
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.Administration.UI.BanList"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client">
<PanelContainer>
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#25252A"/>
</PanelContainer.PanelOverride>
<ScrollContainer>
<BoxContainer Name="Bans" Access="Public" Orientation="Vertical">
<controls:BanListHeader Name="BansHeader"/>
</BoxContainer>
</ScrollContainer>
</PanelContainer>
</controls:BanListControl>

View File

@@ -0,0 +1,72 @@
using System.Linq;
using Content.Client.Administration.UI.CustomControls;
using Content.Shared.Administration.BanList;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Administration.UI.BanList;
[GenerateTypedNameReferences]
public sealed partial class BanListControl : Control
{
private BanListIdsPopup? _popup;
public BanListControl()
{
RobustXamlLoader.Load(this);
}
public void SetBans(List<SharedServerBan> bans)
{
foreach (var control in Bans.Children.ToArray()[1..])
{
control.Orphan();
}
foreach (var ban in bans)
{
Bans.AddChild(new HSeparator());
var line = new BanListLine(ban);
line.OnIdsClicked += LineIdsClicked;
Bans.AddChild(line);
}
}
private void ClosePopup()
{
_popup?.Close();
_popup = null;
}
private bool LineIdsClicked(BanListLine line)
{
ClosePopup();
var ban = line.Ban;
var ip = ban.Address == null
? string.Empty
: Loc.GetString("ban-list-ip", ("ip", ban.Address.Value.address));
var hwid = ban.HWId == null ? string.Empty : Loc.GetString("ban-list-hwid", ("hwid", ban.HWId));
var guid = ban.UserId == null ? string.Empty : Loc.GetString("ban-list-guid", ("guid", ban.UserId.Value.ToString()));
_popup = new BanListIdsPopup(ip, hwid, guid);
var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, (1, 1));
_popup.Open(box);
return true;
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (_popup != null)
{
UserInterfaceManager.PopupRoot.RemoveChild(_popup);
}
}
}

View File

@@ -0,0 +1,34 @@
using Content.Client.Eui;
using Content.Shared.Administration.BanList;
using Content.Shared.Eui;
namespace Content.Client.Administration.UI.BanList;
public sealed class BanListEui : BaseEui
{
public BanListEui()
{
BanWindow = new BanListWindow();
BanControl = BanWindow.BanList;
}
private BanListWindow BanWindow { get; }
private BanListControl BanControl { get; }
public override void HandleState(EuiStateBase state)
{
if (state is not BanListEuiState s)
return;
BanWindow.SetTitlePlayer(s.BanListPlayerName);
s.Bans.Sort((a, b) => a.BanTime.CompareTo(b.BanTime));
BanControl.SetBans(s.Bans);
}
public override void Opened()
{
BanWindow.OpenCentered();
}
}

View File

@@ -0,0 +1,31 @@
<ContainerButton
xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls">
<PanelContainer Name="BackgroundPanel" Access="Public">
<BoxContainer
Orientation="Horizontal"
HorizontalExpand="True"
SeparationOverride="4">
<Label Text="{Loc ban-list-header-ids}"
SizeFlagsStretchRatio="1"
HorizontalExpand="True"/>
<cc:VSeparator/>
<Label Text="{Loc ban-list-header-reason}"
SizeFlagsStretchRatio="6"
HorizontalExpand="True"/>
<cc:VSeparator/>
<Label Text="{Loc ban-list-header-time}"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"/>
<cc:VSeparator/>
<Label Text="{Loc ban-list-header-expires}"
SizeFlagsStretchRatio="4"
HorizontalExpand="True"/>
<cc:VSeparator/>
<Label Text="{Loc ban-list-header-banning-admin}"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"/>
<cc:VSeparator/>
</BoxContainer>
</PanelContainer>
</ContainerButton>

View File

@@ -0,0 +1,14 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Administration.UI.BanList;
[GenerateTypedNameReferences]
public sealed partial class BanListHeader : ContainerButton
{
public BanListHeader()
{
RobustXamlLoader.Load(this);
}
}

View File

@@ -0,0 +1,13 @@
<Popup xmlns="https://spacestation14.io"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client">
<PanelContainer>
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#25252A"/>
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical">
<Label Name="IP" HorizontalExpand="True"/>
<Label Name="HWId" HorizontalExpand="True"/>
<Label Name="GUID" HorizontalExpand="True"/>
</BoxContainer>
</PanelContainer>
</Popup>

View File

@@ -0,0 +1,20 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Administration.UI.BanList;
[GenerateTypedNameReferences]
public sealed partial class BanListIdsPopup : Popup
{
public BanListIdsPopup(string? ip, string? hwid, string? guid)
{
RobustXamlLoader.Load(this);
IP.Text = ip;
HWId.Text = hwid;
GUID.Text = guid;
UserInterfaceManager.ModalRoot.AddChild(this);
}
}

View File

@@ -0,0 +1,38 @@
<BoxContainer
xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
Orientation="Horizontal"
HorizontalExpand="True"
SeparationOverride="4">
<BoxContainer Orientation="Vertical"
SizeFlagsStretchRatio="1"
HorizontalExpand="True"
RectClipContent="True">
<Label Name="IdsHidden"
Text="{Loc 'ban-list-hidden'}"
HorizontalExpand="True"
VerticalExpand="True"
MouseFilter="Pass"/>
</BoxContainer>
<cc:VSeparator/>
<Label Name="Reason"
SizeFlagsStretchRatio="6"
HorizontalExpand="True"
VerticalExpand="True"/>
<cc:VSeparator/>
<Label Name="BanTime"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<cc:VSeparator/>
<Label Name="Expires"
SizeFlagsStretchRatio="4"
HorizontalExpand="True"
ClipText="True"/>
<cc:VSeparator/>
<Label Name="BanningAdmin"
SizeFlagsStretchRatio="2"
HorizontalExpand="True"
ClipText="True"/>
<cc:VSeparator/>
</BoxContainer>

View File

@@ -0,0 +1,70 @@
using Content.Shared.Administration.BanList;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
namespace Content.Client.Administration.UI.BanList;
[GenerateTypedNameReferences]
public sealed partial class BanListLine : BoxContainer
{
public readonly SharedServerBan Ban;
public event Func<BanListLine, bool>? OnIdsClicked;
public BanListLine(SharedServerBan ban)
{
RobustXamlLoader.Load(this);
Ban = ban;
IdsHidden.OnKeyBindDown += IdsKeyBindDown;
Reason.Text = ban.Reason;
BanTime.Text = FormatDate(ban.BanTime);
Expires.Text = ban.ExpirationTime == null
? Loc.GetString("ban-list-permanent")
: FormatDate(ban.ExpirationTime.Value);
if (ban.Unban is { } unban)
{
var unbanned = Loc.GetString("ban-list-unbanned", ("date", FormatDate(unban.UnbanTime)));
var unbannedBy = unban.UnbanningAdmin == null
? string.Empty
: $"\n{Loc.GetString("ban-list-unbanned-by", ("unbanner", unban.UnbanningAdmin))}";
Expires.Text += $"\n{unbanned}{unbannedBy}";
}
BanningAdmin.Text = ban.BanningAdminName;
}
private static string FormatDate(DateTimeOffset date)
{
return date.ToString("MM/dd/yyyy h:mm tt");
}
private void IdsKeyBindDown(GUIBoundKeyEventArgs args)
{
if (args.Function != EngineKeyFunctions.UIRightClick &&
args.Function != EngineKeyFunctions.UIClick)
{
return;
}
if (OnIdsClicked?.Invoke(this) == true)
{
args.Handle();
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
IdsHidden.OnKeyBindDown -= IdsKeyBindDown;
OnIdsClicked = null;
}
}

View File

@@ -0,0 +1,6 @@
<controls:BanListWindow
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.Administration.UI.BanList"
SetSize="1400 400">
<controls:BanListControl Name="BanList" Access="Public"/>
</controls:BanListWindow>

View File

@@ -0,0 +1,19 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Administration.UI.BanList;
[GenerateTypedNameReferences]
public sealed partial class BanListWindow : DefaultWindow
{
public BanListWindow()
{
RobustXamlLoader.Load(this);
}
public void SetTitlePlayer(string playerName)
{
Title = Loc.GetString("ban-list-title", ("player", playerName));
}
}

View File

@@ -10,6 +10,7 @@
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="2"> <BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="2">
<BoxContainer Access="Public" Name="BwoinkArea" VerticalExpand="True" /> <BoxContainer Access="Public" Name="BwoinkArea" VerticalExpand="True" />
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Right"> <BoxContainer Orientation="Horizontal" HorizontalAlignment="Right">
<Button Visible="False" Name="Bans" Text="{Loc 'admin-player-actions-bans'}" />
<Button Visible="False" Name="Notes" Text="{Loc 'admin-player-actions-notes'}" /> <Button Visible="False" Name="Notes" Text="{Loc 'admin-player-actions-notes'}" />
<Button Visible="False" Name="Kick" Text="{Loc 'admin-player-actions-kick'}" /> <Button Visible="False" Name="Kick" Text="{Loc 'admin-player-actions-kick'}" />
<Button Visible="False" Name="Ban" Text="{Loc 'admin-player-actions-ban'}" /> <Button Visible="False" Name="Ban" Text="{Loc 'admin-player-actions-ban'}" />

View File

@@ -1,8 +1,6 @@
#nullable enable
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using Content.Client.Administration.Managers; using Content.Client.Administration.Managers;
using Content.Client.Administration.Systems;
using Content.Client.Administration.UI.CustomControls; using Content.Client.Administration.UI.CustomControls;
using Content.Client.Administration.UI.Tabs.AdminTab; using Content.Client.Administration.UI.Tabs.AdminTab;
using Content.Client.Stylesheets; using Content.Client.Stylesheets;
@@ -106,6 +104,12 @@ namespace Content.Client.Administration.UI
return bch!.LastMessage.CompareTo(ach!.LastMessage); return bch!.LastMessage.CompareTo(ach!.LastMessage);
}; };
Bans.OnPressed += _ =>
{
if (_currentPlayer is not null)
_console.ExecuteCommand($"banlist \"{_currentPlayer.SessionId}\"");
};
Notes.OnPressed += _ => Notes.OnPressed += _ =>
{ {
if (_currentPlayer is not null) if (_currentPlayer is not null)
@@ -170,6 +174,9 @@ namespace Content.Client.Administration.UI
private void FixButtons() private void FixButtons()
{ {
Bans.Visible = _adminManager.HasFlag(AdminFlags.Ban);
Bans.Disabled = !Bans.Visible;
Notes.Visible = _adminManager.HasFlag(AdminFlags.ViewNotes); Notes.Visible = _adminManager.HasFlag(AdminFlags.ViewNotes);
Notes.Disabled = !Notes.Visible; Notes.Disabled = !Notes.Visible;

View File

@@ -10,8 +10,6 @@ namespace Content.Client.Administration.UI.Notes;
[GenerateTypedNameReferences] [GenerateTypedNameReferences]
public sealed partial class AdminNotesControl : Control public sealed partial class AdminNotesControl : Control
{ {
[Dependency] private readonly IUserInterfaceManager _ui = default!;
public event Action<int, string>? OnNoteChanged; public event Action<int, string>? OnNoteChanged;
public event Action<string>? OnNewNoteEntered; public event Action<string>? OnNewNoteEntered;
public event Action<int>? OnNoteDeleted; public event Action<int>? OnNoteDeleted;
@@ -53,7 +51,7 @@ public sealed partial class AdminNotesControl : Control
OnNoteChanged?.Invoke(input.Id, text); OnNoteChanged?.Invoke(input.Id, text);
} }
private bool NoteRightClicked(AdminNotesLine line) private bool NoteClicked(AdminNotesLine line)
{ {
ClosePopup(); ClosePopup();
@@ -69,7 +67,7 @@ public sealed partial class AdminNotesControl : Control
}; };
_popup.OnDeletePressed += noteId => OnNoteDeleted?.Invoke(noteId); _popup.OnDeletePressed += noteId => OnNoteDeleted?.Invoke(noteId);
var box = UIBox2.FromDimensions(_ui.MousePositionScaled.Position, (1, 1)); var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, (1, 1));
_popup.Open(box); _popup.Open(box);
return true; return true;
@@ -102,7 +100,7 @@ public sealed partial class AdminNotesControl : Control
input = new AdminNotesLine(note); input = new AdminNotesLine(note);
input.OnSubmitted += NoteSubmitted; input.OnSubmitted += NoteSubmitted;
input.OnRightClicked += NoteRightClicked; input.OnClicked += NoteClicked;
Notes.AddChild(input); Notes.AddChild(input);
Inputs[note.Id] = input; Inputs[note.Id] = input;
} }
@@ -136,7 +134,7 @@ public sealed partial class AdminNotesControl : Control
if (_popup != null) if (_popup != null)
{ {
_ui.PopupRoot.RemoveChild(_popup); UserInterfaceManager.PopupRoot.RemoveChild(_popup);
} }
OnNoteChanged = null; OnNoteChanged = null;

View File

@@ -30,7 +30,7 @@ public sealed partial class AdminNotesLine : BoxContainer
public string EditText => _edit?.Text ?? OriginalMessage; public string EditText => _edit?.Text ?? OriginalMessage;
public event Action<AdminNotesLine>? OnSubmitted; public event Action<AdminNotesLine>? OnSubmitted;
public event Func<AdminNotesLine, bool>? OnRightClicked; public event Func<AdminNotesLine, bool>? OnClicked;
private void AddLabel() private void AddLabel()
{ {
@@ -92,7 +92,7 @@ public sealed partial class AdminNotesLine : BoxContainer
return; return;
} }
if (OnRightClicked?.Invoke(this) == true) if (OnClicked?.Invoke(this) == true)
{ {
args.Handle(); args.Handle();
} }
@@ -137,6 +137,6 @@ public sealed partial class AdminNotesLine : BoxContainer
} }
OnSubmitted = null; OnSubmitted = null;
OnRightClicked = null; OnClicked = null;
} }
} }

View File

@@ -1,5 +1,5 @@
<Popup xmlns="https://spacestation14.io" <Popup xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"> xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client">
<PanelContainer> <PanelContainer>
<PanelContainer.PanelOverride> <PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#25252A"/> <gfx:StyleBoxFlat BackgroundColor="#25252A"/>

View File

@@ -15,7 +15,6 @@
<cc:CommandButton Command="announceui" Text="{Loc admin-player-actions-window-announce}"/> <cc:CommandButton Command="announceui" Text="{Loc admin-player-actions-window-announce}"/>
<cc:UICommandButton Command="callshuttle" Text="{Loc admin-player-actions-window-shuttle}" WindowType="{x:Type at:AdminShuttleWindow}"/> <cc:UICommandButton Command="callshuttle" Text="{Loc admin-player-actions-window-shuttle}" WindowType="{x:Type at:AdminShuttleWindow}"/>
<cc:CommandButton Command="adminlogs" Text="{Loc admin-player-actions-window-admin-logs}"/> <cc:CommandButton Command="adminlogs" Text="{Loc admin-player-actions-window-admin-logs}"/>
<cc:CommandButton Command="adminnotes" Text="{Loc admin-player-actions-window-admin-notes}"/>
</GridContainer> </GridContainer>
</BoxContainer> </BoxContainer>
</Control> </Control>

View File

@@ -0,0 +1,95 @@
using System.Threading.Tasks;
using Content.Server.Administration.Managers;
using Content.Server.Database;
using Content.Server.EUI;
using Content.Shared.Administration;
using Content.Shared.Administration.BanList;
using Content.Shared.Eui;
using Robust.Shared.Network;
namespace Content.Server.Administration.BanList;
public sealed class BanListEui : BaseEui
{
[Dependency] private readonly IAdminManager _admins = default!;
[Dependency] private readonly IPlayerLocator _playerLocator = default!;
[Dependency] private readonly IServerDbManager _db = default!;
public BanListEui()
{
IoCManager.InjectDependencies(this);
}
private Guid BanListPlayer { get; set; }
private string BanListPlayerName { get; set; } = string.Empty;
private List<SharedServerBan> Bans { get; set; } = new();
public override void Opened()
{
base.Opened();
_admins.OnPermsChanged += OnPermsChanged;
}
public override EuiStateBase GetNewState()
{
return new BanListEuiState(BanListPlayerName, Bans);
}
private void OnPermsChanged(AdminPermsChangedEventArgs args)
{
if (args.Player == Player && !_admins.HasAdminFlag(Player, AdminFlags.Ban))
{
Close();
}
else
{
StateDirty();
}
}
private async Task LoadFromDb()
{
Bans.Clear();
var userId = new NetUserId(BanListPlayer);
BanListPlayerName = (await _playerLocator.LookupIdAsync(userId))?.Username ??
string.Empty;
foreach (var ban in await _db.GetServerBansAsync(null, userId, null))
{
SharedServerUnban? unban = null;
if (ban.Unban is { } unbanDef)
{
var unbanningAdmin = unbanDef.UnbanningAdmin == null
? null
: (await _playerLocator.LookupIdAsync(unbanDef.UnbanningAdmin.Value))?.Username;
unban = new SharedServerUnban(unbanningAdmin, ban.Unban.UnbanTime.UtcDateTime);
}
Bans.Add(new SharedServerBan(
ban.Id,
ban.UserId,
ban.Address is { } address
? (address.address.ToString(), address.cidrMask)
: null,
ban.HWId == null ? null : Convert.ToBase64String(ban.HWId.Value.AsSpan()),
ban.BanTime.UtcDateTime,
ban.ExpirationTime?.UtcDateTime,
ban.Reason,
ban.BanningAdmin == null
? null
: (await _playerLocator.LookupIdAsync(ban.BanningAdmin.Value))?.Username,
unban
));
}
StateDirty();
}
public async Task ChangeBanListPlayer(Guid banListPlayer)
{
BanListPlayer = banListPlayer;
await LoadFromDb();
}
}

View File

@@ -1,9 +1,8 @@
using System.Text; using Content.Server.Administration.BanList;
using Content.Server.Database; using Content.Server.EUI;
using Content.Shared.Administration; using Content.Shared.Administration;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.Network;
namespace Content.Server.Administration.Commands namespace Content.Server.Administration.Commands
{ {
@@ -11,77 +10,44 @@ namespace Content.Server.Administration.Commands
public sealed class BanListCommand : IConsoleCommand public sealed class BanListCommand : IConsoleCommand
{ {
public string Command => "banlist"; public string Command => "banlist";
public string Description => "Lists somebody's bans"; public string Description => "Opens the ban list panel.";
public string Help => "Usage: <name or user ID>"; public string Help => $"Usage: {Command} <userid or username>";
public async void Execute(IConsoleShell shell, string argStr, string[] args) public async void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
if (args.Length != 1) if (shell.Player is not IPlayerSession player)
{ {
shell.WriteLine($"Invalid amount of args. {Help}"); shell.WriteError("This does not work from the server console.");
return; return;
} }
var plyMgr = IoCManager.Resolve<IPlayerManager>(); Guid banListPlayer;
var dbMan = IoCManager.Resolve<IServerDbManager>();
var target = args[0]; switch (args.Length)
NetUserId targetUid; {
case 1 when Guid.TryParse(args[0], out banListPlayer):
break;
case 1:
var locator = IoCManager.Resolve<IPlayerLocator>();
var dbGuid = await locator.LookupIdByNameAsync(args[0]);
if (plyMgr.TryGetSessionByUsername(target, out var targetSession)) if (dbGuid == null)
{ {
targetUid = targetSession.UserId; shell.WriteError($"Unable to find {args[0]} netuserid");
} return;
else if (Guid.TryParse(target, out var targetGuid)) }
{
targetUid = new NetUserId(targetGuid); banListPlayer = dbGuid.UserId;
} break;
else default:
{ shell.WriteError($"Invalid arguments.\n{Help}");
shell.WriteLine("Unable to find user with that name."); return;
return;
} }
var bans = await dbMan.GetServerBansAsync(null, targetUid, null); var euis = IoCManager.Resolve<EuiManager>();
var ui = new BanListEui();
if (bans.Count == 0) euis.OpenEui(ui, player);
{ await ui.ChangeBanListPlayer(banListPlayer);
shell.WriteLine("That user has no bans in their record.");
return;
}
var bansString = new StringBuilder("Bans in record:\n");
foreach (var ban in bans)
{
bansString
.Append("Ban ID: ")
.Append(ban.Id)
.Append("\n")
.Append("Banned in ")
.Append(ban.BanTime);
if (ban.ExpirationTime == null)
{
bansString.Append(".");
}
else
{
bansString
.Append(" until ")
.Append(ban.ExpirationTime.Value)
.Append(".");
}
bansString.Append("\n");
bansString
.Append("Reason: ")
.Append(ban.Reason)
.Append("\n\n");
}
shell.WriteLine(bansString.ToString());
} }
} }
} }

View File

@@ -4,7 +4,6 @@ using Content.Shared.Administration;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Console; using Robust.Shared.Console;
namespace Content.Server.Administration.Commands namespace Content.Server.Administration.Commands
{ {
[AdminCommand(AdminFlags.Ban)] [AdminCommand(AdminFlags.Ban)]
@@ -27,7 +26,7 @@ namespace Content.Server.Administration.Commands
if (!int.TryParse(args[0], out var banId)) if (!int.TryParse(args[0], out var banId))
{ {
shell.WriteLine($"Unable to parse {args[1]} as a ban id integer.\n{Help}"); shell.WriteLine($"Unable to parse {args[0]} as a ban id integer.\n{Help}");
return; return;
} }

View File

@@ -0,0 +1,17 @@
using Content.Shared.Eui;
using Robust.Shared.Serialization;
namespace Content.Shared.Administration.BanList;
[Serializable, NetSerializable]
public sealed class BanListEuiState : EuiStateBase
{
public BanListEuiState(string banListPlayerName, List<SharedServerBan> bans)
{
BanListPlayerName = banListPlayerName;
Bans = bans;
}
public string BanListPlayerName { get; }
public List<SharedServerBan> Bans { get; }
}

View File

@@ -0,0 +1,17 @@
using Robust.Shared.Network;
using Robust.Shared.Serialization;
namespace Content.Shared.Administration.BanList;
[Serializable, NetSerializable]
public sealed record SharedServerBan(
int? Id,
NetUserId? UserId,
(string address, int cidrMask)? Address,
string? HWId,
DateTime BanTime,
DateTime? ExpirationTime,
string Reason,
string? BanningAdminName,
SharedServerUnban? Unban
);

View File

@@ -0,0 +1,9 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Administration.BanList;
[Serializable, NetSerializable]
public sealed record SharedServerUnban(
string? UnbanningAdmin,
DateTime UnbanTime
);

View File

@@ -1,3 +1,4 @@
admin-player-actions-bans = Ban List
admin-player-actions-notes = Notes admin-player-actions-notes = Notes
admin-player-actions-kick = Kick admin-player-actions-kick = Kick
admin-player-actions-ban = Ban admin-player-actions-ban = Ban

View File

@@ -0,0 +1,15 @@
# UI
ban-list-header-ids = Ids
ban-list-header-reason = Reason
ban-list-header-time = Ban time
ban-list-header-expires = Expires
ban-list-header-banning-admin = Banning admin
ban-list-title = Bans for {$player}
ban-list-hidden = Hidden
ban-list-ip = IP: {$ip}
ban-list-hwid = HWID: {$hwid}
ban-list-guid = GUID: {$guid}
ban-list-permanent = PERMANENT
ban-list-unbanned = Unbanned: {$date}
ban-list-unbanned-by = By {$unbanner}