Simple Python file indexer for web servers.
- Indexing!
- Breadcrumbs!
- Custom headers and footers!
- Server-side sorting!
- User-side sorting!
- Version sorting!
- Image previews!
- Basic authentication!
- Basic multiple user scenario!
- Pretty!
Fancyindex didn't suit my fancy (#16, #17, #48, doesn't support natural sorting, you gotta compile it in yourself etc.), whereas mod_autoindex while being nice, is unfortunately not available for nginx.
Each directory can be configured with indexer.json
file. The indexer.json
works recursively unless marked otherwise. Its structure is as follows:
{
"header": "Extra information to show above the file table (HTML)",
"footer": "Extra information to show below the file table (HTML)",
"sort_style": "One of following: ['name', 'size', 'date']",
"sort_dir": "One of following: ['asc', 'desc']",
"recursive": "Whether the config applies to subdirectories (true/false)",
"filter": "Optional regex for hiding files by their names",
"enable_galleries": "Whether to show image galleries (true/false)",
"show_images_as_files": "Whether to show images in file list (true/false)",
"auth": ["user1:password1", "user2":"password2"],
"auth_default": "Default user names that have access to all resources
(user1:user2)",
"auth_filtering": "Whether to use extended file attribute to control which
user can see which files (true/false)"
}
Note that the engine looks for indexer.json
in parent directories and stops
on the first file found. It does not merge settings
from multiple parent directories.
auth_filtering
turns on basic view permission system. User names that are by
default eligible to access each file/directory are specified in auth_default
configuration field. This list can be overridden through extended file
attributes for each indexed file/directory. The engine looks for the following
three attributes:
access
- overridesauth_default
completelyaccess_add
- permits additional user names with relation to theauth_default
configuration fieldaccess_del
- revokes user names even if they were specified inauth_default
configuration field
Each of these fields contains user names separated with :
.
Permissions are inherited from parent directories.
-
Install
webindexer
withpip
:pip install --user .
. -
Install
uwsgi
withpip
:pip install --user uwsgi
. -
Copy
indexer.service
to~/.config/systemd/user
. -
Run
systemctl --user daemon-reload
to make systemd see the above file. -
Run
systemctl --user enable indexer
to start indexer service at boot. -
Run
systemctl --user start indexer
to run indexer now. -
Edit
/etc/nginx.conf
and configure your site to use indexer:upstream indexer { server 127.0.0.1:40001; } server { include uwsgi_params; # should come with your distribution server_name example.com; location ~ ^.*/$ { # redirect only directories uwsgi_pass indexer; } location ~ ^/.thumb/ { # for image galleries uwsgi_pass indexer; } }
-
Run
systemctl restart nginx
and open the site with your favorite web browser to see indexer in action.