Add refresh countdown, fix quota fs lookup, update README
- main.js: show live countdown "Updated HH:MM:SS — next in Xs" so the 30s auto-refresh is visually obvious instead of just a static timestamp - app.py: rename _find_mountpoint → _find_quota_fs and fix the stale call site that caused a NameError; function now returns mountpoint from df, falling back to the path itself if df returns / - README: add full quota setup section (fstab usrquota, quotacheck, quotaon, verify with repquota); fix stale "127.0.0.1" bind note (service already uses 0.0.0.0); update Auth section (sessions, not Basic Auth) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
6631b9e832
commit
f4943b6b6d
4 files changed
+75
-14
No files matched your search
@@ -417,14 +417,17 @@ def toggle_nfs():
|
||||
|
||||
# ===== QUOTA =====
|
||||
|
||||
def _find_mountpoint(path):
|
||||
"""Return the filesystem mountpoint that contains path."""
|
||||
r = subprocess.run(
|
||||
['df', '--output=target', path],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
lines = [l.strip() for l in r.stdout.strip().splitlines() if l.strip() and l.strip() != 'Mounted on']
|
||||
return lines[0] if lines else '/srv'
|
||||
def _find_quota_fs(path):
|
||||
"""Return the best filesystem argument for setquota.
|
||||
|
||||
setquota needs a path whose filesystem has quota enabled. We try the
|
||||
exact path first, then walk up to the mountpoint reported by df. If df
|
||||
says '/' we still try the path itself — the user may have quota on root.
|
||||
"""
|
||||
r = subprocess.run(['df', '--output=target', path], capture_output=True, text=True)
|
||||
lines = [l.strip() for l in r.stdout.strip().splitlines()
|
||||
if l.strip() and l.strip() != 'Mounted on']
|
||||
return lines[0] if lines else path
|
||||
|
||||
|
||||
@app.route('/api/quota', methods=['POST'])
|
||||
@@ -449,7 +452,7 @@ def set_quota():
|
||||
except ValueError as e:
|
||||
return jsonify({'error': str(e)}), 400
|
||||
|
||||
mount = _find_mountpoint(safe_path)
|
||||
mount = _find_quota_fs(safe_path)
|
||||
soft_kb = str(quota_gb * 1024 * 1024)
|
||||
hard_kb = str((quota_gb + 1) * 1024 * 1024)
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user