Commit Graph

50 Commits

Author SHA1 Message Date
Daniel Gultsch 48de2ee744 use new config value names in server 2015-07-28 22:16:32 +02:00
Daniel Gultsch 2065637778 renamed a few config variables 2015-07-28 22:11:49 +02:00
Daniel Gultsch fe8b957f2f Merge pull request #25 from evildad/master
fix missing imports
2015-07-28 21:50:24 +02:00
evildad 62e78d3061 Update server.py 2015-07-28 21:48:00 +02:00
Daniel Gultsch 6ea1a86e24 Merge pull request #23 from chaotix-/remove-old-uploads
Add expiry and user quotas
2015-07-28 19:40:39 +02:00
Lars Bensmann f4b4284536 Add expiry and user quotas
Expiry and user quotas are controlled by four config options:

```expire_interval``` determines how often (in seconds) files should be
deleted. As every expiry run needs to check all uploaded files of all
users this should not be set too small.

Files older than ```expire_maxage``` (in seconds) will be deleted by an
expiry run. Set this to ```0``` to disable deletions based on file age.

After an expiry run at most ```user_quota_soft``` space (in bytes) will be
occupied per user. The oldest files will be deleted first until the occupied
space is less than ```user_quota_soft```. Set this to ```0``` to disable
file deletions based on a users occupied space.

```user_quota_hard``` sets a hard limit how much space (in bytes) a user
may occupy. If an upload would make his files exceed this size it will be
rejected. This setting is not dependend on ```expire_interval```. Set
this to ```0``` to disable upload rejection based on occupied space.

```expire_maxage``` and ```user_quota_soft``` depend on ```expire_interval```.

```user_quota_hard``` is honoured even without expiry runs. But some kind
of expiry is recommended otherwise a user will not be able to upload
anymore files once his hard quota is reached.

The difference between ```user_quota_hard``` and ```user_quota_soft```
determines how much a user may upload per ```expire_interval```.
2015-07-28 00:07:07 +02:00
Daniel Gultsch 50e1afa2ba Merge pull request #20 from SamWhited/crontab
Add a cronjob example to remove old files
2015-07-27 13:17:27 +02:00
Daniel Gultsch 2f0fec6c7f Merge pull request #22 from chaotix-/mime-content-disposition
Just send Content-disposition: attachment-Header if content is no image
2015-07-27 13:16:54 +02:00
Lars Bensmann 5ede0f9a7a Just send Content-disposition: attachment-Header if content is no image
Content-disposition: attachment prevents most code to be executed in the
browser (Java being an exception), but this is not needed for images and
makes viewing images in clients that don't show the pictures inline even
more complicated.

(Also this PR removes unused imports).
2015-07-26 20:51:18 +02:00
Sam Whited 24b6a11970 Add a cronjob example to remove old files 2015-07-26 09:34:55 -05:00
Daniel Gultsch 6d8993145b Merge branch 'master' of github.com:siacs/HttpUploadComponent 2015-07-24 17:48:14 +02:00
Daniel Gultsch 96b39250b2 fixed small files not working 2015-07-24 17:46:32 +02:00
Daniel Gultsch 2678c0d2b8 Merge pull request #16 from SamWhited/head_fix
Don't duplicate HEAD/GET response code
2015-07-23 10:02:20 +02:00
Daniel Gultsch bd4e1e4c5a Merge pull request #15 from SamWhited/mime_types
Set content-type header based on mime-type
2015-07-23 10:01:57 +02:00
Daniel Gultsch db06e3edfc Merge pull request #14 from SamWhited/fix_file_leak
Fix a file handle leak
2015-07-23 10:01:30 +02:00
Daniel Gultsch 958aec3da6 Merge pull request #12 from SamWhited/better_file_not_found_error
Add proper error for FileNotFoundError in Python 2
2015-07-23 10:01:19 +02:00
Daniel Gultsch 16cd830cc5 Merge pull request #13 from SamWhited/readme_cleanup
Cleanup readme
2015-07-23 10:00:59 +02:00
Sam Whited 5a0566688a Don't duplicate HEAD/GET response code 2015-07-23 00:43:36 -05:00
Sam Whited 63124a3026 Set content-type header based on mime-type
Fixes #7
2015-07-22 22:42:28 -05:00
Sam Whited f397219c27 Fix a file handle leak 2015-07-22 22:21:28 -05:00
Sam Whited 50f0a6fec6 Add proper error for FileNotFoundError in Python 2 2015-07-22 22:10:52 -05:00
Sam Whited 2546769fb4 Cleanup readme 2015-07-22 21:30:57 -05:00
Daniel Gultsch 7f6be7e97a mention the contrib directory in the readme 2015-07-22 11:31:09 +02:00
Daniel Gultsch f528a250f1 added prosody example config snippet 2015-07-22 11:28:50 +02:00
Daniel Gultsch ed0f876970 make sure we use same domain across different examples 2015-07-22 10:58:38 +02:00
Daniel Gultsch 4d547d5f20 Merge pull request #11 from SamWhited/patch-2
Create nginx_site_example
2015-07-22 10:51:44 +02:00
Daniel Gultsch a56e0c629a Merge pull request #10 from SamWhited/patch-1
Create ejabberd_cfg_snippet.yml
2015-07-22 10:51:39 +02:00
Daniel Gultsch 499ac60d2e Merge pull request #9 from SamWhited/http_address
Make HTTP address configurable
2015-07-22 10:51:26 +02:00
Sam Whited 0dd07d316a Create nginx_site_example 2015-07-22 02:23:59 -05:00
Sam Whited cbce080d39 Create ejabberd_cfg_snippet.yml 2015-07-22 02:03:29 -05:00
Sam Whited f8bc7c6242 Make HTTP address configurable 2015-07-22 01:15:39 -05:00
Daniel Gultsch 4dde390ae5 edited readme 2015-07-20 18:21:16 +02:00
Daniel Gultsch dfc2c26bce moved service file into contrib directory 2015-07-20 18:15:47 +02:00
Daniel Gultsch f40a12f72d Merge pull request #8 from chaotix-/master
Make configfile and logfile configurable via commandline options
2015-07-20 18:13:53 +02:00
Lars Bensmann c3b41b2415 Make configfile and logfile configurable via commandline options
Use argparse to parse --config und --logfile so it can be better used from
a startup script.

Add Debian startup-script in contrib/
2015-07-18 14:04:17 +02:00
Daniel Gultsch 8bd4ad6803 optional ssl support (recommended) 2015-07-10 14:28:59 +02:00
Daniel Gultsch c09664797d some security patches and further python 2 compat
Thank you Lars Bensmann
2015-07-09 08:52:48 +02:00
Daniel Gultsch ac12bf5c54 Merge pull request #6 from SamWhited/hashbang
Add a hashbang
2015-07-04 23:36:32 +02:00
Daniel Gultsch 55ce3cd3f1 Merge pull request #5 from SamWhited/file_handling
File handling tweaks
2015-07-04 23:36:27 +02:00
Sam Whited 1f66775c81 File handling tweaks
Fix vulnerability where a specially crafted path could lead to the user
accessing things in the root file directory
2015-07-04 16:27:00 -05:00
Sam Whited d917a9eb18 Add a hashbang 2015-07-04 14:41:45 -05:00
Daniel Gultsch 9cb7ff4e04 Merge pull request #2 from SamWhited/systemd_init
Add a systemd init script
2015-07-04 20:54:30 +02:00
Daniel Gultsch 61f19b2381 Merge pull request #3 from SamWhited/gitignore
Add gitignore
2015-07-04 20:54:09 +02:00
Sam Whited 5beaa26bc6 Add gitignore
Remove accidentally committed pyc that made me think to add the
gitignore
2015-07-04 13:49:04 -05:00
Sam Whited 683775d6dd Add a systemd init script 2015-07-04 13:45:27 -05:00
Daniel Gultsch 2b321dc412 Merge pull request #1 from SamWhited/python2
Add Python 2 support
2015-07-04 20:37:17 +02:00
Sam Whited af00bb7562 Add Python 2 support
Add requirements file for reproducible builds
2015-07-04 13:28:52 -05:00
Daniel Gultsch 2f8ac488a5 added readme 2015-07-03 13:50:20 +02:00
Daniel Gultsch feae90e7d5 changed namespace 2015-06-30 20:11:20 +02:00
Daniel Gultsch 3b341972b0 inital commit 2015-06-28 11:21:30 +02:00