Separate list public channel

This commit is contained in:
2025-02-15 15:55:06 +08:00
parent 406eb9c93b
commit 2e18b2455b
3 changed files with 33 additions and 0 deletions

View File

@@ -76,6 +76,21 @@ func listChannel(c *fiber.Ctx) error {
return c.JSON(channels)
}
func listPublicChannel(c *fiber.Ctx) error {
var err error
var channels []models.Channel
if val, ok := c.Locals("realm").(authm.Realm); ok {
channels, err = services.ListChannelPublic(val.ID)
} else {
channels, err = services.ListChannelPublic()
}
if err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}
return c.JSON(channels)
}
func listOwnedChannel(c *fiber.Ctx) error {
if err := sec.EnsureAuthenticated(c); err != nil {
return err