mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
feat: Implement end-to-end encryption for channels
- Added EncryptionSalt and WrappedRoomKey properties to Channel model. - Introduced RoomCrypto class for client-side encryption and decryption. - Updated ChannelService to handle encrypted channels, including creation and rekeying. - Modified ChannelsController to expose crypto metadata and rekey functionality. - Enhanced IrcCommandHandler to block joining encrypted channels over IRC. - Updated database schema with migration for new encryption fields. - Refactored file validation and image processing services to accommodate encrypted channels. - Added unit tests for RoomCrypto functionality and updated existing tests for channel services.
This commit is contained in:
@@ -255,6 +255,22 @@ public sealed class ChatMessageManager
|
||||
lines.Add(new ChatLine($" {trimmed}"));
|
||||
}
|
||||
}
|
||||
|
||||
// Clickable action to download the original image below the ASCII art
|
||||
if (message.AttachmentUrl is not null)
|
||||
{
|
||||
var imageName = message.AttachmentFileName ?? "image";
|
||||
var imageSize = FormatFileSize(message.AttachmentFileSize);
|
||||
var saveLine = new ChatLine(new List<ChatSegment>
|
||||
{
|
||||
new(" ", null),
|
||||
new($"[↓ save original] {imageName} [{imageSize}]", ChatColors.FileAttr),
|
||||
});
|
||||
saveLine.AttachmentUrl = message.AttachmentUrl;
|
||||
saveLine.AttachmentFileName = imageName;
|
||||
saveLine.Type = MessageType.Image;
|
||||
lines.Add(saveLine);
|
||||
}
|
||||
break;
|
||||
|
||||
case MessageType.Audio:
|
||||
|
||||
@@ -60,7 +60,7 @@ public sealed partial class MainWindow : Runnable
|
||||
private static readonly string[] SlashCommands =
|
||||
[
|
||||
"/status", "/nick", "/color", "/theme", "/send",
|
||||
"/avatar", "/profile", "/servers", "/join", "/leave",
|
||||
"/avatar", "/profile", "/servers", "/join", "/passwd", "/leave",
|
||||
"/topic", "/users", "/kick", "/ban", "/unban",
|
||||
"/mute", "/unmute", "/role", "/nuke", "/test-sound", "/quit", "/help"
|
||||
];
|
||||
@@ -154,6 +154,11 @@ public sealed partial class MainWindow : Runnable
|
||||
/// </summary>
|
||||
public event Action<string, string>? OnFileDownloadRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the user activates an image's "[save original]" line. Parameters: attachmentUrl, fileName.
|
||||
/// </summary>
|
||||
public event Action<string, string>? OnImageSaveRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the user activates a username (in userlist or message). Parameter is the username.
|
||||
/// </summary>
|
||||
@@ -466,6 +471,13 @@ public sealed partial class MainWindow : Runnable
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (line.Type == MessageType.Image)
|
||||
{
|
||||
OnImageSaveRequested?.Invoke(line.AttachmentUrl, line.AttachmentFileName);
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var lineText = line.ToString();
|
||||
|
||||
Reference in New Issue
Block a user