GithubHelp home page GithubHelp logo

gustavoarmoa / depot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from relip/depot

0.0 0.0 0.0 2.64 MB

Flask-based file sharing platform

License: GNU General Public License v2.0

Python 44.66% CSS 16.22% JavaScript 13.12% HTML 25.48% Mako 0.52%

depot's Introduction

Depot

Depot is a simple Flask-based file sharing platform for individual use.

HTML templates are still work in progress

IE9 AND EARLIER ARE NOT SUPPORTED

See dev branch for WiP HTML templates.

Features

  • Expiration date
  • Limiting number of downloads
  • Deleting or hiding after expired
  • Grouping files
  • Compressing files from specific group
  • API capabilities
  • GeoIP support

Requirements

SQLAlchemy
Flask
Flask-Login
Flask-Bcrypt
Flask-SQLAlchemy
Flask-Script
Flask-Migrate
geoip2

Installation

  1. pip install -r requirements.txt
  2. cp config.py.example config.py
  3. Customize config.py
  4. ./depot or use uWSGI
  5. Visit http://your.domain/signin
  6. Sign in with auto-generated credentials (shown on the prompt)
  7. Create user

Nginx configuration

In nginx.conf, put following code under http section.

server {
	listen 80;
	server_name [domain];

	location / { try_files $uri @depot; }
	location @depot {
		include uwsgi_params;
		uwsgi_pass unix:/tmp/depot.sock;
	}
}

RECOMMENDED: If you are using XSendfile for file transfer, put following code under server section above.

The importance of XSendfile is explained in Notes section.

	location /[HTTPD_BASE_DIR in config.py]/ {
		internal;
		alias /[UPLOAD_BASE_DIR in config.py]/;
	}

Usage

Using Flask built-in web server:

./depot

Using uWSGI(highly recommended):

uwsgi -s /tmp/depot.sock --module app --callable app --chmod-socket=777

If you upload large files often, it consumes long time - depends on your server specs - for retrieving file and hashing sum of it. This means python process will stuck, nothing can be uploaded until hashing gets finished. To solve this problem, set -p option to create multiple processes.

Notes

As written in config.py.example, using flask.send_file() causes slow download speed, so set HTTPD_USE_X_SENDFILE to True if you care about download speed.

Depot was originally planned for image uploading, some of which may have uploaded in the past. So when a file is uploaded, hash the file using MD5 and SHA1, and check if the file has already been uploaded. If has not, store it with randomly generated file name.

Random naming makes it difficult to find directly in the terminal, using this kind of upload procedure is not suitable for uniquely named files, like videos, musics, etc. In this case, upload by other method such as FTP or SFTP, and share it with remote file browser.

depot's People

Contributors

relip avatar hibiyasleep avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.