Table of Contents

Class ChannelsController

Namespace
EchoHub.Server.Controllers
Assembly
EchoHub.Server.dll
[ApiController]
[Route("api/channels")]
[Authorize]
[EnableRateLimiting("general")]
public class ChannelsController : ControllerBase
Inheritance
ControllerBase
ChannelsController
Inherited Members

Constructors

ChannelsController(IChannelService, EchoHubDbContext, FileStorageService, ImageToAsciiService, IHttpClientFactory, IChatService, IMessageEncryptionService, UploadLimits)

public ChannelsController(IChannelService channelService, EchoHubDbContext db, FileStorageService fileStorage, ImageToAsciiService asciiService, IHttpClientFactory httpClientFactory, IChatService chatService, IMessageEncryptionService encryption, UploadLimits uploadLimits)

Parameters

channelService IChannelService
db EchoHubDbContext
fileStorage FileStorageService
asciiService ImageToAsciiService
httpClientFactory IHttpClientFactory
chatService IChatService
encryption IMessageEncryptionService
uploadLimits UploadLimits

Methods

CreateChannel(CreateChannelRequest)

[HttpPost]
public Task<IActionResult> CreateChannel(CreateChannelRequest request)

Parameters

request CreateChannelRequest

Returns

Task<IActionResult>

DeleteChannel(string)

[HttpDelete("{channel}")]
public Task<IActionResult> DeleteChannel(string channel)

Parameters

channel string

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

channel string

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

channel string

Returns

Task<IActionResult>

GetChannels(int, int)

[HttpGet]
public Task<IActionResult> GetChannels(int offset = 0, int limit = 50)

Parameters

offset int
limit int

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

channel string
request RekeyChannelRequest

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

channel string
size string

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

channel string
request SendUrlRequest
size string

Returns

Task<IActionResult>

UpdateTopic(string, UpdateTopicRequest)

[HttpPut("{channel}/topic")]
public Task<IActionResult> UpdateTopic(string channel, UpdateTopicRequest request)

Parameters

channel string
request UpdateTopicRequest

Returns

Task<IActionResult>