mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add helper to get all mounts.
Default storage monitoring to all mounts
This commit is contained in:
parent
d0e8148282
commit
1b1c960cb6
@ -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)
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user