Files
forkmessager/backend/src/Shared/Knot.Shared.Kernel/Configuration/SystemSettingsDto.cs

119 lines
4.1 KiB
C#

using System.Collections.Generic;
namespace Knot.Shared.Kernel.Configuration;
public class SystemConfig
{
public string ServerTimezone { get; set; } = "UTC";
public string DomainUrl { get; set; } = "https://example.com";
public string AdminRoute { get; set; } = "admin";
public bool EnableRegistration { get; set; } = true;
}
public class StoriesConfig
{
public bool Enabled { get; set; } = true;
public int MaxStoriesPerPeriod { get; set; } = 5; // 1 to 10
public int StoryLifetimeHours { get; set; } = 24; // 4 to 48
// Text Stories
public bool TextStoriesEnabled { get; set; } = true;
public int TextStoryDurationSeconds { get; set; } = 15; // 5 to 30
// Media Stories
public int MediaStoryMaxDurationSeconds { get; set; } = 30; // 5 to 60
public int MaxMediaSizeBytes { get; set; } = 15 * 1024 * 1024; // 15MB
}
public class ChatsConfig
{
public bool SupportGroups { get; set; } = true;
public int MaxGroupParticipants { get; set; } = 200000; // 5 to 1,000,000
public bool AutoCleanChats { get; set; } = false;
public bool AllowChatToGroupConversion { get; set; } = true;
public bool EnableFolders { get; set; } = true;
}
public class MessagesConfig
{
public int DailyMessageLimitPerUser { get; set; } = 0; // 0 = unlimited
public int ChatMessageLimit { get; set; } = 0; // 0 = unlimited
public bool AllowMedia { get; set; } = true;
public int MaxMediaSizeBytes { get; set; } = 50 * 1024 * 1024; // 50MB
public List<string> AllowedMediaTypes { get; set; } = new() { "image/jpeg", "image/png", "video/mp4", "image/gif" };
public bool AllowVoiceMessages { get; set; } = true;
public bool AllowForwarding { get; set; } = true;
public bool AllowReactions { get; set; } = true;
public bool AllowReplies { get; set; } = true;
public bool AllowQuoting { get; set; } = true;
public bool AllowMessageDeletion { get; set; } = true;
public bool ForbidCopying { get; set; } = false;
public bool AllowLinks { get; set; } = true;
public bool AllowPolls { get; set; } = true;
public bool AllowPinning { get; set; } = true;
}
public class WebRtcConfig
{
public bool Enabled { get; set; } = false;
public bool EnableVoiceCalls { get; set; } = true;
public bool EnableVideoCalls { get; set; } = true;
public bool EnableScreenSharing { get; set; } = true;
public string TurnHost { get; set; } = string.Empty;
public int TurnPort { get; set; } = 3478;
public string TurnUser { get; set; } = string.Empty;
public string TurnSecret { get; set; } = string.Empty;
}
public class KlipyConfig
{
public bool Enabled { get; set; } = false;
public string ApiKey { get; set; } = string.Empty;
public string AppName { get; set; } = string.Empty;
}
public class ImportConfig
{
public bool EnableTelegramImport { get; set; } = false;
}
public class FederationDomainConfig
{
public string Domain { get; set; } = string.Empty;
public bool IsEnabled { get; set; } = true;
public string? PublicKey { get; set; }
public RemoteCapabilities? Capabilities { get; set; }
}
public class RemoteCapabilities
{
public bool AllowMedia { get; set; }
public bool AllowPolls { get; set; }
public bool AllowVoiceMessages { get; set; }
public bool AllowVideoCalls { get; set; }
public bool AllowScreenSharing { get; set; }
}
public class FederationConfig
{
public bool Enabled { get; set; } = false;
public string ServerDescription { get; set; } = string.Empty; // 20 to 120 chars
public string? PrivateKey { get; set; } // RSA PEM
public string? PublicKey { get; set; } // RSA PEM
public List<FederationDomainConfig> AllowedDomains { get; set; } = new();
}
public class SystemSettingsDto
{
public SystemConfig System { get; set; } = new();
public StoriesConfig Stories { get; set; } = new();
public ChatsConfig Chats { get; set; } = new();
public MessagesConfig Messages { get; set; } = new();
public WebRtcConfig WebRtc { get; set; } = new();
public KlipyConfig Klipy { get; set; } = new();
public ImportConfig Import { get; set; } = new();
public FederationConfig Federation { get; set; } = new();
}