Skip to content

Commit

Permalink
Merge pull request #283 from moevm/increase_size
Browse files Browse the repository at this point in the history
Increase max system storage
  • Loading branch information
HadronCollider authored Jun 7, 2022
2 parents dba513d + ca499d4 commit f059411
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/config.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[consts]
MAX_CONTENT_LENGTH=16
MAX_SYSTEM_STORAGE=2000
MAX_SYSTEM_STORAGE=5000
PASSBACK_TIMER=60
13 changes: 13 additions & 0 deletions app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,19 @@ def profile(username):
abort(403)


@app.route("/capacity", methods=["GET"])
def system_capacity():
units = {'b': 1, 'mb':1024**2, 'gb': 1024**3}
unit = units.get(request.args.get('unit', 'gb').lower(), units['gb'])
current_size = data.get_storage()
ratio = current_size / app.config['MAX_SYSTEM_STORAGE']
return {
'size': current_size / unit,
'max_size': app.config['MAX_SYSTEM_STORAGE'] / unit,
'ratio': ratio
}


# Handle exceptions

@app.errorhandler(413)
Expand Down

0 comments on commit f059411

Please sign in to comment.