Class ChannelsController
- Namespace
- EchoHub.Server.Controllers
- Assembly
- EchoHub.Server.dll
[ApiController]
[Route("api/channels")]
[Authorize]
[EnableRateLimiting("general")]
public class ChannelsController : ControllerBase
- Inheritance
-
ControllerBaseChannelsController
- Inherited Members
Constructors
ChannelsController(IChannelService, EchoHubDbContext, FileStorageService, ImageToAsciiService, IHttpClientFactory, IChatService, IMessageEncryptionService, UploadLimits, ILogger<ChannelsController>)
public ChannelsController(IChannelService channelService, EchoHubDbContext db, FileStorageService fileStorage, ImageToAsciiService asciiService, IHttpClientFactory httpClientFactory, IChatService chatService, IMessageEncryptionService encryption, UploadLimits uploadLimits, ILogger<ChannelsController> logger)
Parameters
channelServiceIChannelServicedbEchoHubDbContextfileStorageFileStorageServiceasciiServiceImageToAsciiServicehttpClientFactoryIHttpClientFactorychatServiceIChatServiceencryptionIMessageEncryptionServiceuploadLimitsUploadLimitsloggerILogger<ChannelsController>
Methods
CreateChannel(CreateChannelRequest)
[HttpPost]
public Task<IActionResult> CreateChannel(CreateChannelRequest request)
Parameters
requestCreateChannelRequest
Returns
- Task<IActionResult>
DeleteChannel(string)
[HttpDelete("{channel}")]
public Task<IActionResult> DeleteChannel(string channel)
Parameters
channelstring
Returns
- Task<IActionResult>
GetChannelCrypto(string)
Public crypto metadata for a channel: whether it is end-to-end encrypted and the PBKDF2 salt clients need to derive their join credential. Never returns the wrapped room key — that is only handed out after a successful join.
[HttpGet("{channel}/crypto")]
public Task<IActionResult> GetChannelCrypto(string channel)
Parameters
channelstring
Returns
- Task<IActionResult>
GetChannelMeta(string)
Human-facing summary of a channel (message count, unique posters, estimated size, created date, room id). Available for encrypted channels too — these are metadata the server tracks even though it cannot read the messages themselves.
[HttpGet("{channel}/meta")]
public Task<IActionResult> GetChannelMeta(string channel)
Parameters
channelstring
Returns
- Task<IActionResult>
GetChannels(int, int)
[HttpGet]
public Task<IActionResult> GetChannels(int offset = 0, int limit = 50)
Parameters
Returns
- Task<IActionResult>
RekeyChannel(string, RekeyChannelRequest)
Changes an encrypted channel's passphrase by re-wrapping its room key. The caller proves knowledge of the old passphrase via the old auth key; history is never re-encrypted (the room content key does not change).
[HttpPost("{channel}/rekey")]
public Task<IActionResult> RekeyChannel(string channel, RekeyChannelRequest request)
Parameters
channelstringrequestRekeyChannelRequest
Returns
- Task<IActionResult>
SendMessageWithAttachments(string, string?)
Sends one message carrying optional text (content form field) plus zero or more
file attachments (Discord-style). For non-encrypted channels the server sniffs each file's
kind and renders ASCII previews for images. For end-to-end encrypted channels the client
uploads ciphertext blobs and declares each file's kind (kind) and pre-rendered,
room-encrypted preview (preview), aligned by file order — the server never inspects them.
[HttpPost("{channel}/messages")]
[EnableRateLimiting("upload")]
public Task<IActionResult> SendMessageWithAttachments(string channel, string? size = null)
Parameters
Returns
- Task<IActionResult>
SendUrl(string, SendUrlRequest, string?)
[HttpPost("{channel}/send-url")]
[EnableRateLimiting("upload")]
public Task<IActionResult> SendUrl(string channel, SendUrlRequest request, string? size = null)
Parameters
channelstringrequestSendUrlRequestsizestring
Returns
- Task<IActionResult>
UpdateTopic(string, UpdateTopicRequest)
[HttpPut("{channel}/topic")]
public Task<IActionResult> UpdateTopic(string channel, UpdateTopicRequest request)
Parameters
channelstringrequestUpdateTopicRequest
Returns
- Task<IActionResult>