Skip to content

tzahola/share-link

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

share-link

Expiring links for file sharing. Low-tech. Supports downloading whole folders. Can be used with any CGI-compliant web server, like lighttpd.

Dependencies

Installation

  • clone repo
  • make the get CGI script publicly available via your webserver
  • set the SHARE_LINK_PREFIX environment variable to the URL of the get CGI script (e.g. export SHARE_LINK_PREFIX="http://example.com/get/")
  • share-link will generate a 256-bit key on first use; make sure this is NOT available publicly
  • for best results:
    • disable CGI response buffering on your webserver, e.g. for lighttpd set server.stream-response-body = 2
    • pass the environment variable X_SENDFILE=1 to the get CGI script (e.g. via mod_setenv for lighttpd), if your webserver supports the X-Sendfile response header

Usage

Use share-link to generate expiring links for your folders/files.

Example:

$ share-link --expiry tomorrow --link-prefix http://example.com/get/ -- /home/foo/bar/document.txt
http://example.com/get/eyJ0eXAiOiJKV1QiLCJleHAiOjE1NjM4NzUxOTJ9Cg.eyJwYXRoIjoiL2hvbWUvZm9vL2Jhci9kb2N1bWVudC50eHQifQo.KHN0ZGluKT0gMjMzZWQ4MzRkMWI3OTIxNWMwNTUxYjExOWRmMzZmNzQyNTliYzQwYjYzMzlkNjc2OTkzZTZjNmVmM2NkZjQ0NAo

Arguments:

  • Expiry date (--expiry | -e): can be any human-readable string that date accepts, like "tomorrow", "+1day", "+1week", etc.
  • Link prefix (--link-prefix | -l): the final link will be this prefix + the link token. If omitted then the SHARE_LINK_PREFIX environment variable will be used.

Invalidate links in case of emergency

If you remove the key file next to get and share-link (generated by share-link on first use), all existing links will be invalidated.

About

Expiring links for file sharing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages