🗑️ Remove independent mode

This commit is contained in:
2024-07-28 01:15:52 +08:00
parent 36d13f4b81
commit 763977c8f0
3 changed files with 7 additions and 25 deletions

View File

@ -74,12 +74,10 @@ func getAttachmentMeta(c *fiber.Ctx) error {
func createAttachment(c *fiber.Ctx) error {
var user *models.Account
if gap.H != nil {
if err := gap.H.EnsureAuthenticated(c); err != nil {
return err
}
user = lo.ToPtr(c.Locals("user").(models.Account))
if err := gap.H.EnsureAuthenticated(c); err != nil {
return err
}
user = lo.ToPtr(c.Locals("user").(models.Account))
destName := c.Query("destination", viper.GetString("preferred_destination"))
@ -97,10 +95,8 @@ func createAttachment(c *fiber.Ctx) error {
return err
}
if gap.H != nil {
if err := gap.H.EnsureGrantedPerm(c, "CreateAttachments", file.Size); err != nil {
return err
}
if err := gap.H.EnsureGrantedPerm(c, "CreateAttachments", file.Size); err != nil {
return err
}
usermeta := make(map[string]any)
@ -136,10 +132,6 @@ func createAttachment(c *fiber.Ctx) error {
func updateAttachmentMeta(c *fiber.Ctx) error {
id, _ := c.ParamsInt("id", 0)
if gap.H == nil {
return fiber.NewError(fiber.StatusUnprocessableEntity, "server running in independent mode, unable to modify attachment meta")
}
if err := gap.H.EnsureAuthenticated(c); err != nil {
return err
}
@ -176,10 +168,6 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
func deleteAttachment(c *fiber.Ctx) error {
id, _ := c.ParamsInt("id", 0)
if gap.H == nil {
return fiber.NewError(fiber.StatusUnprocessableEntity, "server running in independent mode, unable to delete attachment")
}
if err := gap.H.EnsureAuthenticated(c); err != nil {
return err
}