add file thumbnails

This commit is contained in:
E44
2025-11-10 12:45:46 +01:00
parent 706e8350af
commit a247f59dd5
11 changed files with 120 additions and 11 deletions
+7 -3
View File
@@ -2,7 +2,7 @@ import { notifications } from "./stores/notification";
import { to_display_status, type DisplayStatus, type FolderElement, type TreeElement } from "./types";
import { get_uuid } from "./utils";
export async function get_screenshot(ip: string) {
export async function get_screenshot(ip: string): Promise<Blob|null> {
const options = { method: 'PATCH' };
return await request_display(ip, '/takeScreenshot', options);
}
@@ -63,8 +63,7 @@ done
if (response_element.name.charAt(2) !== '.') {
const folder_element: FolderElement = {
id: get_uuid(),
hash: JSON.stringify(response),
thumbnail_url: null,
hash: JSON.stringify(response_element),
name: response_element.name.slice(2), // remove "./"
type: response_element.type,
date_created: new Date(response_element.created),
@@ -111,6 +110,11 @@ export async function ping_ip(ip: string): Promise<DisplayStatus> {
return raw_response.status ? to_display_status(raw_response.status) : null;
}
export async function get_thumbnail_blob(ip: string, path_to_file: string): Promise<Blob|null> {
const raw_response = await request_display(ip, `/file/preview${path_to_file}`, { method: 'GET' });
return raw_response;
}