diff options
-rw-r--r-- | kvmd/plugins/msd/otg/__init__.py | 8 | ||||
-rw-r--r-- | web/share/js/kvm/msd.js | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/kvmd/plugins/msd/otg/__init__.py b/kvmd/plugins/msd/otg/__init__.py index 4ef47097..87e88ea7 100644 --- a/kvmd/plugins/msd/otg/__init__.py +++ b/kvmd/plugins/msd/otg/__init__.py @@ -69,12 +69,16 @@ class _DriveImage: complete: bool in_storage: bool size: int = dataclasses.field(default=0) + mod_ts: float = dataclasses.field(default=0) def __post_init__(self) -> None: try: - object.__setattr__(self, "size", max(os.path.getsize(self.path), 0)) + st = os.stat(self.path) except Exception as err: - get_logger().warning("Can't get size of file %s: %s", self.path, err) + get_logger().warning("Can't stat() file %s: %s", self.path, err) + else: + object.__setattr__(self, "size", st.st_size) + object.__setattr__(self, "mod_ts", st.st_mtime) @dataclasses.dataclass(frozen=True) diff --git a/web/share/js/kvm/msd.js b/web/share/js/kvm/msd.js index 6285258a..9d454d97 100644 --- a/web/share/js/kvm/msd.js +++ b/web/share/js/kvm/msd.js @@ -409,6 +409,11 @@ export function Msd() { if (image.in_storage !== undefined && !image.in_storage) { title += ", out of storage"; } + + let dt = new Date(image.mod_ts * 1000); + dt = new Date(dt.getTime() - (dt.getTimezoneOffset() * 60000)); + title += " \u2500 " + dt.toISOString().slice(0, -8).replaceAll("-", ".").replace("T", "-"); + let el = new Option(title, "", false, false); el.disabled = true; el.className = "comment"; |