mikp/wn-s3browser-plugin

S3 browser plugin for Winter CMS

v0.3.0 2022-09-19 02:45 UTC

This package is auto-updated.

Last update: 2024-11-30 02:16:26 UTC


README

Buy me a tree Plant a Tree for Production

S3 object browser plugin containing components for front end views to interact with an s3 bucket like a file browser. This is a plugin for WinterCMS.

Cool Features

  • supports many of the backends that are used in flysystem
  • uses cache to list files
  • the API implements the TUS resumable upload protocol using tus-php, and there is a component to match.
  • middleware can be added to create custom access control

Why?

There is already a media manager and remote filesystem support in WinterCMS.

Although the CMS supports these features, there are not many good examples of components that show files to users. Here are some.

This plugin allows an additional location and method of storing files. It can support unofficial S3 implementations as well as HTTP only S3 services. This can be very useful if you want store files in S3 in a self hosted or non-public configuration. It is intended to allow front-end users to interact with stored files. It provides an API that can be modified with middleware creating application specific access control on files.

For example:

Say that your website hosts a bunch of CAD files that your users can download, but you only want some users to be able to access them. The problem further complicating the issue is that all your CAD files are on your business's NAS - which is not public and the sys-admin didn't bother to set up SSL, add valid certificates, or create root-CAs and maybe there isn't any DNS records either.

By adding a middleware to the s3browser routes only allowed files will display on the downloads page and the insecure s3 storage server is not publicly exposed.

Issues

Admittedly I started this plugin without really understanding the laravel filesystem so I aim to migrate this implementation to use the built in remote storage provided by WinterCMS.

Usage

Just add the various components to views.

API

  • {GET} /api/v1/s3browser/list/{bucket}
  • {POST/GET} /api/v1/s3browser/object
  • {GET} /api/v1/s3browser/download
  • {POST} /api/v1/s3browser/upload
  • {GET} /api/v1/s3browser/zip
  • {GET} /api/v1/s3browser/select
  • {ANY} /api/v1/s3browser/tus

components

  • s3browser - browse a given bucket
  • s3uploader - upload to a given bucket
  • s3query - Select style queries on tabular files (WIP)

Licence

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.