Refactor and update various components of EchoHub.Server

- Updated launchSettings.json for consistency.
- Refactored FileValidationHelper to improve image validation logic.
- Enhanced ServerDirectoryService for better connection handling and user count updates.
- Improved DatabaseSetup for legacy database handling and seeding default channels.
- Refined FirstRunSetup to ensure JWT secret generation.
- Removed appsettings.Development.json as it is no longer needed.
- Updated EchoHub.Tests project file for consistency.
- Added unit tests for FileValidationHelper and PresenceTracker with improved assertions.
- Updated ValidationConstantsTests to ensure regex validations are correct.
- Cleaned up solution file formatting for better readability.
This commit is contained in:
HueByte
2026-02-19 10:12:28 +01:00
parent 32e01e8d71
commit 9975f4e4be
57 changed files with 4401 additions and 4378 deletions
+77 -77
View File
@@ -1,77 +1,77 @@
using Terminal.Gui.App;
using Terminal.Gui.Views;
using Terminal.Gui.ViewBase;
namespace EchoHub.Client.UI;
public record CreateChannelResult(string Name, string? Topic);
public sealed class CreateChannelDialog
{
public static CreateChannelResult? Show(IApplication app)
{
CreateChannelResult? result = null;
var dialog = new Dialog { Title = "Create Channel", Width = 50, Height = 12 };
var nameLabel = new Label { Text = "Name:", X = 1, Y = 1 };
var nameField = new TextField { X = 10, Y = 1, Width = Dim.Fill(2) };
var topicLabel = new Label { Text = "Topic:", X = 1, Y = 3 };
var topicField = new TextField { X = 10, Y = 3, Width = Dim.Fill(2) };
var hintLabel = new Label
{
Text = "Lowercase letters, digits, hyphens, underscores (2-100 chars)",
X = 1,
Y = 5,
};
var createButton = new Button
{
Text = "Create",
IsDefault = true,
X = Pos.Center() - 10,
Y = 7
};
var cancelButton = new Button
{
Text = "Cancel",
X = Pos.Center() + 5,
Y = 7
};
createButton.Accepting += (s, e) =>
{
var name = nameField.Text?.Trim().ToLowerInvariant();
if (string.IsNullOrWhiteSpace(name))
{
MessageBox.ErrorQuery(app, "Error", "Channel name is required.", "OK");
return;
}
var topic = topicField.Text?.Trim();
if (string.IsNullOrWhiteSpace(topic))
topic = null;
result = new CreateChannelResult(name, topic);
e.Handled = true;
app.RequestStop();
};
cancelButton.Accepting += (s, e) =>
{
result = null;
e.Handled = true;
app.RequestStop();
};
dialog.Add(nameLabel, nameField, topicLabel, topicField, hintLabel, createButton, cancelButton);
nameField.SetFocus();
app.Run(dialog);
return result;
}
}
using Terminal.Gui.App;
using Terminal.Gui.Views;
using Terminal.Gui.ViewBase;
namespace EchoHub.Client.UI;
public record CreateChannelResult(string Name, string? Topic);
public sealed class CreateChannelDialog
{
public static CreateChannelResult? Show(IApplication app)
{
CreateChannelResult? result = null;
var dialog = new Dialog { Title = "Create Channel", Width = 50, Height = 12 };
var nameLabel = new Label { Text = "Name:", X = 1, Y = 1 };
var nameField = new TextField { X = 10, Y = 1, Width = Dim.Fill(2) };
var topicLabel = new Label { Text = "Topic:", X = 1, Y = 3 };
var topicField = new TextField { X = 10, Y = 3, Width = Dim.Fill(2) };
var hintLabel = new Label
{
Text = "Lowercase letters, digits, hyphens, underscores (2-100 chars)",
X = 1,
Y = 5,
};
var createButton = new Button
{
Text = "Create",
IsDefault = true,
X = Pos.Center() - 10,
Y = 7
};
var cancelButton = new Button
{
Text = "Cancel",
X = Pos.Center() + 5,
Y = 7
};
createButton.Accepting += (s, e) =>
{
var name = nameField.Text?.Trim().ToLowerInvariant();
if (string.IsNullOrWhiteSpace(name))
{
MessageBox.ErrorQuery(app, "Error", "Channel name is required.", "OK");
return;
}
var topic = topicField.Text?.Trim();
if (string.IsNullOrWhiteSpace(topic))
topic = null;
result = new CreateChannelResult(name, topic);
e.Handled = true;
app.RequestStop();
};
cancelButton.Accepting += (s, e) =>
{
result = null;
e.Handled = true;
app.RequestStop();
};
dialog.Add(nameLabel, nameField, topicLabel, topicField, hintLabel, createButton, cancelButton);
nameField.SetFocus();
app.Run(dialog);
return result;
}
}