mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-06 17:07:08 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea18cb597a | |||
| 0f2cc9f12a | |||
| 70ca009898 | |||
| 320584a1de |
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ArrowRight, Ban, FileIcon, Folder, Play } from 'lucide-svelte';
|
import { ArrowRight, Ban, FileIcon, Folder, Play, Triangle, TriangleAlert } from 'lucide-svelte';
|
||||||
import {
|
import {
|
||||||
current_height,
|
current_height,
|
||||||
get_selectable_color_classes,
|
get_selectable_color_classes,
|
||||||
@@ -31,11 +31,15 @@
|
|||||||
import RefreshPlay from '../svgs/RefreshPlay.svelte';
|
import RefreshPlay from '../svgs/RefreshPlay.svelte';
|
||||||
import { get_file_size_display_string, get_file_type } from '$lib/ts/utils';
|
import { get_file_size_display_string, get_file_type } from '$lib/ts/utils';
|
||||||
import { open_file } from '$lib/ts/api_handler';
|
import { open_file } from '$lib/ts/api_handler';
|
||||||
import { get_display_by_id, run_on_all_selected_displays } from '$lib/ts/stores/displays';
|
import {
|
||||||
|
get_display_by_id,
|
||||||
|
run_on_all_selected_displays,
|
||||||
|
selected_online_display_ids
|
||||||
|
} from '$lib/ts/stores/displays';
|
||||||
import { get_thumbnail_url } from '$lib/ts/stores/thumbnails';
|
import { get_thumbnail_url } from '$lib/ts/stores/thumbnails';
|
||||||
import { liveQuery, type Observable } from 'dexie';
|
import { liveQuery, type Observable } from 'dexie';
|
||||||
import { db } from '$lib/ts/database';
|
import { db } from '$lib/ts/database';
|
||||||
import { file_transfer_tasks } from '$lib/ts/file_transfer_handler';
|
import { add_sync_recursively, file_transfer_tasks } from '$lib/ts/file_transfer_handler';
|
||||||
|
|
||||||
let { file, not_interactable = false }: { file: Inode; not_interactable?: boolean } = $props();
|
let { file, not_interactable = false }: { file: Inode; not_interactable?: boolean } = $props();
|
||||||
|
|
||||||
@@ -45,10 +49,15 @@
|
|||||||
| Observable<{ missing: string[]; colliding: string[] }>
|
| Observable<{ missing: string[]; colliding: string[] }>
|
||||||
| undefined = $state();
|
| undefined = $state();
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
const s = $selected_file_ids;
|
const f = file;
|
||||||
missing_colliding_displays_ids = liveQuery(() => get_missing_colliding_display_ids(file, s));
|
const s = $selected_online_display_ids;
|
||||||
|
missing_colliding_displays_ids = liveQuery(() => get_missing_colliding_display_ids(f, s));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let colliding_warning: boolean = $derived(
|
||||||
|
!!$missing_colliding_displays_ids && $missing_colliding_displays_ids.colliding.length !== 0
|
||||||
|
);
|
||||||
|
|
||||||
let file_size: Observable<number> | undefined = $state();
|
let file_size: Observable<number> | undefined = $state();
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
const f = file;
|
const f = file;
|
||||||
@@ -159,6 +168,11 @@
|
|||||||
async function open() {
|
async function open() {
|
||||||
if (file_is_folder) {
|
if (file_is_folder) {
|
||||||
await change_file_path($current_file_path + file.name + '/');
|
await change_file_path($current_file_path + file.name + '/');
|
||||||
|
} else if (
|
||||||
|
!!$missing_colliding_displays_ids &&
|
||||||
|
$missing_colliding_displays_ids.missing.length !== 0
|
||||||
|
) {
|
||||||
|
await add_sync_recursively(get_file_primary_key(file), $selected_online_display_ids, true);
|
||||||
} else {
|
} else {
|
||||||
const path_to_file = $current_file_path + file.name;
|
const path_to_file = $current_file_path + file.name;
|
||||||
await run_on_all_selected_displays((d) => open_file(d.ip, path_to_file));
|
await run_on_all_selected_displays((d) => open_file(d.ip, path_to_file));
|
||||||
@@ -215,7 +229,7 @@
|
|||||||
if (is_folder(file)) {
|
if (is_folder(file)) {
|
||||||
const folder_elements = await get_folder_elements(
|
const folder_elements = await get_folder_elements(
|
||||||
file.path + file.name + '/',
|
file.path + file.name + '/',
|
||||||
$selected_display_ids
|
$selected_online_display_ids
|
||||||
);
|
);
|
||||||
let out: number = 0;
|
let out: number = 0;
|
||||||
for (const el of folder_elements) {
|
for (const el of folder_elements) {
|
||||||
@@ -237,27 +251,37 @@
|
|||||||
{#if !not_interactable}
|
{#if !not_interactable}
|
||||||
<div class="h-{$current_height.file} aspect-square max-w-15 flex">
|
<div class="h-{$current_height.file} aspect-square max-w-15 flex">
|
||||||
<Button
|
<Button
|
||||||
disabled={!file_is_folder && get_file_type(file) === null}
|
disabled={(!file_is_folder && get_file_type(file) === null) || colliding_warning}
|
||||||
title={!file_is_folder && get_file_type(file) === null ? 'Dateityp nicht unterstützt' : ''}
|
title={!file_is_folder && get_file_type(file) === null
|
||||||
|
? 'Dateityp nicht unterstützt'
|
||||||
|
: colliding_warning
|
||||||
|
? 'Dateien kollidieren auf verschiedenen Bildschirmen'
|
||||||
|
: ''}
|
||||||
className="flex rounded-l-lg rounded-r-none {file_is_folder
|
className="flex rounded-l-lg rounded-r-none {file_is_folder
|
||||||
? 'text-stone-450'
|
? 'text-stone-450'
|
||||||
: 'text-stone-800'} w-full"
|
: 'text-stone-800'} w-full"
|
||||||
div_class="w-full"
|
div_class="w-full"
|
||||||
bg={get_selectable_color_classes(
|
bg={colliding_warning
|
||||||
|
? 'bg-red-400'
|
||||||
|
: get_selectable_color_classes(
|
||||||
!file_is_folder && get_file_type(file) !== null,
|
!file_is_folder && get_file_type(file) !== null,
|
||||||
{
|
{
|
||||||
bg: true
|
bg: true
|
||||||
},
|
},
|
||||||
-50
|
-50
|
||||||
)}
|
)}
|
||||||
hover_bg={get_selectable_color_classes(
|
hover_bg={colliding_warning
|
||||||
|
? 'bg-red-500'
|
||||||
|
: get_selectable_color_classes(
|
||||||
!file_is_folder,
|
!file_is_folder,
|
||||||
{
|
{
|
||||||
bg: true
|
bg: true
|
||||||
},
|
},
|
||||||
50
|
50
|
||||||
)}
|
)}
|
||||||
active_bg={get_selectable_color_classes(
|
active_bg={colliding_warning
|
||||||
|
? 'bg-red-500'
|
||||||
|
: get_selectable_color_classes(
|
||||||
!file_is_folder,
|
!file_is_folder,
|
||||||
{
|
{
|
||||||
bg: true
|
bg: true
|
||||||
@@ -271,12 +295,14 @@
|
|||||||
>
|
>
|
||||||
{#if file_is_folder}
|
{#if file_is_folder}
|
||||||
<ArrowRight class="size-full" strokeWidth="3" />
|
<ArrowRight class="size-full" strokeWidth="3" />
|
||||||
{:else if $missing_colliding_displays_ids && $missing_colliding_displays_ids.missing.length !== 0}
|
{:else if get_file_type(file) === null}
|
||||||
<RefreshPlay className="size-full" />
|
|
||||||
{:else if get_file_type(file) !== null}
|
|
||||||
<Play class="size-full" strokeWidth="3" />
|
|
||||||
{:else}
|
|
||||||
<Ban class="size-full" strokeWidth="3" />
|
<Ban class="size-full" strokeWidth="3" />
|
||||||
|
{:else if colliding_warning}
|
||||||
|
<TriangleAlert class="size-full" strokeWidth="3" />
|
||||||
|
{:else if !!$missing_colliding_displays_ids && $missing_colliding_displays_ids.missing.length !== 0}
|
||||||
|
<RefreshPlay className="size-full" />
|
||||||
|
{:else}
|
||||||
|
<Play class="size-full" strokeWidth="3" />
|
||||||
{/if}
|
{/if}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -325,33 +351,6 @@
|
|||||||
is_selected(file_primary_key, $selected_file_ids)
|
is_selected(file_primary_key, $selected_file_ids)
|
||||||
)} duration-200 transition-colors"
|
)} duration-200 transition-colors"
|
||||||
>
|
>
|
||||||
<!-- {#if get_display_ids_where_file_is_missing($current_file_path, file, $selected_display_ids, $all_files)[1].length !== 0}
|
|
||||||
<Button
|
|
||||||
className="h-8 aspect-square transition-colors duration-200 !p-1.5 text-stone-100"
|
|
||||||
bg="bg-red-500"
|
|
||||||
click_function={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TriangleAlert class="size-full" />
|
|
||||||
</Button>
|
|
||||||
{:else if get_display_ids_where_file_is_missing($current_file_path, file, $selected_display_ids, $all_files)[0].length !== 0}
|
|
||||||
<Button
|
|
||||||
className="h-8 aspect-square transition-colors duration-200 !p-1.5"
|
|
||||||
bg="bg-transparent"
|
|
||||||
hover_bg={get_selectable_color_classes(false, {
|
|
||||||
bg: true
|
|
||||||
})}
|
|
||||||
active_bg={get_selectable_color_classes(false, {
|
|
||||||
bg: true
|
|
||||||
})}
|
|
||||||
click_function={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<RefreshCcwDot class="size-full" />
|
|
||||||
</Button>
|
|
||||||
{/if} -->
|
|
||||||
<div
|
<div
|
||||||
class="w-14 content-center text-center select-none text-xs whitespace-nowrap"
|
class="w-14 content-center text-center select-none text-xs whitespace-nowrap"
|
||||||
title={get_created_info($date_mapping, true)}
|
title={get_created_info($date_mapping, true)}
|
||||||
|
|||||||
@@ -232,9 +232,6 @@ async function request(
|
|||||||
): Promise<RequestResponse> {
|
): Promise<RequestResponse> {
|
||||||
try {
|
try {
|
||||||
const cache_buster = `${url.includes('?') ? '&' : '?'}=${Date.now()}`;
|
const cache_buster = `${url.includes('?') ? '&' : '?'}=${Date.now()}`;
|
||||||
if (dev) {
|
|
||||||
console.debug('Sending request: ', url + cache_buster, 'with', options.body ?? 'none');
|
|
||||||
}
|
|
||||||
const response = await fetch(url + cache_buster, options);
|
const response = await fetch(url + cache_buster, options);
|
||||||
if (response.ok || supress_error_handling_http_codes.includes(response.status)) {
|
if (response.ok || supress_error_handling_http_codes.includes(response.status)) {
|
||||||
const contentType = response.headers.get('content-type') || '';
|
const contentType = response.headers.get('content-type') || '';
|
||||||
@@ -245,9 +242,6 @@ async function request(
|
|||||||
} else {
|
} else {
|
||||||
const json: Record<string, unknown> = await response.json();
|
const json: Record<string, unknown> = await response.json();
|
||||||
request_response = { ok: response.ok, http_code: response.status, json: json };
|
request_response = { ok: response.ok, http_code: response.status, json: json };
|
||||||
if (dev) {
|
|
||||||
console.debug(request_response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return request_response;
|
return request_response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { get, writable, type Writable } from 'svelte/store';
|
import { get, writable, type Writable } from 'svelte/store';
|
||||||
import { db } from './database';
|
import { db } from './database';
|
||||||
import { get_display_by_id } from './stores/displays';
|
import { get_display_by_id, run_on_all_selected_displays } from './stores/displays';
|
||||||
import {
|
import {
|
||||||
create_path_on_all_selected_displays,
|
create_path_on_all_selected_displays,
|
||||||
get_folder_elements,
|
get_folder_elements,
|
||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
type ShortDisplay
|
type ShortDisplay
|
||||||
} from './types';
|
} from './types';
|
||||||
import { get_sanitized_file_url, get_uuid, make_valid_name } from './utils';
|
import { get_sanitized_file_url, get_uuid, make_valid_name } from './utils';
|
||||||
|
import { open_file } from './api_handler';
|
||||||
|
|
||||||
const START_LOADING_DATA = {
|
const START_LOADING_DATA = {
|
||||||
percentage: 0,
|
percentage: 0,
|
||||||
@@ -102,7 +103,8 @@ export async function add_upload(
|
|||||||
|
|
||||||
export async function add_sync_recursively(
|
export async function add_sync_recursively(
|
||||||
selected_file_id: string,
|
selected_file_id: string,
|
||||||
selected_display_ids: string[]
|
selected_display_ids: string[],
|
||||||
|
open_file_afterwards: boolean = false
|
||||||
) {
|
) {
|
||||||
const file_data = await find_file_data_on_active_selected_display(
|
const file_data = await find_file_data_on_active_selected_display(
|
||||||
selected_file_id,
|
selected_file_id,
|
||||||
@@ -134,7 +136,8 @@ export async function add_sync_recursively(
|
|||||||
destination_display_data: file_data.short_displays_without_file.map((display) => ({
|
destination_display_data: file_data.short_displays_without_file.map((display) => ({
|
||||||
display,
|
display,
|
||||||
loading_data: START_LOADING_DATA
|
loading_data: START_LOADING_DATA
|
||||||
}))
|
})),
|
||||||
|
open_file_afterwards_on_display_ids: open_file_afterwards ? selected_display_ids : []
|
||||||
},
|
},
|
||||||
display: file_data.short_display_with_file,
|
display: file_data.short_display_with_file,
|
||||||
path: file_data.file.path,
|
path: file_data.file.path,
|
||||||
@@ -285,6 +288,12 @@ export async function sync(file_primary_key: string, task: FileTransferTask) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await dir.removeEntry(temp_name);
|
await dir.removeEntry(temp_name);
|
||||||
|
|
||||||
|
// open file, if required
|
||||||
|
if (task.data.open_file_afterwards_on_display_ids.length !== 0) {
|
||||||
|
const path_to_file = task.path + task.file_name;
|
||||||
|
await run_on_all_selected_displays((d) => open_file(d.ip, path_to_file), true, task.data.open_file_afterwards_on_display_ids);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
show_general_error(file_primary_key, task, String(e));
|
show_general_error(file_primary_key, task, String(e));
|
||||||
}
|
}
|
||||||
@@ -295,8 +304,7 @@ export async function download_file(selected_file_id: string, selected_display_i
|
|||||||
selected_file_id,
|
selected_file_id,
|
||||||
selected_display_ids
|
selected_display_ids
|
||||||
);
|
);
|
||||||
if (!file_data || is_folder(file_data.file))
|
if (!file_data || is_folder(file_data.file)) return console.warn('Download cancelled: is folder');
|
||||||
return console.warn('Download cancelled: is folder');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = `http://${file_data.short_display_with_file.ip}:1323/api${get_sanitized_file_url(file_data.file.path + file_data.file.name)}`;
|
const url = `http://${file_data.short_display_with_file.ip}:1323/api${get_sanitized_file_url(file_data.file.path + file_data.file.name)}`;
|
||||||
@@ -455,7 +463,11 @@ function update_current_loading_data(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_updated_task(current_loading_data: FileLoadingData, destination_display_id: string | null, task: FileTransferTask): FileTransferTask {
|
function get_updated_task(
|
||||||
|
current_loading_data: FileLoadingData,
|
||||||
|
destination_display_id: string | null,
|
||||||
|
task: FileTransferTask
|
||||||
|
): FileTransferTask {
|
||||||
if (destination_display_id && task.data.type === 'sync') {
|
if (destination_display_id && task.data.type === 'sync') {
|
||||||
const updatedDestinations = task.data.destination_display_data.map((dd) =>
|
const updatedDestinations = task.data.destination_display_data.map((dd) =>
|
||||||
dd.display.id === destination_display_id ? { ...dd, loading_data: current_loading_data } : dd
|
dd.display.id === destination_display_id ? { ...dd, loading_data: current_loading_data } : dd
|
||||||
|
|||||||
@@ -22,8 +22,12 @@ export const online_displays_sub = liveQuery(() =>
|
|||||||
db.displays.where('status').equals('app_online').toArray()
|
db.displays.where('status').equals('app_online').toArray()
|
||||||
).subscribe((value) => {
|
).subscribe((value) => {
|
||||||
online_displays.set(value);
|
online_displays.set(value);
|
||||||
|
const current_online_display_ids = value.map((d) => d.id);
|
||||||
|
selected_online_display_ids.set(get(selected_display_ids).filter((id) => current_online_display_ids.includes(id)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const selected_online_display_ids: Writable<string[]> = writable<string[]>([]);
|
||||||
|
|
||||||
export const local_displays: Writable<DisplayIdGroup[]> = writable<DisplayIdGroup[]>([]);
|
export const local_displays: Writable<DisplayIdGroup[]> = writable<DisplayIdGroup[]>([]);
|
||||||
|
|
||||||
export async function is_display_name_taken(name: string): Promise<boolean> {
|
export async function is_display_name_taken(name: string): Promise<boolean> {
|
||||||
@@ -193,17 +197,18 @@ export function screenshot_loop(display_id: string) {
|
|||||||
export async function run_on_all_selected_displays(
|
export async function run_on_all_selected_displays(
|
||||||
run_function: (display: Display) => void | Promise<void>,
|
run_function: (display: Display) => void | Promise<void>,
|
||||||
update_screenshot_afterwards: boolean = true,
|
update_screenshot_afterwards: boolean = true,
|
||||||
ignore_offline: boolean = true
|
display_ids: string[] | null = null
|
||||||
) {
|
) {
|
||||||
|
if (!display_ids) display_ids = get(selected_online_display_ids);
|
||||||
const maybe_displays: (Display | null)[] = await Promise.all(
|
const maybe_displays: (Display | null)[] = await Promise.all(
|
||||||
// fails when only a single promis fails
|
// fails when only a single promis fails
|
||||||
get(selected_display_ids).map(async (id) => await get_display_by_id(id))
|
display_ids.map(async (id) => await get_display_by_id(id))
|
||||||
);
|
);
|
||||||
const displays: Display[] = maybe_displays.filter((d): d is Display => d !== null);
|
const displays: Display[] = maybe_displays.filter((d): d is Display => d !== null);
|
||||||
|
|
||||||
Promise.all(
|
await Promise.all(
|
||||||
displays.map(async (display) => {
|
displays.map(async (display) => {
|
||||||
if (!display || (ignore_offline && display.status === 'host_offline')) return;
|
if (!display) return;
|
||||||
await run_function(display);
|
await run_function(display);
|
||||||
if (update_screenshot_afterwards) {
|
if (update_screenshot_afterwards) {
|
||||||
screenshot_loop(display.id);
|
screenshot_loop(display.id);
|
||||||
@@ -269,15 +274,6 @@ export function set_new_display_order(display_id_group_id: string, new_data: Dis
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function no_active_display_selected(
|
|
||||||
selected_display_ids: string[],
|
|
||||||
online_displays: Display[]
|
|
||||||
) {
|
|
||||||
const online_and_selected_displays = online_displays.filter((d) =>
|
|
||||||
selected_display_ids.includes(d.id)
|
|
||||||
);
|
|
||||||
return online_and_selected_displays.length === 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev) {
|
if (dev) {
|
||||||
setTimeout(add_testing_displays, 0);
|
setTimeout(add_testing_displays, 0);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
type Inode,
|
type Inode,
|
||||||
type TreeElement
|
type TreeElement
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { get_display_by_id } from './displays';
|
import { get_display_by_id, selected_online_display_ids } from './displays';
|
||||||
import { is_selected, select, selected_display_ids, selected_file_ids } from './select';
|
import { is_selected, select, selected_display_ids, selected_file_ids } from './select';
|
||||||
import { create_path, get_file_data, get_file_tree_data } from '../api_handler';
|
import { create_path, get_file_data, get_file_tree_data } from '../api_handler';
|
||||||
import { deactivate_old_thumbnail_urls, generate_thumbnail } from './thumbnails';
|
import { deactivate_old_thumbnail_urls, generate_thumbnail } from './thumbnails';
|
||||||
@@ -29,14 +29,18 @@ export async function change_file_path(new_path: string) {
|
|||||||
const displays = await db.displays.toArray();
|
const displays = await db.displays.toArray();
|
||||||
|
|
||||||
for (const display of displays) {
|
for (const display of displays) {
|
||||||
const changed_paths = await get_changed_directory_paths(display, new_path);
|
await update_changed_directories(display, new_path);
|
||||||
if (!changed_paths) continue;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update_changed_directories(display: Display, path: string = '/') {
|
||||||
|
const changed_paths = await get_changed_directory_paths(display, path);
|
||||||
|
if (!changed_paths) return;
|
||||||
console.debug('Update file system from', display.name, ':', changed_paths);
|
console.debug('Update file system from', display.name, ':', changed_paths);
|
||||||
for (const path of changed_paths) {
|
for (const path of changed_paths) {
|
||||||
await update_folder_elements_recursively(display, path);
|
await update_folder_elements_recursively(display, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
export async function delete_and_deselect_unique_files_from_display(display_id: string) {
|
export async function delete_and_deselect_unique_files_from_display(display_id: string) {
|
||||||
const files_on_display = await db.files_on_display
|
const files_on_display = await db.files_on_display
|
||||||
@@ -94,7 +98,10 @@ export async function update_current_folder_on_selected_displays() {
|
|||||||
});
|
});
|
||||||
const current_path = get(current_file_path);
|
const current_path = get(current_file_path);
|
||||||
|
|
||||||
for (const display of await db.displays.where('id').anyOf(get(selected_display_ids)).toArray()) {
|
for (const display of await db.displays
|
||||||
|
.where('id')
|
||||||
|
.anyOf(get(selected_online_display_ids))
|
||||||
|
.toArray()) {
|
||||||
await update_folder_elements_recursively(display, current_path);
|
await update_folder_elements_recursively(display, current_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,13 +114,19 @@ export async function get_missing_colliding_display_ids(
|
|||||||
|
|
||||||
const colliding: string[] = [];
|
const colliding: string[] = [];
|
||||||
const colliding_files = await db.files
|
const colliding_files = await db.files
|
||||||
.where('[path+name]')
|
.where('name')
|
||||||
.equals([file.path, file.name])
|
.equals(file.name)
|
||||||
.filter((e) => e.size !== file.size || e.type !== file.type)
|
.filter((e) => e.path === file.path && e.size !== file.size)
|
||||||
.toArray();
|
.toArray();
|
||||||
for (const colliding_file of colliding_files) {
|
for (const colliding_file of colliding_files) {
|
||||||
colliding.push(
|
colliding.push(
|
||||||
...(await get_display_ids_where_file_is_missing(colliding_file, selected_display_ids))
|
...(
|
||||||
|
await db.files_on_display
|
||||||
|
.where('file_primary_key')
|
||||||
|
.equals(get_file_primary_key(colliding_file))
|
||||||
|
.filter((fod) => selected_display_ids.includes(fod.display_id))
|
||||||
|
.toArray()
|
||||||
|
).map((fod) => fod.display_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +384,7 @@ export async function get_file_by_id(
|
|||||||
export async function run_for_selected_files_on_selected_displays(
|
export async function run_for_selected_files_on_selected_displays(
|
||||||
action: (ip: string, file_names: string[]) => Promise<void>
|
action: (ip: string, file_names: string[]) => Promise<void>
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
for (const display_id of get(selected_display_ids)) {
|
for (const display_id of get(selected_online_display_ids)) {
|
||||||
const file_key_strings_on_display: string[] = (
|
const file_key_strings_on_display: string[] = (
|
||||||
await db.files_on_display.where('display_id').equals(display_id).toArray()
|
await db.files_on_display.where('display_id').equals(display_id).toArray()
|
||||||
).map((e) => e.file_primary_key);
|
).map((e) => e.file_primary_key);
|
||||||
@@ -409,12 +422,7 @@ export async function create_path_on_all_selected_displays(
|
|||||||
}
|
}
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
for (const display of displays_without_path) {
|
for (const display of displays_without_path) {
|
||||||
const changed_paths = await get_changed_directory_paths(display, '/');
|
await update_changed_directories(display);
|
||||||
if (!changed_paths) continue;
|
|
||||||
console.debug('Update file system from', display.name, ':', changed_paths);
|
|
||||||
for (const path of changed_paths) {
|
|
||||||
await update_folder_elements_recursively(display, path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { writable, type Writable } from 'svelte/store';
|
import { get, writable, type Writable } from 'svelte/store';
|
||||||
|
import { online_displays, selected_online_display_ids } from './displays';
|
||||||
|
|
||||||
export const selected_file_ids: Writable<string[]> = writable<string[]>([]); // JSON.stringify([string, string, number, string])
|
export const selected_file_ids: Writable<string[]> = writable<string[]>([]); // JSON.stringify([string, string, number, string])
|
||||||
export const selected_display_ids: Writable<string[]> = writable<string[]>([]);
|
export const selected_display_ids: Writable<string[]> = writable<string[]>([]);
|
||||||
@@ -19,6 +20,11 @@ export function select(
|
|||||||
}
|
}
|
||||||
return all_ids;
|
return all_ids;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (selected_ids === selected_display_ids) {
|
||||||
|
const current_online_display_ids = get(online_displays).map((d) => d.id);
|
||||||
|
selected_online_display_ids.set(get(selected_display_ids).filter((id) => current_online_display_ids.includes(id)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function is_selected(id: string, selected_ids: string[]): boolean {
|
export function is_selected(id: string, selected_ids: string[]): boolean {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export type FileTransferTaskData =
|
|||||||
display: ShortDisplay;
|
display: ShortDisplay;
|
||||||
loading_data: FileLoadingData;
|
loading_data: FileLoadingData;
|
||||||
}[];
|
}[];
|
||||||
|
open_file_afterwards_on_display_ids: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FileLoadingData = {
|
export type FileLoadingData = {
|
||||||
|
|||||||
@@ -113,3 +113,12 @@ export function get_sanitized_file_url(file_path: string, is_preview = false) {
|
|||||||
|
|
||||||
return `/file/${is_preview ? 'preview/' : ''}${[...pathSegments].join('/')}`;
|
return `/file/${is_preview ? 'preview/' : ''}${[...pathSegments].join('/')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let keyboard_queue = Promise.resolve();
|
||||||
|
|
||||||
|
export function add_to_keyboard_queue(task: () => Promise<void>) {
|
||||||
|
keyboard_queue = keyboard_queue.then(task).catch((err) => {
|
||||||
|
console.error('Error in input queue:', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,15 +25,15 @@
|
|||||||
} from '$lib/ts/api_handler';
|
} from '$lib/ts/api_handler';
|
||||||
import {
|
import {
|
||||||
get_display_by_id,
|
get_display_by_id,
|
||||||
no_active_display_selected,
|
run_on_all_selected_displays,
|
||||||
online_displays,
|
selected_online_display_ids
|
||||||
run_on_all_selected_displays
|
|
||||||
} from '$lib/ts/stores/displays';
|
} from '$lib/ts/stores/displays';
|
||||||
import { selected_display_ids } from '$lib/ts/stores/select';
|
import { selected_display_ids } from '$lib/ts/stores/select';
|
||||||
import TipTapInput from './TipTapInput.svelte';
|
import TipTapInput from './TipTapInput.svelte';
|
||||||
import { db } from '$lib/ts/database';
|
import { db } from '$lib/ts/database';
|
||||||
import { liveQuery, type Observable } from 'dexie';
|
import { liveQuery, type Observable } from 'dexie';
|
||||||
import TextInput from '$lib/components/TextInput.svelte';
|
import TextInput from '$lib/components/TextInput.svelte';
|
||||||
|
import { add_to_keyboard_queue } from '$lib/ts/utils';
|
||||||
|
|
||||||
let all_display_states: Observable<'on' | 'off' | 'mixed'> | undefined = $state();
|
let all_display_states: Observable<'on' | 'off' | 'mixed'> | undefined = $state();
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
db.displays.update(d.id, { status: 'app_offline' });
|
db.displays.update(d.id, { status: 'app_offline' });
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
false
|
$selected_display_ids
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,15 +203,15 @@
|
|||||||
<div class="flex flex-row gap-2 w-75 justify-normal">
|
<div class="flex flex-row gap-2 w-75 justify-normal">
|
||||||
<button
|
<button
|
||||||
title="Vorherige Folie (Pfeil nach Links) [gedrückt halten möglich]"
|
title="Vorherige Folie (Pfeil nach Links) [gedrückt halten möglich]"
|
||||||
class="px-9 bg-stone-700 {$selected_display_ids.length === 0
|
class="px-9 bg-stone-700 {$selected_online_display_ids.length === 0
|
||||||
? 'text-stone-500 cursor-not-allowed'
|
? 'text-stone-500 cursor-not-allowed'
|
||||||
: 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200"
|
: 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200"
|
||||||
disabled={$selected_display_ids.length === 0}
|
disabled={$selected_online_display_ids.length === 0}
|
||||||
onmousedown={async () => {
|
onmousedown={() => {
|
||||||
await send_single_key_press('ArrowLeft', 'press');
|
add_to_keyboard_queue(async () => await send_single_key_press('ArrowLeft', 'press'));
|
||||||
}}
|
}}
|
||||||
onmouseup={async () => {
|
onmouseup={() => {
|
||||||
await send_single_key_press('ArrowLeft', 'release');
|
add_to_keyboard_queue(async () => await send_single_key_press('ArrowLeft', 'release'));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ArrowBigLeft />
|
<ArrowBigLeft />
|
||||||
@@ -219,15 +219,15 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
title="Vorherige Folie (Pfeil nach Links) [gedrückt halten möglich]"
|
title="Vorherige Folie (Pfeil nach Links) [gedrückt halten möglich]"
|
||||||
class="px-9 bg-stone-700 {$selected_display_ids.length === 0
|
class="px-9 bg-stone-700 {$selected_online_display_ids.length === 0
|
||||||
? 'text-stone-500 cursor-not-allowed'
|
? 'text-stone-500 cursor-not-allowed'
|
||||||
: 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200"
|
: 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200"
|
||||||
disabled={$selected_display_ids.length === 0}
|
disabled={$selected_online_display_ids.length === 0}
|
||||||
onmousedown={async () => {
|
onmousedown={() => {
|
||||||
await send_single_key_press('ArrowRight', 'press');
|
add_to_keyboard_queue(async () => await send_single_key_press('ArrowRight', 'press'));
|
||||||
}}
|
}}
|
||||||
onmouseup={async () => {
|
onmouseup={() => {
|
||||||
await send_single_key_press('ArrowRight', 'release');
|
add_to_keyboard_queue(async () => await send_single_key_press('ArrowRight', 'release'));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ArrowBigRight />
|
<ArrowBigRight />
|
||||||
@@ -237,19 +237,19 @@
|
|||||||
<Button
|
<Button
|
||||||
className="px-3 flex gap-3 w-75 justify-normal"
|
className="px-3 flex gap-3 w-75 justify-normal"
|
||||||
click_function={show_text_popup}
|
click_function={show_text_popup}
|
||||||
disabled={no_active_display_selected($selected_display_ids, $online_displays)}
|
disabled={$selected_online_display_ids.length === 0}
|
||||||
><TextAlignStart /> Text Anzeigen</Button
|
><TextAlignStart /> Text Anzeigen</Button
|
||||||
>
|
>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
className="px-3 flex gap-3 w-75 justify-normal"
|
className="px-3 flex gap-3 w-75 justify-normal"
|
||||||
disabled={no_active_display_selected($selected_display_ids, $online_displays)}
|
disabled={$selected_online_display_ids.length === 0}
|
||||||
click_function={show_website_popup}><Globe /> Webseite Anzeigen</Button
|
click_function={show_website_popup}><Globe /> Webseite Anzeigen</Button
|
||||||
>
|
>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
className="px-3 flex gap-3 w-75 justify-normal"
|
className="px-3 flex gap-3 w-75 justify-normal"
|
||||||
disabled={no_active_display_selected($selected_display_ids, $online_displays)}
|
disabled={$selected_online_display_ids.length === 0}
|
||||||
click_function={async () => {
|
click_function={async () => {
|
||||||
await run_on_all_selected_displays((d) => show_blackscreen(d.ip));
|
await run_on_all_selected_displays((d) => show_blackscreen(d.ip));
|
||||||
}}><Presentation />Blackout</Button
|
}}><Presentation />Blackout</Button
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
className="px-3 flex gap-3 w-75 justify-normal"
|
className="px-3 flex gap-3 w-75 justify-normal"
|
||||||
disabled={no_active_display_selected($selected_display_ids, $online_displays)}
|
disabled={$selected_online_display_ids.length === 0}
|
||||||
click_function={show_send_keys_popup}><Keyboard /> Tastatur-Eingaben Senden</Button
|
click_function={show_send_keys_popup}><Keyboard /> Tastatur-Eingaben Senden</Button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -273,7 +273,7 @@
|
|||||||
<Button
|
<Button
|
||||||
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
||||||
disabled={$all_display_states === 'on' ||
|
disabled={$all_display_states === 'on' ||
|
||||||
no_active_display_selected($selected_display_ids, $online_displays)}
|
$selected_display_ids.length === 0}
|
||||||
click_function={startup_action}
|
click_function={startup_action}
|
||||||
>
|
>
|
||||||
<Power /> Bildschirm Hochfahren
|
<Power /> Bildschirm Hochfahren
|
||||||
@@ -282,7 +282,7 @@
|
|||||||
<Button
|
<Button
|
||||||
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
||||||
disabled={$all_display_states === 'off' ||
|
disabled={$all_display_states === 'off' ||
|
||||||
no_active_display_selected($selected_display_ids, $online_displays)}
|
$selected_online_display_ids.length === 0}
|
||||||
click_function={ask_shutdown}
|
click_function={ask_shutdown}
|
||||||
>
|
>
|
||||||
<PowerOff /> Bildschirm Herunterfahren</Button
|
<PowerOff /> Bildschirm Herunterfahren</Button
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
import HighlightedText from '$lib/components/HighlightedText.svelte';
|
import HighlightedText from '$lib/components/HighlightedText.svelte';
|
||||||
import { liveQuery, type Observable } from 'dexie';
|
import { liveQuery, type Observable } from 'dexie';
|
||||||
import { download_file, add_upload, add_sync_recursively } from '$lib/ts/file_transfer_handler';
|
import { download_file, add_upload, add_sync_recursively } from '$lib/ts/file_transfer_handler';
|
||||||
import { no_active_display_selected, online_displays } from '$lib/ts/stores/displays';
|
import { selected_online_display_ids } from '$lib/ts/stores/displays';
|
||||||
|
|
||||||
let current_name: string = $state('');
|
let current_name: string = $state('');
|
||||||
let current_valid: boolean = $state(false);
|
let current_valid: boolean = $state(false);
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
let current_folder_elements: Observable<Inode[]> | undefined = $state();
|
let current_folder_elements: Observable<Inode[]> | undefined = $state();
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
const path = $current_file_path,
|
const path = $current_file_path,
|
||||||
display_ids = $selected_display_ids;
|
display_ids = $selected_online_display_ids;
|
||||||
current_folder_elements = liveQuery(() => get_folder_elements(path, display_ids));
|
current_folder_elements = liveQuery(() => get_folder_elements(path, display_ids));
|
||||||
});
|
});
|
||||||
let one_file_selected: Observable<boolean> | undefined = $state();
|
let one_file_selected: Observable<boolean> | undefined = $state();
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
one_file_selected = liveQuery(async () => {
|
one_file_selected = liveQuery(async () => {
|
||||||
const inode = await get_file_by_id(s[0]);
|
const inode = await get_file_by_id(s[0]);
|
||||||
if (!inode) return false;
|
if (!inode) return false;
|
||||||
return s.length === 1 && is_folder(inode);
|
return s.length === 1 && !is_folder(inode);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
async function create_new_folder() {
|
async function create_new_folder() {
|
||||||
popup_close_function();
|
popup_close_function();
|
||||||
const path_with_folder_name = ($current_file_path += current_name.trim() + '/');
|
const path_with_folder_name = ($current_file_path += current_name.trim() + '/');
|
||||||
await create_path_on_all_selected_displays(path_with_folder_name, $selected_display_ids);
|
await create_path_on_all_selected_displays(path_with_folder_name, $selected_online_display_ids);
|
||||||
await update_current_folder_on_selected_displays();
|
await update_current_folder_on_selected_displays();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
current_name = '';
|
current_name = '';
|
||||||
current_valid = false;
|
current_valid = false;
|
||||||
display_names_where_path_does_not_exist = (
|
display_names_where_path_does_not_exist = (
|
||||||
await get_displays_where_path_not_exists($current_file_path, $selected_display_ids)
|
await get_displays_where_path_not_exists($current_file_path, $selected_online_display_ids)
|
||||||
).map((display) => display.name);
|
).map((display) => display.name);
|
||||||
popup_content = {
|
popup_content = {
|
||||||
open: true,
|
open: true,
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
multiple
|
multiple
|
||||||
accept={get_accepted_file_type_string()}
|
accept={get_accepted_file_type_string()}
|
||||||
onchange={(e) =>
|
onchange={(e) =>
|
||||||
add_upload((e.target as HTMLInputElement).files!, $selected_display_ids, $current_file_path)}
|
add_upload((e.target as HTMLInputElement).files!, $selected_online_display_ids, $current_file_path)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="bg-stone-800 h-full rounded-2xl grid grid-rows-[2.5rem_1fr] min-h-0">
|
<div class="bg-stone-800 h-full rounded-2xl grid grid-rows-[2.5rem_1fr] min-h-0">
|
||||||
@@ -319,7 +319,7 @@
|
|||||||
title="Neuen Ordner erstellen (Neuen Ordner mit ausgewählten Objekten erstellen)"
|
title="Neuen Ordner erstellen (Neuen Ordner mit ausgewählten Objekten erstellen)"
|
||||||
className="px-3 flex"
|
className="px-3 flex"
|
||||||
click_function={show_new_folder_popup}
|
click_function={show_new_folder_popup}
|
||||||
disabled={no_active_display_selected($selected_display_ids, $online_displays)}><FolderPlus /></Button
|
disabled={$selected_online_display_ids.length === 0}><FolderPlus /></Button
|
||||||
>
|
>
|
||||||
<div class="border border-stone-700 my-1"></div>
|
<div class="border border-stone-700 my-1"></div>
|
||||||
<Button
|
<Button
|
||||||
@@ -328,13 +328,13 @@
|
|||||||
click_function={() => {
|
click_function={() => {
|
||||||
if (file_input) file_input.click();
|
if (file_input) file_input.click();
|
||||||
}}
|
}}
|
||||||
disabled={no_active_display_selected($selected_display_ids, $online_displays)}><Upload /></Button
|
disabled={$selected_online_display_ids.length === 0}><Upload /></Button
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
title="Ausgewählte Datei herunterladen"
|
title="Ausgewählte Datei herunterladen"
|
||||||
className="px-3 flex"
|
className="px-3 flex"
|
||||||
click_function={async () =>
|
click_function={async () =>
|
||||||
await download_file($selected_file_ids[0], $selected_display_ids)}
|
await download_file($selected_file_ids[0], $selected_online_display_ids)}
|
||||||
disabled={!$one_file_selected}><Download /></Button
|
disabled={!$one_file_selected}><Download /></Button
|
||||||
>
|
>
|
||||||
<div class="border border-stone-700 my-1"></div>
|
<div class="border border-stone-700 my-1"></div>
|
||||||
@@ -344,10 +344,10 @@
|
|||||||
click_function={async () =>
|
click_function={async () =>
|
||||||
await sync_selected_files(
|
await sync_selected_files(
|
||||||
$selected_file_ids,
|
$selected_file_ids,
|
||||||
$selected_display_ids,
|
$selected_online_display_ids,
|
||||||
$current_folder_elements ?? []
|
$current_folder_elements ?? []
|
||||||
)}
|
)}
|
||||||
disabled={no_active_display_selected($selected_display_ids, $online_displays)}
|
disabled={$selected_online_display_ids.length === 0}
|
||||||
><RefreshCcw />
|
><RefreshCcw />
|
||||||
<span class="hidden 2xl:flex">Synchronisieren</span>
|
<span class="hidden 2xl:flex">Synchronisieren</span>
|
||||||
</Button>
|
</Button>
|
||||||
@@ -361,7 +361,7 @@
|
|||||||
<Button
|
<Button
|
||||||
title="Ausgewählte Datei(en) einfügen"
|
title="Ausgewählte Datei(en) einfügen"
|
||||||
className="px-3 flex"
|
className="px-3 flex"
|
||||||
disabled={no_active_display_selected($selected_display_ids, $online_displays)}
|
disabled={$selected_online_display_ids.length === 0}
|
||||||
>
|
>
|
||||||
<ClipboardPaste />
|
<ClipboardPaste />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -385,7 +385,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="min-h-0 h-full overflow-y-auto overflow-x-hidden bg-stone-750 rounded-xl">
|
<div class="min-h-0 h-full overflow-y-auto overflow-x-hidden bg-stone-750 rounded-xl">
|
||||||
<div class="flex flex-col gap-2 p-2 min-h-0 max-w-full">
|
<div class="flex flex-col gap-2 p-2 min-h-0 max-w-full">
|
||||||
{#if no_active_display_selected($selected_display_ids, $online_displays)}
|
{#if $selected_online_display_ids.length === 0}
|
||||||
<span class="text-stone-450 px-10 py-6 leading-relaxed text-center">
|
<span class="text-stone-450 px-10 py-6 leading-relaxed text-center">
|
||||||
Es sind keine Bildschirme ausgewählt.
|
Es sind keine Bildschirme ausgewählt.
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import { ArrowDownToLine, ArrowUpFromLine, Grid2x2, Grid2X2, Option } from 'lucide-svelte';
|
import { ArrowDownToLine, ArrowUpFromLine, Grid2x2, Grid2X2, Option } from 'lucide-svelte';
|
||||||
import Button from '$lib/components/Button.svelte';
|
import Button from '$lib/components/Button.svelte';
|
||||||
import { onDestroy } from 'svelte';
|
import { onDestroy } from 'svelte';
|
||||||
|
import { add_to_keyboard_queue } from '$lib/ts/utils';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
popup_close_function
|
popup_close_function
|
||||||
@@ -58,17 +59,21 @@
|
|||||||
const action: 'press' | 'release' = key_down ? 'press' : 'release';
|
const action: 'press' | 'release' = key_down ? 'press' : 'release';
|
||||||
|
|
||||||
add_to_last_keys(action.toUpperCase() + ' ' + key);
|
add_to_last_keys(action.toUpperCase() + ' ' + key);
|
||||||
|
add_to_keyboard_queue(async () => {
|
||||||
await run_on_all_selected_displays((d) => send_keyboard_input(d.ip, [{ key, action }]), true);
|
await run_on_all_selected_displays((d) => send_keyboard_input(d.ip, [{ key, action }]), true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function release_all_pressed_keys() {
|
function release_all_pressed_keys() {
|
||||||
const inputs: { key: string; action: 'press' | 'release' }[] = [];
|
const inputs: { key: string; action: 'press' | 'release' }[] = [];
|
||||||
for (let i = current_keys.length - 1; i >= 0; i--) {
|
for (let i = current_keys.length - 1; i >= 0; i--) {
|
||||||
inputs.push({ key: current_keys[i], action: 'release' });
|
inputs.push({ key: current_keys[i], action: 'release' });
|
||||||
current_keys.splice(i, 1);
|
current_keys.splice(i, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_to_keyboard_queue(async () => {
|
||||||
await run_on_all_selected_displays((d) => send_keyboard_input(d.ip, inputs), true);
|
await run_on_all_selected_displays((d) => send_keyboard_input(d.ip, inputs), true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
@@ -91,7 +96,7 @@
|
|||||||
}}
|
}}
|
||||||
onblur={async () => {
|
onblur={async () => {
|
||||||
active = false;
|
active = false;
|
||||||
await release_all_pressed_keys();
|
release_all_pressed_keys();
|
||||||
}}
|
}}
|
||||||
onkeydown={(e) => on_keyboard_input(e, true)}
|
onkeydown={(e) => on_keyboard_input(e, true)}
|
||||||
onkeyup={(e) => on_keyboard_input(e, false)}
|
onkeyup={(e) => on_keyboard_input(e, false)}
|
||||||
|
|||||||
+1
-8
@@ -295,14 +295,7 @@ func downloadFileRoute(ctx echo.Context) error {
|
|||||||
|
|
||||||
slog.Info("Serving file for download", "path", fullPath)
|
slog.Info("Serving file for download", "path", fullPath)
|
||||||
|
|
||||||
file, err := os.Open(fullPath)
|
return ctx.File(fullPath)
|
||||||
if err != nil {
|
|
||||||
slog.Error("Failed to open file", "file", fullPath, "error", err)
|
|
||||||
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to open file"})
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
return ctx.Stream(http.StatusOK, "application/octet-stream", file)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func openFileRoute(ctx echo.Context) error {
|
func openFileRoute(ctx echo.Context) error {
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
v0.0.19
|
v0.1.1
|
||||||
Reference in New Issue
Block a user