mbkbucket 3.8.3 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/.env.example +4 -3
  2. package/README.md +375 -167
  3. package/index.js +3 -1
  4. package/lib/cli.js +239 -239
  5. package/lib/public/bucketadmin.css +855 -521
  6. package/lib/public/bucketadmin.js +367 -31
  7. package/lib/public/mbkbucket-helper-demo.html +4 -24
  8. package/lib/public/mbkbucket-helper.css +28 -34
  9. package/lib/public/mbkbucket-helper.js +4 -3
  10. package/lib/src/config/validation.js +18 -5
  11. package/lib/src/controllers/api.controller.js +66 -17
  12. package/lib/src/controllers/dashboard.controller.js +30 -10
  13. package/lib/src/controllers/info.controller.js +34 -3
  14. package/lib/src/controllers/view.controller.js +16 -14
  15. package/lib/src/core/storage/errors.js +62 -0
  16. package/lib/src/core/storage/gdrive-auth.js +193 -0
  17. package/lib/src/core/storage/gdrive-provider.js +656 -0
  18. package/lib/src/core/storage/index.js +14 -0
  19. package/lib/src/core/storage/models.js +80 -0
  20. package/lib/src/core/storage/path-strategy.js +65 -0
  21. package/lib/src/core/storage/s3-provider.js +491 -0
  22. package/lib/src/core/storage/storage-manager.js +203 -0
  23. package/lib/src/core/storage/storage-provider.js +217 -0
  24. package/lib/src/middleware/bucket-resolver.js +6 -6
  25. package/lib/src/routes/api.routes.js +5 -1
  26. package/lib/src/routes/index.js +2 -2
  27. package/lib/src/routes/view.routes.js +5 -2
  28. package/lib/src/services/s3.service.js +16 -568
  29. package/lib/src/services/storage.service.js +213 -0
  30. package/lib/src/utils/errors.js +15 -5
  31. package/package.json +2 -3
  32. package/views/bucket.hbs +47 -71
  33. package/views/bucketadmin_move_modal.hbs +35 -0
  34. package/views/bucketadmin_preview_modal.hbs +81 -13
  35. package/views/bucketadmincontent.hbs +56 -7
  36. package/views/mbkbucket_info.hbs +109 -207
package/.env.example CHANGED
@@ -1,14 +1,15 @@
1
1
  mbkautheVar={"APP_NAME":"mbkbucket","loginRedirectURL":"/dashboard","bucket":"R2_Bucket"}
2
+ # or "bucket":"Google_Drive"
2
3
  mbkauthShared={"Main_SECRET_TOKEN": 123,"DOMAIN":"mbktech.org","IS_DEPLOYED":"false","EncPass":"false","DEVICE_TRUST_DURATION_DAYS":7,"SESSION_SECRET_KEY":"123","LOGIN_DB":"postgres://","MBKAUTH_TWO_FA_ENABLE":"true","COOKIE_EXPIRE_TIME":2,"GITHUB_LOGIN_ENABLED":"f","GITHUB_CLIENT_ID":"123","GITHUB_CLIENT_SECRET":"123","GOOGLE_LOGIN_ENABLED":"f","GOOGLE_CLIENT_ID":"123","GOOGLE_CLIENT_SECRET":"123"}
3
4
  # See @node_modules/mbkauthe/docs/env.md for more details
4
5
  NODE_ENV=development
5
6
 
6
- BucketConnection={"R2_Bucket":{"BUCKET_NAME":"my-r2-bucket","ACCESS_KEY_ID":"your-r2-access-key","SECRET_ACCESS_KEY":"your-r2-secret","ENDPOINT":"https://accountid.r2.cloudflarestorage.com"},"S3_Bucket":{"BUCKET_NAME":"my-s3-bucket","ACCESS_KEY_ID":"your-s3-access-key","SECRET_ACCESS_KEY":"your-s3-secret","ENDPOINT":"https://s3.ap-southeast-1.amazonaws.com"}}
7
- # Region is optional
7
+ # Storage Connections (S3, Cloudflare R2, MinIO, Google Drive)
8
+ BucketConnection={"Google_Drive":{"type":"gdrive","client_id":"your-client-id.apps.googleusercontent.com","client_secret":"your-client-secret","refresh_token":"your-refresh-token","folder_id":"root"},"R2_Bucket":{"BUCKET_NAME":"my-r2-bucket","ACCESS_KEY_ID":"your-r2-access-key","SECRET_ACCESS_KEY":"your-r2-secret","ENDPOINT":"https://accountid.r2.cloudflarestorage.com"},"S3_Bucket":{"BUCKET_NAME":"my-s3-bucket","ACCESS_KEY_ID":"your-s3-access-key","SECRET_ACCESS_KEY":"your-s3-secret","ENDPOINT":"https://s3.ap-southeast-1.amazonaws.com"}}
8
9
 
9
10
  mbkbucketVar={"publiView_enabled":"true","p_view_inline":"true"}
10
11
  # publiView_enabled mean if this app storage is public or private. If true, then anyone can access the files if they have the link. If false, then only authenticated users can access the files.
11
- # p_view_inline means if the file should be displayed inline in the browser (proxy) or redirect to s3 signed url if false.
12
+ # p_view_inline means if the file should be displayed inline in the browser (proxy) or redirect to signed url if false.
12
13
 
13
14
  PORT=3005
14
15