Skip to content

static fancy indexes for your cloud buckets. compatible with NGINX fancyindex themes

License

Notifications You must be signed in to change notification settings

divi255/cloud-fancyindex

Repository files navigation

Cloud FancyIndex

I like NGINX fancyindex module (https://www.nginx.com/resources/wiki/modules/fancy_index/). With a good theme it can make your auto-indexed file trash look like solid SP500 company's Website with a few directives in web server config.

But future is coming and we are moving to cloud storages.

  • Pros: you'll have built-in scalability, speed, and multi-zones for your files.
  • Cons: these cloud buckets have no indexes (or they don't look so cool as old good NGINX fancyindex themes).

Of course you can make an application which gets bucket contents and displays to to user in a nice way. But for what, if the files are static? Let's build static indexes! And let's add fancyindex themes for them!

Uploading

  • To upload files to Google Cloud Storage, you need to be logged in with local gcloud app. cs-index-upload.sh actually calls gsutil rsync

  • To upload to Amazon S3 or compatible, install and configure s3cmd

Installation

pip3 install cloud-fancyindex

You also need to install cloudindex package as well.

Usage

  • cloud-fancyindex-generator CLI tool - generates index.html files (by default in ./_build/html )

  • You must also download some fancy index theme, e.g. https://github.com/TheInsomniac/Nginx-Fancyindex-Theme. Actually it's compatible with almost all themes you can find or create.

Note: theme is placed in /fancyindex bucket directory. In case theme loads any stuff (css/js etc.) from other directory, correct paths in its header / footer.

Note: you need to rebuild index (at least partial one) every time you upload new file to bucket. Sad, but true.

Example:

cloud-index [options] <bucket> | cloud-fancyindex-generator -t <template> -F <themepath> -D <output>

Nuts and bolts

  • Unfortunately it's impossible to implement sorting, as it called a server request with a query string only NGINX can understand. Maybe I'll do sorting with JS, some day.

  • But a bonus - now you can easily display sizes of folders (or directories (or bucket paths (etc)))

  • S3 actually has real "folders" (at least emulates them), so index generation can be more optimal. But then we'll lose unification.

Releases

No releases published

Packages

No packages published