Add clipboard monitoring functionality to the agent. Implement clipboard event logging, including text and image capture, with support for retention policies. Update API to allow file deletion and enhance web interface for file management. Add tests for clipboard operations.
This commit is contained in:
+20
-1
@@ -130,6 +130,15 @@
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function deleteFile(fullPath, name) {
|
||||
if (!confirm(`Delete ${name}?`)) {
|
||||
return;
|
||||
}
|
||||
const query = new URLSearchParams({ path: fullPath });
|
||||
await api(`/api/v1/files?${query}`, { method: "DELETE" });
|
||||
await listFiles(pathInput.value.trim());
|
||||
}
|
||||
|
||||
async function listFiles(path) {
|
||||
const query = new URLSearchParams();
|
||||
if (path) query.set("path", path);
|
||||
@@ -164,7 +173,17 @@
|
||||
size.textContent = entry.type === "dir" ? "—" : formatBytes(entry.size || 0);
|
||||
const modified = document.createElement("td");
|
||||
modified.textContent = entry.modified_time ? new Date(entry.modified_time).toLocaleString() : "";
|
||||
tr.append(name, type, size, modified);
|
||||
const action = document.createElement("td");
|
||||
const del = document.createElement("button");
|
||||
del.type = "button";
|
||||
del.textContent = "Delete";
|
||||
const full = joinPath(data.path, entry.name);
|
||||
del.addEventListener("click", (event) => {
|
||||
event.stopPropagation();
|
||||
deleteFile(full, entry.name).catch((err) => showError(err.message));
|
||||
});
|
||||
action.append(del);
|
||||
tr.append(name, type, size, modified, action);
|
||||
fileRows.append(tr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user