Stree web client is simple web/browser client for file management on S3 endpoints, such as Amazon S3, Ceph, Minio, ...
It supports path based S3 endpoints.
Download, configure settings and run it in a browser.
Currently it supports:
- single bucket
- multiple buckets
- upload single file
- upload multiple files
- upload folder
- download single file
- download multiple files
- download folder
- map/folder creation
- sharing
- editing
git clone https://github.com/rokj/stree-web.git- Download, configure, start your S3 server (e.g. minio) or set Amazon S3 endpoint.
- Copy js/settings.dist.js to js/settings.js. Set
s3_endpointand desiredbucket. - Open index.html in your browser with CORS disabled (e.g.
./chrome --disable-web-security --user-data-dir="/home/user/tmp")
KISS.
It uses Javascript AWS SDK v2 from Amazon. Tried v3, but got stuck with "progress" on file upload. You can check out branch https://github.com/rokj/stree-web/tree/almost-with-v3.
There are three files to work with:
js/main.js- logiccss/main.css- CSSindex.html- template/design
Additionaly jquery is used for element manipulation in HTML, bootstrap for CSS-ing. Plan is to abolish jquery in the future, ...
For sharing to work, you have to implement service with 4 endpoints which can be customizable and set in settings.js:
/get-user-shares//share//unshare//download/
JSON GET request:
{
'access_key': 'XYZ'
}Based on access_key you can get differentiate users shared objects/files.
JSON response:
{
"object_key1": {
"download_key": "unique key which is appended to download url for download operation",
"type": "empty string or 'document'",
"acl": "empty string or 'none' or 'readonly' or 'readwrite' or 'writeonly'"
},
"object_key2": {
"download_key": "url_from_where_object_can_be_downloaded",
"type": "empty string or 'document'",
"acl": "empty string or 'none' or 'readonly' or 'readwrite' or 'writeonly'"
},
...
}object_key is usually S3 object key.
download_key is usually random unique key from which app endpoint can then "resolve" to object.
type: is "" or "document". "document" is used only for an onlyoffice integration.
acl: is "" or "none" or "readonly" or "readwrite" or "writeonly".
todo ...
todo ...
GET request example:
https://app_endpoint/download/?k=UNIQE_DOWNLOAD_KEY
Based on k GET argument, /download/ endpoint should redirect to a URL where it can be downloaded.
This is usually redirect to S3 download URL, which in case of CEPH with multi tenant support is constructed something like this:
1. download_url = "{settings.s3_endpoint}/{tenant}:{bucket}/{object_key}"
2. redirect to download URL
e.g.:
1. object_key = get_object_key_from_database(GET['k'])
2. download_url = "https://s3.internet.com/user1:mybucket/{object_key}"
3. redirect to download_url
...
...