Add helper to get all mounts.

Default storage monitoring to all mounts
This commit is contained in:
amcmanu3 2023-02-10 15:17:36 -05:00
parent d0e8148282
commit 1b1c960cb6
2 changed files with 11 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import tempfile
import time
import uuid
import string
import psutil
import base64
import socket
import secrets
@ -417,7 +418,7 @@ class Helpers:
"allow_nsfw_profile_pictures": False,
"enable_user_self_delete": False,
"reset_secrets_on_next_boot": False,
"monitored_mounts": [],
"monitored_mounts": Helpers.get_all_mounts(),
}
def get_all_settings(self):
@ -436,6 +437,14 @@ class Helpers:
return data
@staticmethod
def get_all_mounts():
mounts = []
for item in psutil.disk_partitions(all=False):
mounts.append(item.mountpoint)
return mounts
@staticmethod
def is_subdir(server_path, root_dir):
server_path = os.path.realpath(server_path)

View File

@ -887,9 +887,7 @@ class PanelHandler(BaseHandler):
page_data["config-json"] = data
page_data["availables_languages"] = []
page_data["all_languages"] = []
page_data["all_partitions"] = []
for item in psutil.disk_partitions(all=False):
page_data["all_partitions"].append(item.mountpoint)
page_data["all_partitions"] = self.helper.get_all_mounts()
for file in sorted(
os.listdir(