Add save timestamp support and log interceptor for enhanced debugging
- Introduced `created_at` metadata for saves, enabling timestamp tracking. - Added `InterceptorLogger` to capture logs, aiding in error diagnostics. - Updated web UI to display save creation timestamps. - Improved save/load functionality to maintain compatibility with older formats.
This commit is contained in:
@@ -33,6 +33,7 @@ class SaveEntry {
|
||||
this.view.innerHTML = template.replaceAll("${fileid}", String(fileid));
|
||||
|
||||
let name = document.getElementById("file_" + fileid + "_name") as HTMLElement;
|
||||
let created = document.getElementById("file_" + fileid + "_created") as HTMLElement;
|
||||
let size = document.getElementById("file_" + fileid + "_size") as HTMLElement;
|
||||
let deleteBtn = document.getElementById("file_" + fileid + "_delete") as HTMLButtonElement;
|
||||
deleteBtn.onclick = () => {
|
||||
@@ -45,5 +46,17 @@ class SaveEntry {
|
||||
|
||||
name.innerText = "Slot " + saveinfo.idx;
|
||||
size.innerText = saveinfo.len + " bytes";
|
||||
|
||||
// Format timestamp in browser's local timezone
|
||||
if (saveinfo.created_at) {
|
||||
try {
|
||||
const date = new Date(saveinfo.created_at);
|
||||
created.innerText = date.toLocaleString();
|
||||
} catch (e) {
|
||||
created.innerText = "Invalid date";
|
||||
}
|
||||
} else {
|
||||
created.innerText = "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user