Remove baby jail (#34443)
* Remove baby jail Closes #33893 * Test fail fix.
This commit is contained in:
@@ -6,8 +6,7 @@
|
|||||||
xmlns:tabs="clr-namespace:Content.Client.Administration.UI.Tabs"
|
xmlns:tabs="clr-namespace:Content.Client.Administration.UI.Tabs"
|
||||||
xmlns:playerTab="clr-namespace:Content.Client.Administration.UI.Tabs.PlayerTab"
|
xmlns:playerTab="clr-namespace:Content.Client.Administration.UI.Tabs.PlayerTab"
|
||||||
xmlns:objectsTab="clr-namespace:Content.Client.Administration.UI.Tabs.ObjectsTab"
|
xmlns:objectsTab="clr-namespace:Content.Client.Administration.UI.Tabs.ObjectsTab"
|
||||||
xmlns:panic="clr-namespace:Content.Client.Administration.UI.Tabs.PanicBunkerTab"
|
xmlns:panic="clr-namespace:Content.Client.Administration.UI.Tabs.PanicBunkerTab">
|
||||||
xmlns:baby="clr-namespace:Content.Client.Administration.UI.Tabs.BabyJailTab">
|
|
||||||
<TabContainer Name="MasterTabContainer">
|
<TabContainer Name="MasterTabContainer">
|
||||||
<adminTab:AdminTab />
|
<adminTab:AdminTab />
|
||||||
<adminbusTab:AdminbusTab />
|
<adminbusTab:AdminbusTab />
|
||||||
@@ -15,7 +14,6 @@
|
|||||||
<tabs:RoundTab />
|
<tabs:RoundTab />
|
||||||
<tabs:ServerTab />
|
<tabs:ServerTab />
|
||||||
<panic:PanicBunkerTab Name="PanicBunkerControl" Access="Public" />
|
<panic:PanicBunkerTab Name="PanicBunkerControl" Access="Public" />
|
||||||
<baby:BabyJailTab Name="BabyJailControl" Access="Public" />
|
|
||||||
<playerTab:PlayerTab Name="PlayerTabControl" Access="Public" />
|
<playerTab:PlayerTab Name="PlayerTabControl" Access="Public" />
|
||||||
<objectsTab:ObjectsTab Name="ObjectsTabControl" Access="Public" />
|
<objectsTab:ObjectsTab Name="ObjectsTabControl" Access="Public" />
|
||||||
</TabContainer>
|
</TabContainer>
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ public sealed partial class AdminMenuWindow : DefaultWindow
|
|||||||
MasterTabContainer.SetTabTitle((int) TabIndex.Round, Loc.GetString("admin-menu-round-tab"));
|
MasterTabContainer.SetTabTitle((int) TabIndex.Round, Loc.GetString("admin-menu-round-tab"));
|
||||||
MasterTabContainer.SetTabTitle((int) TabIndex.Server, Loc.GetString("admin-menu-server-tab"));
|
MasterTabContainer.SetTabTitle((int) TabIndex.Server, Loc.GetString("admin-menu-server-tab"));
|
||||||
MasterTabContainer.SetTabTitle((int) TabIndex.PanicBunker, Loc.GetString("admin-menu-panic-bunker-tab"));
|
MasterTabContainer.SetTabTitle((int) TabIndex.PanicBunker, Loc.GetString("admin-menu-panic-bunker-tab"));
|
||||||
/*
|
|
||||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
MasterTabContainer.SetTabTitle((int) TabIndex.BabyJail, Loc.GetString("admin-menu-baby-jail-tab"));
|
|
||||||
MasterTabContainer.SetTabTitle((int) TabIndex.Players, Loc.GetString("admin-menu-players-tab"));
|
MasterTabContainer.SetTabTitle((int) TabIndex.Players, Loc.GetString("admin-menu-players-tab"));
|
||||||
MasterTabContainer.SetTabTitle((int) TabIndex.Objects, Loc.GetString("admin-menu-objects-tab"));
|
MasterTabContainer.SetTabTitle((int) TabIndex.Objects, Loc.GetString("admin-menu-objects-tab"));
|
||||||
MasterTabContainer.OnTabChanged += OnTabChanged;
|
MasterTabContainer.OnTabChanged += OnTabChanged;
|
||||||
@@ -52,7 +48,6 @@ public sealed partial class AdminMenuWindow : DefaultWindow
|
|||||||
Round,
|
Round,
|
||||||
Server,
|
Server,
|
||||||
PanicBunker,
|
PanicBunker,
|
||||||
BabyJail,
|
|
||||||
Players,
|
Players,
|
||||||
Objects,
|
Objects,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
<controls:BabyJailStatusWindow
|
|
||||||
xmlns="https://spacestation14.io"
|
|
||||||
xmlns:controls="clr-namespace:Content.Client.Administration.UI.Tabs.BabyJailTab"
|
|
||||||
Title="{Loc admin-ui-baby-jail-window-title}">
|
|
||||||
<RichTextLabel Name="MessageLabel" Access="Public" />
|
|
||||||
</controls:BabyJailStatusWindow>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using Content.Client.Message;
|
|
||||||
using Content.Client.UserInterface.Controls;
|
|
||||||
using Robust.Client.AutoGenerated;
|
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
|
||||||
using Robust.Client.UserInterface.XAML;
|
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.BabyJailTab;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Remove me once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
[GenerateTypedNameReferences]
|
|
||||||
public sealed partial class BabyJailStatusWindow : FancyWindow
|
|
||||||
{
|
|
||||||
public BabyJailStatusWindow()
|
|
||||||
{
|
|
||||||
RobustXamlLoader.Load(this);
|
|
||||||
MessageLabel.SetMarkup(Loc.GetString("admin-ui-baby-jail-is-enabled"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<controls:BabyJailTab
|
|
||||||
xmlns="https://spacestation14.io"
|
|
||||||
xmlns:controls="clr-namespace:Content.Client.Administration.UI.Tabs.BabyJailTab"
|
|
||||||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
|
||||||
Margin="4">
|
|
||||||
<BoxContainer Orientation="Vertical">
|
|
||||||
<cc:CommandButton Name="EnabledButton" Command="babyjail" ToggleMode="True"
|
|
||||||
Text="{Loc admin-ui-baby-jail-disabled}"
|
|
||||||
ToolTip="{Loc admin-ui-baby-jail-tooltip}" />
|
|
||||||
<cc:CommandButton Name="ShowReasonButton" Command="babyjail_show_reason"
|
|
||||||
ToggleMode="True" Text="{Loc admin-ui-baby-jail-show-reason}"
|
|
||||||
ToolTip="{Loc admin-ui-baby-jail-show-reason-tooltip}" />
|
|
||||||
<BoxContainer Orientation="Vertical" Margin="0 10 0 0">
|
|
||||||
<BoxContainer Orientation="Horizontal" Margin="2">
|
|
||||||
<Label Text="{Loc admin-ui-baby-jail-max-account-age}" MinWidth="175" />
|
|
||||||
<LineEdit Name="MaxAccountAge" MinWidth="50" Margin="0 0 5 0" />
|
|
||||||
<Label Text="{Loc generic-minutes}" />
|
|
||||||
</BoxContainer>
|
|
||||||
<BoxContainer Orientation="Horizontal" Margin="2">
|
|
||||||
<Label Text="{Loc admin-ui-baby-jail-max-overall-minutes}" MinWidth="175" />
|
|
||||||
<LineEdit Name="MaxOverallMinutes" MinWidth="50" Margin="0 0 5 0" />
|
|
||||||
<Label Text="{Loc generic-minutes}" />
|
|
||||||
</BoxContainer>
|
|
||||||
</BoxContainer>
|
|
||||||
</BoxContainer>
|
|
||||||
</controls:BabyJailTab>
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
using Content.Shared.Administration.Events;
|
|
||||||
using Robust.Client.AutoGenerated;
|
|
||||||
using Robust.Client.UserInterface;
|
|
||||||
using Robust.Client.UserInterface.XAML;
|
|
||||||
using Robust.Shared.Console;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Remove me once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.BabyJailTab;
|
|
||||||
|
|
||||||
[GenerateTypedNameReferences]
|
|
||||||
public sealed partial class BabyJailTab : Control
|
|
||||||
{
|
|
||||||
[Dependency] private readonly IConsoleHost _console = default!;
|
|
||||||
|
|
||||||
private string _maxAccountAge;
|
|
||||||
private string _maxOverallMinutes;
|
|
||||||
|
|
||||||
public BabyJailTab()
|
|
||||||
{
|
|
||||||
RobustXamlLoader.Load(this);
|
|
||||||
IoCManager.InjectDependencies(this);
|
|
||||||
|
|
||||||
MaxAccountAge.OnTextEntered += args => SendMaxAccountAge(args.Text);
|
|
||||||
MaxAccountAge.OnFocusExit += args => SendMaxAccountAge(args.Text);
|
|
||||||
_maxAccountAge = MaxAccountAge.Text;
|
|
||||||
|
|
||||||
MaxOverallMinutes.OnTextEntered += args => SendMaxOverallMinutes(args.Text);
|
|
||||||
MaxOverallMinutes.OnFocusExit += args => SendMaxOverallMinutes(args.Text);
|
|
||||||
_maxOverallMinutes = MaxOverallMinutes.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SendMaxAccountAge(string text)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(text) ||
|
|
||||||
text == _maxAccountAge ||
|
|
||||||
!int.TryParse(text, out var minutes))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_console.ExecuteCommand($"babyjail_max_account_age {minutes}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SendMaxOverallMinutes(string text)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(text) ||
|
|
||||||
text == _maxOverallMinutes ||
|
|
||||||
!int.TryParse(text, out var minutes))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_console.ExecuteCommand($"babyjail_max_overall_minutes {minutes}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateStatus(BabyJailStatus status)
|
|
||||||
{
|
|
||||||
EnabledButton.Pressed = status.Enabled;
|
|
||||||
EnabledButton.Text = Loc.GetString(status.Enabled
|
|
||||||
? "admin-ui-baby-jail-enabled"
|
|
||||||
: "admin-ui-baby-jail-disabled"
|
|
||||||
);
|
|
||||||
EnabledButton.ModulateSelfOverride = status.Enabled ? Color.Red : null;
|
|
||||||
ShowReasonButton.Pressed = status.ShowReason;
|
|
||||||
|
|
||||||
MaxAccountAge.Text = status.MaxAccountAgeMinutes.ToString();
|
|
||||||
_maxAccountAge = MaxAccountAge.Text;
|
|
||||||
|
|
||||||
MaxOverallMinutes.Text = status.MaxOverallMinutes.ToString();
|
|
||||||
_maxOverallMinutes = MaxOverallMinutes.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ using Content.Client.Administration.Systems;
|
|||||||
using Content.Client.Administration.UI;
|
using Content.Client.Administration.UI;
|
||||||
using Content.Client.Administration.UI.Tabs.ObjectsTab;
|
using Content.Client.Administration.UI.Tabs.ObjectsTab;
|
||||||
using Content.Client.Administration.UI.Tabs.PanicBunkerTab;
|
using Content.Client.Administration.UI.Tabs.PanicBunkerTab;
|
||||||
using Content.Client.Administration.UI.Tabs.BabyJailTab;
|
|
||||||
using Content.Client.Administration.UI.Tabs.PlayerTab;
|
using Content.Client.Administration.UI.Tabs.PlayerTab;
|
||||||
using Content.Client.Gameplay;
|
using Content.Client.Gameplay;
|
||||||
using Content.Client.Lobby;
|
using Content.Client.Lobby;
|
||||||
@@ -38,13 +37,11 @@ public sealed class AdminUIController : UIController,
|
|||||||
private AdminMenuWindow? _window;
|
private AdminMenuWindow? _window;
|
||||||
private MenuButton? AdminButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.AdminButton;
|
private MenuButton? AdminButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.AdminButton;
|
||||||
private PanicBunkerStatus? _panicBunker;
|
private PanicBunkerStatus? _panicBunker;
|
||||||
private BabyJailStatus? _babyJail;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeNetworkEvent<PanicBunkerChangedEvent>(OnPanicBunkerUpdated);
|
SubscribeNetworkEvent<PanicBunkerChangedEvent>(OnPanicBunkerUpdated);
|
||||||
SubscribeNetworkEvent<BabyJailChangedEvent>(OnBabyJailUpdated);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPanicBunkerUpdated(PanicBunkerChangedEvent msg, EntitySessionEventArgs args)
|
private void OnPanicBunkerUpdated(PanicBunkerChangedEvent msg, EntitySessionEventArgs args)
|
||||||
@@ -59,18 +56,6 @@ public sealed class AdminUIController : UIController,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBabyJailUpdated(BabyJailChangedEvent msg, EntitySessionEventArgs args)
|
|
||||||
{
|
|
||||||
var showDialog = _babyJail == null && msg.Status.Enabled;
|
|
||||||
_babyJail = msg.Status;
|
|
||||||
_window?.BabyJailControl.UpdateStatus(msg.Status);
|
|
||||||
|
|
||||||
if (showDialog)
|
|
||||||
{
|
|
||||||
UIManager.CreateWindow<BabyJailStatusWindow>().OpenCentered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnStateEntered(GameplayState state)
|
public void OnStateEntered(GameplayState state)
|
||||||
{
|
{
|
||||||
EnsureWindow();
|
EnsureWindow();
|
||||||
@@ -116,13 +101,6 @@ public sealed class AdminUIController : UIController,
|
|||||||
if (_panicBunker != null)
|
if (_panicBunker != null)
|
||||||
_window.PanicBunkerControl.UpdateStatus(_panicBunker);
|
_window.PanicBunkerControl.UpdateStatus(_panicBunker);
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (_babyJail != null)
|
|
||||||
_window.BabyJailControl.UpdateStatus(_babyJail);
|
|
||||||
|
|
||||||
_window.PlayerTabControl.OnEntryKeyBindDown += PlayerTabEntryKeyBindDown;
|
_window.PlayerTabControl.OnEntryKeyBindDown += PlayerTabEntryKeyBindDown;
|
||||||
_window.ObjectsTabControl.OnEntryKeyBindDown += ObjectsTabEntryKeyBindDown;
|
_window.ObjectsTabControl.OnEntryKeyBindDown += ObjectsTabEntryKeyBindDown;
|
||||||
_window.OnOpen += OnWindowOpen;
|
_window.OnOpen += OnWindowOpen;
|
||||||
|
|||||||
@@ -973,10 +973,10 @@ namespace Content.Server.Database
|
|||||||
Full = 2,
|
Full = 2,
|
||||||
Panic = 3,
|
Panic = 3,
|
||||||
/*
|
/*
|
||||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*
|
|
||||||
* If baby jail is removed, please reserve this value for as long as can reasonably be done to prevent causing ambiguity in connection denial reasons.
|
* If baby jail is removed, please reserve this value for as long as can reasonably be done to prevent causing ambiguity in connection denial reasons.
|
||||||
* Reservation by commenting out the value is likely sufficient for this purpose, but may impact projects which depend on SS14 like SS14.Admin.
|
* Reservation by commenting out the value is likely sufficient for this purpose, but may impact projects which depend on SS14 like SS14.Admin.
|
||||||
|
*
|
||||||
|
* Edit: It has
|
||||||
*/
|
*/
|
||||||
BabyJail = 4,
|
BabyJail = 4,
|
||||||
/// Results from rejected connections with external API checking tools
|
/// Results from rejected connections with external API checking tools
|
||||||
|
|||||||
@@ -1,139 +0,0 @@
|
|||||||
using Content.Shared.Administration;
|
|
||||||
using Content.Shared.CCVar;
|
|
||||||
using Robust.Shared.Configuration;
|
|
||||||
using Robust.Shared.Console;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Content.Server.Administration.Commands;
|
|
||||||
|
|
||||||
[AdminCommand(AdminFlags.Server)]
|
|
||||||
public sealed class BabyJailCommand : LocalizedCommands
|
|
||||||
{
|
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
||||||
|
|
||||||
public override string Command => "babyjail";
|
|
||||||
|
|
||||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
|
||||||
var toggle = Toggle(CCVars.BabyJailEnabled, shell, args, _cfg);
|
|
||||||
if (toggle == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
shell.WriteLine(Loc.GetString(toggle.Value ? "babyjail-command-enabled" : "babyjail-command-disabled"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool? Toggle(CVarDef<bool> cvar, IConsoleShell shell, string[] args, IConfigurationManager config)
|
|
||||||
{
|
|
||||||
if (args.Length > 1)
|
|
||||||
{
|
|
||||||
shell.WriteError(Loc.GetString("shell-need-between-arguments",("lower", 0), ("upper", 1)));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var enabled = config.GetCVar(cvar);
|
|
||||||
|
|
||||||
switch (args.Length)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
enabled = !enabled;
|
|
||||||
break;
|
|
||||||
case 1 when !bool.TryParse(args[0], out enabled):
|
|
||||||
shell.WriteError(Loc.GetString("shell-argument-must-be-boolean"));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
config.SetCVar(cvar, enabled);
|
|
||||||
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[AdminCommand(AdminFlags.Server)]
|
|
||||||
public sealed class BabyJailShowReasonCommand : LocalizedCommands
|
|
||||||
{
|
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
||||||
|
|
||||||
public override string Command => "babyjail_show_reason";
|
|
||||||
|
|
||||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
|
||||||
var toggle = BabyJailCommand.Toggle(CCVars.BabyJailShowReason, shell, args, _cfg);
|
|
||||||
if (toggle == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
shell.WriteLine(Loc.GetString(toggle.Value
|
|
||||||
? "babyjail-command-show-reason-enabled"
|
|
||||||
: "babyjail-command-show-reason-disabled"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[AdminCommand(AdminFlags.Server)]
|
|
||||||
public sealed class BabyJailMinAccountAgeCommand : LocalizedCommands
|
|
||||||
{
|
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
||||||
|
|
||||||
public override string Command => "babyjail_max_account_age";
|
|
||||||
|
|
||||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
|
||||||
switch (args.Length)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
var current = _cfg.GetCVar(CCVars.BabyJailMaxAccountAge);
|
|
||||||
shell.WriteLine(Loc.GetString("babyjail-command-max-account-age-is", ("minutes", current)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case > 1:
|
|
||||||
shell.WriteError(Loc.GetString("shell-need-between-arguments",("lower", 0), ("upper", 1)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!int.TryParse(args[0], out var minutes))
|
|
||||||
{
|
|
||||||
shell.WriteError(Loc.GetString("shell-argument-must-be-number"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_cfg.SetCVar(CCVars.BabyJailMaxAccountAge, minutes);
|
|
||||||
shell.WriteLine(Loc.GetString("babyjail-command-max-account-age-set", ("minutes", minutes)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[AdminCommand(AdminFlags.Server)]
|
|
||||||
public sealed class BabyJailMinOverallHoursCommand : LocalizedCommands
|
|
||||||
{
|
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
||||||
|
|
||||||
public override string Command => "babyjail_max_overall_minutes";
|
|
||||||
|
|
||||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
|
||||||
switch (args.Length)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
var current = _cfg.GetCVar(CCVars.BabyJailMaxOverallMinutes);
|
|
||||||
shell.WriteLine(Loc.GetString("babyjail-command-max-overall-minutes-is", ("minutes", current)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case > 1:
|
|
||||||
shell.WriteError(Loc.GetString("shell-need-between-arguments",("lower", 0), ("upper", 1)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!int.TryParse(args[0], out var hours))
|
|
||||||
{
|
|
||||||
shell.WriteError(Loc.GetString("shell-argument-must-be-number"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_cfg.SetCVar(CCVars.BabyJailMaxOverallMinutes, hours);
|
|
||||||
shell.WriteLine(Loc.GetString("babyjail-command-overall-minutes-set", ("hours", hours)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -64,7 +64,6 @@ public sealed class AdminSystem : EntitySystem
|
|||||||
|
|
||||||
private readonly HashSet<NetUserId> _roundActivePlayers = new();
|
private readonly HashSet<NetUserId> _roundActivePlayers = new();
|
||||||
public readonly PanicBunkerStatus PanicBunker = new();
|
public readonly PanicBunkerStatus PanicBunker = new();
|
||||||
public readonly BabyJailStatus BabyJail = new();
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -83,16 +82,6 @@ public sealed class AdminSystem : EntitySystem
|
|||||||
Subs.CVar(_config, CCVars.PanicBunkerMinAccountAge, OnPanicBunkerMinAccountAgeChanged, true);
|
Subs.CVar(_config, CCVars.PanicBunkerMinAccountAge, OnPanicBunkerMinAccountAgeChanged, true);
|
||||||
Subs.CVar(_config, CCVars.PanicBunkerMinOverallMinutes, OnPanicBunkerMinOverallMinutesChanged, true);
|
Subs.CVar(_config, CCVars.PanicBunkerMinOverallMinutes, OnPanicBunkerMinOverallMinutesChanged, true);
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Baby Jail Settings
|
|
||||||
Subs.CVar(_config, CCVars.BabyJailEnabled, OnBabyJailChanged, true);
|
|
||||||
Subs.CVar(_config, CCVars.BabyJailShowReason, OnBabyJailShowReasonChanged, true);
|
|
||||||
Subs.CVar(_config, CCVars.BabyJailMaxAccountAge, OnBabyJailMaxAccountAgeChanged, true);
|
|
||||||
Subs.CVar(_config, CCVars.BabyJailMaxOverallMinutes, OnBabyJailMaxOverallMinutesChanged, true);
|
|
||||||
|
|
||||||
SubscribeLocalEvent<IdentityChangedEvent>(OnIdentityChanged);
|
SubscribeLocalEvent<IdentityChangedEvent>(OnIdentityChanged);
|
||||||
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
|
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
|
||||||
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetached);
|
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetached);
|
||||||
@@ -279,17 +268,6 @@ public sealed class AdminSystem : EntitySystem
|
|||||||
SendPanicBunkerStatusAll();
|
SendPanicBunkerStatusAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBabyJailChanged(bool enabled)
|
|
||||||
{
|
|
||||||
BabyJail.Enabled = enabled;
|
|
||||||
_chat.SendAdminAlert(Loc.GetString(enabled
|
|
||||||
? "admin-ui-baby-jail-enabled-admin-alert"
|
|
||||||
: "admin-ui-baby-jail-disabled-admin-alert"
|
|
||||||
));
|
|
||||||
|
|
||||||
SendBabyJailStatusAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPanicBunkerDisableWithAdminsChanged(bool enabled)
|
private void OnPanicBunkerDisableWithAdminsChanged(bool enabled)
|
||||||
{
|
{
|
||||||
PanicBunker.DisableWithAdmins = enabled;
|
PanicBunker.DisableWithAdmins = enabled;
|
||||||
@@ -314,36 +292,18 @@ public sealed class AdminSystem : EntitySystem
|
|||||||
SendPanicBunkerStatusAll();
|
SendPanicBunkerStatusAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBabyJailShowReasonChanged(bool enabled)
|
|
||||||
{
|
|
||||||
BabyJail.ShowReason = enabled;
|
|
||||||
SendBabyJailStatusAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPanicBunkerMinAccountAgeChanged(int minutes)
|
private void OnPanicBunkerMinAccountAgeChanged(int minutes)
|
||||||
{
|
{
|
||||||
PanicBunker.MinAccountAgeMinutes = minutes;
|
PanicBunker.MinAccountAgeMinutes = minutes;
|
||||||
SendPanicBunkerStatusAll();
|
SendPanicBunkerStatusAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBabyJailMaxAccountAgeChanged(int minutes)
|
|
||||||
{
|
|
||||||
BabyJail.MaxAccountAgeMinutes = minutes;
|
|
||||||
SendBabyJailStatusAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPanicBunkerMinOverallMinutesChanged(int minutes)
|
private void OnPanicBunkerMinOverallMinutesChanged(int minutes)
|
||||||
{
|
{
|
||||||
PanicBunker.MinOverallMinutes = minutes;
|
PanicBunker.MinOverallMinutes = minutes;
|
||||||
SendPanicBunkerStatusAll();
|
SendPanicBunkerStatusAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBabyJailMaxOverallMinutesChanged(int minutes)
|
|
||||||
{
|
|
||||||
BabyJail.MaxOverallMinutes = minutes;
|
|
||||||
SendBabyJailStatusAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdatePanicBunker()
|
private void UpdatePanicBunker()
|
||||||
{
|
{
|
||||||
var hasAdmins = false;
|
var hasAdmins = false;
|
||||||
@@ -390,15 +350,6 @@ public sealed class AdminSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendBabyJailStatusAll()
|
|
||||||
{
|
|
||||||
var ev = new BabyJailChangedEvent(BabyJail);
|
|
||||||
foreach (var admin in _adminManager.AllAdmins)
|
|
||||||
{
|
|
||||||
RaiseNetworkEvent(ev, admin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Erases a player from the round.
|
/// Erases a player from the round.
|
||||||
/// This removes them and any trace of them from the round, deleting their
|
/// This removes them and any trace of them from the round, deleting their
|
||||||
|
|||||||
@@ -283,14 +283,6 @@ namespace Content.Server.Connection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cfg.GetCVar(CCVars.BabyJailEnabled) && adminData == null)
|
|
||||||
{
|
|
||||||
var result = await IsInvalidConnectionDueToBabyJail(userId, e);
|
|
||||||
|
|
||||||
if (result.IsInvalid)
|
|
||||||
return (ConnectionDenyReason.BabyJail, result.Reason, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
var wasInGame = EntitySystem.TryGet<GameTicker>(out var ticker) &&
|
var wasInGame = EntitySystem.TryGet<GameTicker>(out var ticker) &&
|
||||||
ticker.PlayerGameStatuses.TryGetValue(userId, out var status) &&
|
ticker.PlayerGameStatuses.TryGetValue(userId, out var status) &&
|
||||||
status == PlayerGameStatus.JoinedGame;
|
status == PlayerGameStatus.JoinedGame;
|
||||||
@@ -349,72 +341,6 @@ namespace Content.Server.Connection
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<(bool IsInvalid, string Reason)> IsInvalidConnectionDueToBabyJail(NetUserId userId, NetConnectingArgs e)
|
|
||||||
{
|
|
||||||
// If you're whitelisted then bypass this whole thing
|
|
||||||
if (await _db.GetWhitelistStatusAsync(userId))
|
|
||||||
return (false, "");
|
|
||||||
|
|
||||||
// Initial cvar retrieval
|
|
||||||
var showReason = _cfg.GetCVar(CCVars.BabyJailShowReason);
|
|
||||||
var reason = _cfg.GetCVar(CCVars.BabyJailCustomReason);
|
|
||||||
var maxAccountAgeMinutes = _cfg.GetCVar(CCVars.BabyJailMaxAccountAge);
|
|
||||||
var maxPlaytimeMinutes = _cfg.GetCVar(CCVars.BabyJailMaxOverallMinutes);
|
|
||||||
|
|
||||||
// Wait some time to lookup data
|
|
||||||
var record = await _db.GetPlayerRecordByUserId(userId);
|
|
||||||
|
|
||||||
// No player record = new account or the DB is having a skill issue
|
|
||||||
if (record == null)
|
|
||||||
return (false, "");
|
|
||||||
|
|
||||||
var isAccountAgeInvalid = record.FirstSeenTime.CompareTo(DateTimeOffset.UtcNow - TimeSpan.FromMinutes(maxAccountAgeMinutes)) <= 0;
|
|
||||||
|
|
||||||
if (isAccountAgeInvalid)
|
|
||||||
{
|
|
||||||
_sawmill.Debug($"Baby jail will deny {userId} for account age {record.FirstSeenTime}"); // Remove on or after 2024-09
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAccountAgeInvalid && showReason)
|
|
||||||
{
|
|
||||||
var locAccountReason = reason != string.Empty
|
|
||||||
? reason
|
|
||||||
: Loc.GetString("baby-jail-account-denied-reason",
|
|
||||||
("reason",
|
|
||||||
Loc.GetString(
|
|
||||||
"baby-jail-account-reason-account",
|
|
||||||
("minutes", maxAccountAgeMinutes))));
|
|
||||||
|
|
||||||
return (true, locAccountReason);
|
|
||||||
}
|
|
||||||
|
|
||||||
var overallTime = ( await _db.GetPlayTimes(e.UserId)).Find(p => p.Tracker == PlayTimeTrackingShared.TrackerOverall);
|
|
||||||
var isTotalPlaytimeInvalid = overallTime != null && overallTime.TimeSpent.TotalMinutes >= maxPlaytimeMinutes;
|
|
||||||
|
|
||||||
if (isTotalPlaytimeInvalid)
|
|
||||||
{
|
|
||||||
_sawmill.Debug($"Baby jail will deny {userId} for playtime {overallTime!.TimeSpent}"); // Remove on or after 2024-09
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isTotalPlaytimeInvalid && showReason)
|
|
||||||
{
|
|
||||||
var locPlaytimeReason = reason != string.Empty
|
|
||||||
? reason
|
|
||||||
: Loc.GetString("baby-jail-account-denied-reason",
|
|
||||||
("reason",
|
|
||||||
Loc.GetString(
|
|
||||||
"baby-jail-account-reason-overall",
|
|
||||||
("minutes", maxPlaytimeMinutes))));
|
|
||||||
|
|
||||||
return (true, locPlaytimeReason);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!showReason && isTotalPlaytimeInvalid || isAccountAgeInvalid)
|
|
||||||
return (true, Loc.GetString("baby-jail-account-denied"));
|
|
||||||
|
|
||||||
return (false, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool HasTemporaryBypass(NetUserId user)
|
private bool HasTemporaryBypass(NetUserId user)
|
||||||
{
|
{
|
||||||
return _temporaryBypasses.TryGetValue(user, out var time) && time > _gameTiming.RealTime;
|
return _temporaryBypasses.TryGetValue(user, out var time) && time > _gameTiming.RealTime;
|
||||||
|
|||||||
@@ -46,12 +46,6 @@ namespace Content.Server.GameTicking
|
|||||||
jObject["players"] = _playerManager.PlayerCount;
|
jObject["players"] = _playerManager.PlayerCount;
|
||||||
jObject["soft_max_players"] = _cfg.GetCVar(CCVars.SoftMaxPlayers);
|
jObject["soft_max_players"] = _cfg.GetCVar(CCVars.SoftMaxPlayers);
|
||||||
jObject["panic_bunker"] = _cfg.GetCVar(CCVars.PanicBunkerEnabled);
|
jObject["panic_bunker"] = _cfg.GetCVar(CCVars.PanicBunkerEnabled);
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
jObject["baby_jail"] = _cfg.GetCVar(CCVars.BabyJailEnabled);
|
|
||||||
jObject["run_level"] = (int) _runLevel;
|
jObject["run_level"] = (int) _runLevel;
|
||||||
if (preset != null)
|
if (preset != null)
|
||||||
jObject["preset"] = Loc.GetString(preset.ModeTitle);
|
jObject["preset"] = Loc.GetString(preset.ModeTitle);
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
using Robust.Shared.Serialization;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Content.Shared.Administration.Events;
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public sealed class BabyJailStatus
|
|
||||||
{
|
|
||||||
public bool Enabled;
|
|
||||||
public bool ShowReason;
|
|
||||||
public int MaxAccountAgeMinutes;
|
|
||||||
public int MaxOverallMinutes;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public sealed class BabyJailChangedEvent(BabyJailStatus status) : EntityEventArgs
|
|
||||||
{
|
|
||||||
public BabyJailStatus Status = status;
|
|
||||||
}
|
|
||||||
@@ -198,48 +198,6 @@ public sealed partial class CCVars
|
|||||||
public static readonly CVarDef<bool> BypassBunkerWhitelist =
|
public static readonly CVarDef<bool> BypassBunkerWhitelist =
|
||||||
CVarDef.Create("game.panic_bunker.whitelisted_can_bypass", true, CVar.SERVERONLY);
|
CVarDef.Create("game.panic_bunker.whitelisted_can_bypass", true, CVar.SERVERONLY);
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the baby jail is currently enabled.
|
|
||||||
/// </summary>
|
|
||||||
public static readonly CVarDef<bool> BabyJailEnabled =
|
|
||||||
CVarDef.Create("game.baby_jail.enabled", false, CVar.NOTIFY | CVar.REPLICATED | CVar.SERVER);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Show reason of disconnect for user or not.
|
|
||||||
/// </summary>
|
|
||||||
public static readonly CVarDef<bool> BabyJailShowReason =
|
|
||||||
CVarDef.Create("game.baby_jail.show_reason", false, CVar.SERVERONLY);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Maximum age of the account (from server's PoV, so from first-seen date) in minutes that can access baby
|
|
||||||
/// jailed servers.
|
|
||||||
/// </summary>
|
|
||||||
public static readonly CVarDef<int> BabyJailMaxAccountAge =
|
|
||||||
CVarDef.Create("game.baby_jail.max_account_age", 1440, CVar.SERVERONLY);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Maximum overall played time allowed to access baby jailed servers.
|
|
||||||
/// </summary>
|
|
||||||
public static readonly CVarDef<int> BabyJailMaxOverallMinutes =
|
|
||||||
CVarDef.Create("game.baby_jail.max_overall_minutes", 120, CVar.SERVERONLY);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A custom message that will be used for connections denied due to the baby jail.
|
|
||||||
/// If not empty, then will overwrite <see cref="BabyJailShowReason"/>
|
|
||||||
/// </summary>
|
|
||||||
public static readonly CVarDef<string> BabyJailCustomReason =
|
|
||||||
CVarDef.Create("game.baby_jail.custom_reason", string.Empty, CVar.SERVERONLY);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Allow bypassing the baby jail if the user is whitelisted.
|
|
||||||
/// </summary>
|
|
||||||
public static readonly CVarDef<bool> BypassBabyJailWhitelist =
|
|
||||||
CVarDef.Create("game.baby_jail.whitelisted_can_bypass", true, CVar.SERVERONLY);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable IPIntel for blocking VPN connections from new players.
|
/// Enable IPIntel for blocking VPN connections from new players.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -11,12 +11,6 @@ panic_bunker.enabled = false
|
|||||||
panic_bunker.disable_with_admins = false
|
panic_bunker.disable_with_admins = false
|
||||||
panic_bunker.enable_without_admins = false
|
panic_bunker.enable_without_admins = false
|
||||||
panic_bunker.custom_reason = ""
|
panic_bunker.custom_reason = ""
|
||||||
baby_jail.enabled = true
|
|
||||||
baby_jail.show_reason = true
|
|
||||||
baby_jail.max_account_age = 5256000 # 10 years. Disabling this check specifically isn't currently supported
|
|
||||||
baby_jail.max_overall_minutes = 3000 # 50 hours
|
|
||||||
baby_jail.custom_reason = "Sorry! Only new and whitelisted players can join this server. Apply to be whitelisted in our Discord server (discord.ss14.io) or try joining another server instead!"
|
|
||||||
baby_jail.whitelisted_can_bypass = true
|
|
||||||
|
|
||||||
[hub]
|
[hub]
|
||||||
tags = "lang:en,region:am_n_e,rp:low"
|
tags = "lang:en,region:am_n_e,rp:low"
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
cmd-babyjail-desc = Toggles the baby jail, which enables stricter restrictions on who's allowed to join the server.
|
|
||||||
cmd-babyjail-help = Usage: babyjail
|
|
||||||
babyjail-command-enabled = Baby jail has been enabled.
|
|
||||||
babyjail-command-disabled = Baby jail has been disabled.
|
|
||||||
|
|
||||||
cmd-babyjail_show_reason-desc = Toggles whether or not to show connecting clients the reason why the baby jail blocked them from joining.
|
|
||||||
cmd-babyjail_show_reason-help = Usage: babyjail_show_reason
|
|
||||||
babyjail-command-show-reason-enabled = The baby jail will now show a reason to users it blocks from connecting.
|
|
||||||
babyjail-command-show-reason-disabled = The baby jail will no longer show a reason to users it blocks from connecting.
|
|
||||||
|
|
||||||
cmd-babyjail_max_account_age-desc = Gets or sets the maximum account age in minutes that an account can have to be allowed to connect with the baby jail enabled.
|
|
||||||
cmd-babyjail_max_account_age-help = Usage: babyjail_max_account_age <minutes>
|
|
||||||
babyjail-command-max-account-age-is = The maximum account age for the baby jail is {$minutes} minutes.
|
|
||||||
babyjail-command-max-account-age-set = Set the maximum account age for the baby jail to {$minutes} minutes.
|
|
||||||
|
|
||||||
cmd-babyjail_max_overall_minutes-desc = Gets or sets the maximum overall playtime in minutes that an account can have to be allowed to connect with the baby jail enabled.
|
|
||||||
cmd-babyjail_max_overall_minutes-help = Usage: babyjail_max_overall_minutes <minutes>
|
|
||||||
babyjail-command-max-overall-minutes-is = The maximum overall playtime for the baby jail is {$minutes} minutes.
|
|
||||||
babyjail-command-max-overall-minutes-set = Set the maximum overall playtime for the baby jail to {$minutes} minutes.
|
|
||||||
Reference in New Issue
Block a user