chore(control + display): improve api urls, paths and file_names

This commit is contained in:
E44
2026-01-04 23:22:59 +01:00
parent a2c1f385c1
commit 44290f46fe
4 changed files with 68 additions and 18 deletions
+3 -2
View File
@@ -8,6 +8,7 @@ import {
type TreeElement
} from './types';
import { dev } from '$app/environment';
import { get_sanitized_file_url } from './utils';
export async function get_screenshot(ip: string): Promise<Blob | null> {
const options = { method: 'PATCH' };
@@ -18,7 +19,7 @@ export async function get_screenshot(ip: string): Promise<Blob | null> {
export async function open_file(ip: string, path_to_file: string): Promise<void> {
const options = { method: 'PATCH', headers: { 'content-type': 'application/octet-stream' } };
await request_display(ip, `/file${path_to_file}`, options);
await request_display(ip, get_sanitized_file_url(path_to_file), options);
}
export async function send_keyboard_input(ip: string, key: string): Promise<void> {
@@ -165,7 +166,7 @@ export async function show_blackscreen(ip: string): Promise<void> {
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}`,
get_sanitized_file_url(path_to_file, true),
{ method: 'GET' },
[415]
);