Skip to content

Commit f059411

Browse files
Merge pull request #283 from moevm/increase_size
Increase max system storage
2 parents dba513d + ca499d4 commit f059411

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

app/config.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[consts]
22
MAX_CONTENT_LENGTH=16
3-
MAX_SYSTEM_STORAGE=2000
3+
MAX_SYSTEM_STORAGE=5000
44
PASSBACK_TIMER=60

app/server.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,19 @@ def profile(username):
493493
abort(403)
494494

495495

496+
@app.route("/capacity", methods=["GET"])
497+
def system_capacity():
498+
units = {'b': 1, 'mb':1024**2, 'gb': 1024**3}
499+
unit = units.get(request.args.get('unit', 'gb').lower(), units['gb'])
500+
current_size = data.get_storage()
501+
ratio = current_size / app.config['MAX_SYSTEM_STORAGE']
502+
return {
503+
'size': current_size / unit,
504+
'max_size': app.config['MAX_SYSTEM_STORAGE'] / unit,
505+
'ratio': ratio
506+
}
507+
508+
496509
# Handle exceptions
497510

498511
@app.errorhandler(413)

0 commit comments

Comments
 (0)