π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Minio now optional
Smaug673991280c40d391
diff --git a/backend/app/minio.go b/backend/app/minio.goindex a411611b..ab8b64ed 100644--- a/backend/app/minio.go+++ b/backend/app/minio.go@@ -15,6 +15,9 @@ func MinioConnection() (*minio.Client, error) {endpoint := os.Getenv("MINIO_ENDPOINT")accessKeyID := os.Getenv("MINIO_ACCESSKEY")secretAccessKey := os.Getenv("MINIO_SECRETKEY")+ if endpoint == "" || accessKeyID == "" || secretAccessKey == "" {+ return nil, fmt.Errorf("MINIO NOT CONFIGURED")+ }// Initialize minio client object.minioClient, errInit := minio.New(endpoint, &minio.Options{Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),diff --git a/backend/controllers/ressources.controller.go b/backend/controllers/ressources.controller.goindex 9617ac2f..8a75afd9 100644--- a/backend/controllers/ressources.controller.go+++ b/backend/controllers/ressources.controller.go@@ -57,6 +57,9 @@ func (ctr *Controller) GetAllUploads(c *gin.Context) (int, any) {// @Failure 400 {object} Error// @Failure 401 {object} Errorfunc (ctr *Controller) GetBackup(c *gin.Context) (int, any) {+ if ctr.app.MinioClient == nil {+ return http.StatusInternalServerError, errors.New("Minio client not initialized")+ }userId, err := utils.GetUserIdCtx(c)if err != nil {return http.StatusBadRequest, err@@ -104,6 +107,9 @@ func (ctr *Controller) GetBackup(c *gin.Context) (int, any) {// @Failure 400 {object} Error// @Failure 401 {object} Errorfunc (ctr *Controller) UploadFile(c *gin.Context) (int, any) {+ if ctr.app.MinioClient == nil {+ return http.StatusInternalServerError, errors.New("Minio client not initialized")+ }file, header, err := c.Request.FormFile("file")if err != nil {return http.StatusBadRequest, errors.New("failed to get file")@@ -176,6 +182,9 @@ func (ctr *Controller) UploadFile(c *gin.Context) (int, any) {// @Failure 400 {object} Error// @Failure 401 {object} Errorfunc (ctr *Controller) UploadAvatar(c *gin.Context) (int, any) {+ if ctr.app.MinioClient == nil {+ return http.StatusInternalServerError, errors.New("Minio client not initialized")+ }file, header, err := c.Request.FormFile("file")if err != nil {return http.StatusBadRequest, errors.New("failed to get file")@@ -270,6 +279,9 @@ func (ctr *Controller) UpdateUpload(c *gin.Context) (int, any) {// @Failure 400 {object} Error// @Failure 401 {object} Errorfunc (ctr *Controller) DeleteUpload(c *gin.Context) (int, any) {+ if ctr.app.MinioClient == nil {+ return http.StatusInternalServerError, errors.New("Minio client not initialized")+ }id, err := utils.GetIdParam(c, c.Param("id"))if err != nil {return http.StatusBadRequest, errors.New("invalid id format")diff --git a/backend/services/minio.service.go b/backend/services/minio.service.goindex c3a107ac..0404a186 100644--- a/backend/services/minio.service.go+++ b/backend/services/minio.service.go@@ -22,6 +22,9 @@ func NewMinioService(minio *minio.Client) MinioService {// @Security Authenfification: Auth, Self// @Param id prefix in the bucketfunc (s *Service) DeleteAllFromUser(userId types.Snowflake) error {+ if s.minio == nil {+ return nil // Minio client is not enabled, nothing to delete+ }prefix := fmt.Sprintf("%d/", userId)ctx := context.Background()objectCh := s.minio.ListObjects(ctx, os.Getenv("MINIO_BUCKET"), minio.ListObjectsOptions{