Skip to content

Commit 05d565e

Browse files
author
Matthew Bate
committed
Remote Ban Import/Export Functions
1 parent 2ee734d commit 05d565e

File tree

5 files changed

+579
-8
lines changed

5 files changed

+579
-8
lines changed

BHD-ServerManager/API/Controllers/BanController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public ActionResult<BanRecordSaveResult> SaveBlacklistRecord([FromBody] BanRecor
2929
{
3030
// Use DualRecordResult for both-record creation
3131
var dualResult = banInstanceManager.AddBlacklistBothRecords(
32-
req.PlayerName!, ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes
32+
req.PlayerName!, ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes, req.IgnoreValidation
3333
);
3434
result = new BanRecordSaveResult
3535
{
@@ -49,7 +49,7 @@ public ActionResult<BanRecordSaveResult> SaveBlacklistRecord([FromBody] BanRecor
4949
// Use OperationResult for name-only
5050
var opResult = req.NameRecordID == null
5151
? banInstanceManager.AddBlacklistNameRecord(
52-
req.PlayerName!, req.BanDate, req.ExpireDate, req.RecordType, req.Notes)
52+
req.PlayerName!, req.BanDate, req.ExpireDate, req.RecordType, req.Notes, 0, req.IgnoreValidation)
5353
: banInstanceManager.UpdateBlacklistNameRecord(
5454
req.NameRecordID.Value, req.PlayerName!, req.BanDate, req.ExpireDate, req.RecordType, req.Notes);
5555

@@ -65,7 +65,7 @@ public ActionResult<BanRecordSaveResult> SaveBlacklistRecord([FromBody] BanRecor
6565
// Use OperationResult for IP-only
6666
var opResult = req.IPRecordID == null
6767
? banInstanceManager.AddBlacklistIPRecord(
68-
ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes)
68+
ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes, 0, req.IgnoreValidation)
6969
: banInstanceManager.UpdateBlacklistIPRecord(
7070
req.IPRecordID.Value, ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes);
7171

@@ -127,7 +127,7 @@ public ActionResult<BanRecordSaveResult> SaveWhitelistRecord([FromBody] BanRecor
127127
{
128128
// Use DualRecordResult for both-record creation
129129
var dualResult = banInstanceManager.AddWhitelistBothRecords(
130-
req.PlayerName!, ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes
130+
req.PlayerName!, ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes, req.IgnoreValidation
131131
);
132132
result = new BanRecordSaveResult
133133
{
@@ -147,7 +147,7 @@ public ActionResult<BanRecordSaveResult> SaveWhitelistRecord([FromBody] BanRecor
147147
// Use OperationResult for name-only
148148
var opResult = req.NameRecordID == null
149149
? banInstanceManager.AddWhitelistNameRecord(
150-
req.PlayerName!, req.BanDate, req.ExpireDate, req.RecordType, req.Notes)
150+
req.PlayerName!, req.BanDate, req.ExpireDate, req.RecordType, req.Notes,0,req.IgnoreValidation)
151151
: banInstanceManager.UpdateWhitelistNameRecord(
152152
req.NameRecordID.Value, req.PlayerName!, req.BanDate, req.ExpireDate, req.RecordType, req.Notes);
153153

@@ -163,7 +163,7 @@ public ActionResult<BanRecordSaveResult> SaveWhitelistRecord([FromBody] BanRecor
163163
// Use OperationResult for IP-only
164164
var opResult = req.IPRecordID == null
165165
? banInstanceManager.AddWhitelistIPRecord(
166-
ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes)
166+
ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes,0,req.IgnoreValidation)
167167
: banInstanceManager.UpdateWhitelistIPRecord(
168168
req.IPRecordID.Value, ip!, req.SubnetMask ?? 32, req.BanDate, req.ExpireDate, req.RecordType, req.Notes);
169169

BHD-ServerManager/Forms/Panels/tabBans.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,7 @@ private void btnImportWhitelist_Click(object sender, EventArgs e)
22002200
{
22012201
using (var openDialog = new OpenFileDialog())
22022202
{
2203-
openDialog.Title = "Import Blacklist from JSON";
2203+
openDialog.Title = "Import Whitelist from JSON";
22042204
openDialog.Filter = "JSON Files (*.json)|*.json|All Files (*.*)|*.*";
22052205
openDialog.Multiselect = false;
22062206

HawkSyncShared/DTOs/BanRecordSaveRequest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class BanRecordSaveRequest
2121
public string Notes { get; set; } = string.Empty;
2222
public bool IsName { get; set; }
2323
public bool IsIP { get; set; }
24+
public bool IgnoreValidation { get; set; } = false;
2425
}
2526

2627
public class BanRecordSaveResult

RemoteClient/Forms/Panels/tabBans.Designer.cs

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)