Compare commits

...

31 Commits

Author SHA1 Message Date
E44 ffb9f21ea5 bump version to v0.0.19 2026-01-19 21:37:51 +01:00
E44 c44f009eaf chore(control): add custom website support with another chromium window 2026-01-19 21:37:43 +01:00
E44 541b626be2 chore(nixos): add screen to nixos 2026-01-19 21:09:28 +01:00
E44 203e48c31c bump to v0.0.18 2026-01-19 20:46:38 +01:00
E44 8b878b183b refactor(control): remove unnecessary small function 2026-01-19 20:28:07 +01:00
E44 a38827da54 fix(control): deselect file for sync 2026-01-19 20:24:45 +01:00
2mal3 25c0fe2b4b fix(display): libreoffice lock issues
libreoffice cli is bad documented and broken shit
2026-01-19 19:19:58 +01:00
E44 c96b8fe7e4 bump to version v0.0.17 2026-01-19 18:58:28 +01:00
E44 671c74f25d chore(control): save text and url 2026-01-19 18:57:56 +01:00
2mal3 4d5d9849da feat: support sending modifier keys (#18)
Co-authored-by: E44 <129310925+programmer-44@users.noreply.github.com>
2026-01-19 18:47:53 +01:00
E44 c8e21a64bf fix(control): fix warning in compile process 2026-01-19 18:36:33 +01:00
E44 2711d89f22 chore(control): show folder_size as sum of all folder_elements 2026-01-19 18:33:59 +01:00
E44 c09e4b2d8d chore(control): set size of all folders in db to 0 2026-01-19 17:57:32 +01:00
E44 209080db22 refactor(control): replace === 'inode/directory' with is_folder() 2026-01-19 17:54:47 +01:00
2mal3 4acbc96a58 chore(control): prevent closing popups by clicking outside (#20)
Multiple test users closed various popups accidentally by clicking outside and rarely used the feature to close the popup.
2026-01-19 17:40:53 +01:00
E44 99643f8029 chore(control): display transferring file correctly (still a few bugs) 2026-01-19 15:39:53 +01:00
2mal3 ef7dfa49fe chore(control/ping): increase timeout 2026-01-19 12:43:22 +01:00
E44 7cfa56a906 chore(control): set preview update mode in dev mode to never automatically 2026-01-18 22:34:43 +01:00
E44 63c7cea4ca bump to v0.0.16 2026-01-18 22:24:35 +01:00
E44 0e87ca3ae1 fix(control): screenshot_loop is no longer blocking, preview states are now consistently changed 2026-01-18 22:22:30 +01:00
2mal3 d61ef0fe94 fix: browser insecurity warning 2026-01-18 22:13:03 +01:00
E44 5d1f3e2d20 refactor(control): correct spelling 2026-01-18 19:11:24 +01:00
E44 6dfb29bbd1 chore(control): improve handling with offline displays 2026-01-18 19:05:15 +01:00
2mal3 49410bf372 chore(control): more user friendly open website pop up 2026-01-18 18:59:12 +01:00
2mal3 5d22f62a6e chore(control): german button names 2026-01-18 18:52:22 +01:00
2mal3 a31080c602 chore(control): rename keyboard input 2026-01-18 18:47:59 +01:00
2mal3 ea3cbcb8c6 chore(control): title case for buttons and headings 2026-01-18 18:46:21 +01:00
2mal3 a0cf45c8dc chore: consistent display naming 2026-01-18 18:41:23 +01:00
E44 97d2608adf fix(control): wrong url in not-dev-mode 2026-01-18 18:23:49 +01:00
E44 36d2887247 fix(control): unknown status at app_start 2026-01-18 18:23:01 +01:00
E44 1e9148bff2 fix(control): use local ip address only in dev mode 2026-01-18 18:17:04 +01:00
29 changed files with 870 additions and 777 deletions
@@ -41,7 +41,7 @@
} else { } else {
$pinned_display_id = display_id_object.id; $pinned_display_id = display_id_object.id;
} }
await screenshot_loop(display_id_object.id); screenshot_loop(display_id_object.id);
e.stopPropagation(); e.stopPropagation();
} }
</script> </script>
@@ -11,7 +11,8 @@
type Inode, type Inode,
get_file_primary_key, get_file_primary_key,
type FileOnDisplay, type FileOnDisplay,
type CompleteFileLoadingData type FileTransferTask,
is_folder
} from '$lib/ts/types'; } from '$lib/ts/types';
import { import {
@@ -24,6 +25,7 @@
change_file_path, change_file_path,
current_file_path, current_file_path,
get_date_mapping, get_date_mapping,
get_folder_elements,
get_missing_colliding_display_ids get_missing_colliding_display_ids
} from '$lib/ts/stores/files'; } from '$lib/ts/stores/files';
import RefreshPlay from '../svgs/RefreshPlay.svelte'; import RefreshPlay from '../svgs/RefreshPlay.svelte';
@@ -33,9 +35,12 @@
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';
let { file, not_interactable = false }: { file: Inode; not_interactable?: boolean } = $props(); let { file, not_interactable = false }: { file: Inode; not_interactable?: boolean } = $props();
let file_primary_key = $derived(get_file_primary_key(file));
let missing_colliding_displays_ids: let missing_colliding_displays_ids:
| Observable<{ missing: string[]; colliding: string[] }> | Observable<{ missing: string[]; colliding: string[] }>
| undefined = $state(); | undefined = $state();
@@ -44,34 +49,35 @@
missing_colliding_displays_ids = liveQuery(() => get_missing_colliding_display_ids(file, s)); missing_colliding_displays_ids = liveQuery(() => get_missing_colliding_display_ids(file, s));
}); });
let loading_data: let file_size: Observable<number> | undefined = $state();
| Observable<CompleteFileLoadingData>
| undefined = $state();
$effect(() => { $effect(() => {
const d = $selected_display_ids; const f = file;
loading_data = liveQuery(() => get_loading_data(get_file_primary_key(file), d)); file_size = liveQuery(() => get_size_recursively(f));
}); });
let file_transfer_task: FileTransferTask | null = $derived(
$file_transfer_tasks.hasOwnProperty(file_primary_key)
? $file_transfer_tasks[file_primary_key]
: null
);
let loading_finished = $state(false); let loading_finished = $state(false);
let previous_loading_state = $state(false);
$effect(() => { $effect(() => {
if (!loading_data) return; const ftt = file_transfer_task;
let prev: boolean | undefined; if (previous_loading_state && !ftt) {
const sub = loading_data.subscribe((v) => {
if (prev === true && v.is_loading === false) {
loading_finished = true; loading_finished = true;
setTimeout(() => (loading_finished = false), 200); setTimeout(() => (loading_finished = false), 200);
} }
prev = v.is_loading; previous_loading_state = !!ftt;
});
return () => sub.unsubscribe();
}); });
let thumbnail_url = liveQuery(() => get_thumbnail_url(get_file_primary_key(file))); let thumbnail_url = liveQuery(() => get_thumbnail_url(file_primary_key));
let date_mapping: Observable<Record<string, Date>> = liveQuery(() => let date_mapping: Observable<Record<string, Date>> = liveQuery(() =>
get_date_mapping(get_file_primary_key(file)) get_date_mapping(file_primary_key)
); );
const is_folder = file.type === 'inode/directory'; const file_is_folder = $derived(is_folder(file));
function get_created_info(date_mapping: Record<string, Date> | undefined, full_string = false) { function get_created_info(date_mapping: Record<string, Date> | undefined, full_string = false) {
if (!date_mapping) return ''; if (!date_mapping) return '';
@@ -130,7 +136,7 @@
function get_grayed_out_text_color_strings(is_selected: boolean): string { function get_grayed_out_text_color_strings(is_selected: boolean): string {
if (not_interactable) return 'text-stone-400'; if (not_interactable) return 'text-stone-400';
if ($loading_data?.is_loading) return 'text-white/20'; if (!!file_transfer_task) return 'text-white/20';
const color = is_selected ? 'text-stone-600' : 'text-stone-400'; const color = is_selected ? 'text-stone-600' : 'text-stone-400';
const factor = is_selected ? -1 : 1; const factor = is_selected ? -1 : 1;
return `${color} group-hover:${get_shifted_color(color, factor * 100)} group-active:${get_shifted_color(color, factor * 150)}`; return `${color} group-hover:${get_shifted_color(color, factor * 100)} group-active:${get_shifted_color(color, factor * 150)}`;
@@ -138,20 +144,20 @@
function get_grayed_out_border_color_strings(is_selected: boolean): string { function get_grayed_out_border_color_strings(is_selected: boolean): string {
if (not_interactable) return 'border-stone-550'; if (not_interactable) return 'border-stone-550';
if ($loading_data?.is_loading) return 'border-white/10'; if (!!file_transfer_task) return 'border-white/10';
const color = is_selected ? 'border-stone-450' : 'border-stone-550'; const color = is_selected ? 'border-stone-450' : 'border-stone-550';
const factor = is_selected ? 1 : 1; const factor = is_selected ? 1 : 1;
return `${color} group-hover:${get_shifted_color(color, factor * 100)} group-active:${get_shifted_color(color, factor * 150)}`; return `${color} group-hover:${get_shifted_color(color, factor * 100)} group-active:${get_shifted_color(color, factor * 150)}`;
} }
function onclick(e: Event) { function onclick(e: Event) {
if (not_interactable || $loading_data?.is_loading) return; if (not_interactable || !!file_transfer_task) return;
select(selected_file_ids, get_file_primary_key(file), 'toggle'); select(selected_file_ids, file_primary_key, 'toggle');
e.stopPropagation(); e.stopPropagation();
} }
async function open() { async function open() {
if (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 { } else {
const path_to_file = $current_file_path + file.name; const path_to_file = $current_file_path + file.name;
@@ -164,11 +170,11 @@
if (loading_finished) { if (loading_finished) {
out += 'bg-stone-500 text-white/30'; out += 'bg-stone-500 text-white/30';
} else if ($loading_data?.is_loading) { } else if (!!file_transfer_task) {
out += 'bg-stone-700 text-white/30'; out += 'bg-stone-700 text-white/30';
} else { } else {
out += get_selectable_color_classes( out += get_selectable_color_classes(
!not_interactable && is_selected(get_file_primary_key(file), $selected_file_ids), !not_interactable && is_selected(file_primary_key, $selected_file_ids),
{ {
bg: true, bg: true,
hover: !not_interactable, hover: !not_interactable,
@@ -180,7 +186,7 @@
if (not_interactable) { if (not_interactable) {
out += ' rounded-lg'; out += ' rounded-lg';
} else if ($loading_data?.is_loading) { } else if (!!file_transfer_task) {
out += ' rounded-r-lg'; out += ' rounded-r-lg';
} else { } else {
out += ' rounded-r-lg cursor-pointer'; out += ' rounded-r-lg cursor-pointer';
@@ -189,55 +195,37 @@
return out; return out;
} }
async function get_loading_data( function get_total_percentage(ftt: FileTransferTask): number {
file_primary_key: string, let total_percentage: number;
selected_display_ids: string[] if (ftt.data.type === 'upload') {
): Promise<CompleteFileLoadingData> { total_percentage = ftt.loading_data.percentage;
const file_on_display_data: FileOnDisplay[] = await db.files_on_display
.where('file_primary_key')
.equals(file_primary_key)
.filter((e) => selected_display_ids.includes(e.display_id))
.toArray();
if (file_on_display_data.length === 0) {
return {
is_loading: true,
total_percentage: 0,
total_seconds_until_finish: -1,
display_data: []
};
}
const display_data = [];
let is_loading = false;
let percentage_sum = 0;
let total_seconds_until_finish = 0;
for (const fod of file_on_display_data) {
if (!!fod.loading_data) {
if (!is_loading) is_loading = true;
percentage_sum += fod.loading_data.percentage;
total_seconds_until_finish += fod.loading_data.seconds_until_finish;
const display = await get_display_by_id(fod.display_id);
if (!display) continue;
const display_data_element = {
loading_data: fod.loading_data,
display_name: display.name
};
if (fod.loading_data.type === 'sync_download') {
display_data.unshift(display_data_element); // insert sync_download element at beginning
} else { } else {
display_data.push(display_data_element); const percentage_array = ftt.data.destination_display_data.map(
(dd) => dd.loading_data.percentage
);
total_percentage =
(ftt.loading_data.percentage + percentage_array.reduce((total, n) => total + n, 0)) /
(1 + percentage_array.length);
} }
return Math.min(total_percentage, 100);
}
async function get_size_recursively(file: Inode): Promise<number> {
if (is_folder(file)) {
const folder_elements = await get_folder_elements(
file.path + file.name + '/',
$selected_display_ids
);
let out: number = 0;
for (const el of folder_elements) {
out += await get_size_recursively(el);
}
return out;
} else { } else {
percentage_sum += 100; return file.size;
} }
} }
let total_percentage = percentage_sum / display_data.length;
return {
is_loading,
total_percentage,
total_seconds_until_finish,
display_data
};
}
</script> </script>
<div <div
@@ -249,28 +237,28 @@
{#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={!is_folder && get_file_type(file) === null} disabled={!file_is_folder && get_file_type(file) === null}
title={!is_folder && get_file_type(file) === null ? 'Dateityp nicht unterstützt' : ''} title={!file_is_folder && get_file_type(file) === null ? 'Dateityp nicht unterstützt' : ''}
className="flex rounded-l-lg rounded-r-none {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={get_selectable_color_classes(
!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={get_selectable_color_classes(
!is_folder, !file_is_folder,
{ {
bg: true bg: true
}, },
50 50
)} )}
active_bg={get_selectable_color_classes( active_bg={get_selectable_color_classes(
!is_folder, !file_is_folder,
{ {
bg: true bg: true
}, },
@@ -281,7 +269,7 @@
e.stopPropagation(); e.stopPropagation();
}} }}
> >
{#if 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 $missing_colliding_displays_ids && $missing_colliding_displays_ids.missing.length !== 0}
<RefreshPlay className="size-full" /> <RefreshPlay className="size-full" />
@@ -302,15 +290,15 @@
{onclick} {onclick}
class="{get_main_classes()} relative transition-colors duration-200 gap-4 flex flex-row justify-between group w-full min-w-0" class="{get_main_classes()} relative transition-colors duration-200 gap-4 flex flex-row justify-between group w-full min-w-0"
> >
{#if $loading_data?.is_loading} {#if !!file_transfer_task}
<div <div
class="absolute pointer-events-none inset-y-0 left-0 transition-[width] duration-200 bg-stone-600 rounded-r-lg" class="absolute pointer-events-none inset-y-0 left-0 transition-[width] duration-400 bg-stone-600 rounded-r-lg"
style={`width: ${Math.min($loading_data.total_percentage, 100)}%;`} style={`width: ${get_total_percentage(file_transfer_task)}%;`}
></div> ></div>
{/if} {/if}
<div class="flex flex-row gap-2 min-w-0 w-full z-10"> <div class="flex flex-row gap-2 min-w-0 w-full z-10">
<div class="aspect-square rounded-md flex justify-center items-center"> <div class="aspect-square rounded-md flex justify-center items-center">
{#if is_folder} {#if file_is_folder}
<Folder class="size-full p-2" /> <Folder class="size-full p-2" />
{:else if $thumbnail_url || null} {:else if $thumbnail_url || null}
<img <img
@@ -327,14 +315,14 @@
{/if} {/if}
</div> </div>
<div class="content-center truncate select-none w-full" title={file.name}> <div class="content-center truncate select-none w-full" title={file.name}>
{file.name.includes('.') && !is_folder && get_file_type(file) {file.name.includes('.') && !file_is_folder && get_file_type(file)
? file.name.slice(0, file.name.lastIndexOf('.')) ? file.name.slice(0, file.name.lastIndexOf('.'))
: file.name} : file.name}
</div> </div>
</div> </div>
<div <div
class=" p-1 flex flex-row items-center gap-1 pr-1 z-10 {get_grayed_out_text_color_strings( class=" p-1 flex flex-row items-center gap-1 pr-1 z-10 {get_grayed_out_text_color_strings(
is_selected(get_file_primary_key(file), $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} <!-- {#if get_display_ids_where_file_is_missing($current_file_path, file, $selected_display_ids, $all_files)[1].length !== 0}
@@ -372,25 +360,25 @@
</div> </div>
<div <div
class="h-[70%] border {get_grayed_out_border_color_strings( class="h-[70%] border {get_grayed_out_border_color_strings(
is_selected(get_file_primary_key(file), $selected_file_ids) is_selected(file_primary_key, $selected_file_ids)
)} duration-200 transition-colors my-1" )} duration-200 transition-colors my-1"
></div> ></div>
<div <div
class="w-12 content-center text-center select-none text-xs whitespace-nowrap truncate" class="w-12 content-center text-center select-none text-xs whitespace-nowrap truncate"
title={file.type} title={file.type}
> >
{is_folder ? 'Ordner' : (get_file_type(file)?.display_name ?? '?')} {file_is_folder ? 'Ordner' : (get_file_type(file)?.display_name ?? '?')}
</div> </div>
<div <div
class="h-[70%] border {get_grayed_out_border_color_strings( class="h-[70%] border {get_grayed_out_border_color_strings(
is_selected(get_file_primary_key(file), $selected_file_ids) is_selected(file_primary_key, $selected_file_ids)
)} duration-200 transition-colors" )} duration-200 transition-colors"
></div> ></div>
<div <div
class="w-12 content-center text-center select-none text-xs whitespace-nowrap" class="w-12 content-center text-center select-none text-xs whitespace-nowrap"
title={get_file_size_display_string(file.size, 3)} title={get_file_size_display_string($file_size ?? -1, 3)}
> >
{get_file_size_display_string(file.size)} {get_file_size_display_string($file_size ?? -1)}
</div> </div>
</div> </div>
</div> </div>
@@ -18,7 +18,7 @@
} = $props(); } = $props();
function try_to_close() { function try_to_close() {
if (!content.closable || !content.open) return; if (!content.open) return;
close_function(); close_function();
} }
@@ -35,19 +35,13 @@
</script> </script>
{#if content.open} {#if content.open}
<!-- svelte-ignore a11y_no_static_element_interactions -->
<!-- svelte-ignore a11y_click_events_have_key_events -->
<div <div
class="absolute inset-0 backdrop-blur flex justify-center items-center z-50 {className}" class="absolute inset-0 backdrop-blur flex justify-center items-center z-50 {className}"
onclick={try_to_close}
transition:fade={{ duration: 100 }} transition:fade={{ duration: 100 }}
> >
<!-- svelte-ignore a11y_no_static_element_interactions -->
<!-- svelte-ignore a11y_click_events_have_key_events -->
<div <div
class="bg-stone-800 rounded-2xl min-w-[30%] max-w-[90%] max-h-[85%] flex flex-col shadow-2xl/60 overflow-hidden {content.window_class ?? class="bg-stone-800 rounded-2xl min-w-[30%] max-w-[90%] max-h-[85%] flex flex-col shadow-2xl/60 overflow-hidden {content.window_class ??
''}" ''}"
onclick={(e) => e.stopPropagation()}
> >
{#if content.title} {#if content.title}
<div class="font-bold bg-stone-700 p-1.5 flex flex-row justify-between gap-8 w-full"> <div class="font-bold bg-stone-700 p-1.5 flex flex-row justify-between gap-8 w-full">
@@ -64,16 +58,16 @@
</div> </div>
</div> </div>
<div class="flex aspect-square shrink-0"> <div class="flex aspect-square shrink-0">
{#if content.closable}
<Button className="aspect-square p-1.5!" click_function={try_to_close}> <Button className="aspect-square p-1.5!" click_function={try_to_close}>
<X /> <X />
</Button> </Button>
{/if}
</div> </div>
</div> </div>
{/if} {/if}
<div class="p-2 min-h-0 overflow-auto flex flex-col gap-2 {snippet_container_class}"> <div class="p-2 min-h-0 overflow-auto flex flex-col gap-2 {snippet_container_class}">
{@render content.snippet(content.snippet_arg)} {#if content.snippet}
{@render content.snippet(content.snippet_arg ?? '')}
{/if}
</div> </div>
</div> </div>
</div> </div>
@@ -30,7 +30,7 @@
enter_function?: (() => void) | null; enter_function?: (() => void) | null;
} = $props(); } = $props();
let focus_bg = get_shifted_color(bg, 100); let focus_bg = $derived(get_shifted_color(bg, 100));
let focused: boolean = $state(false); let focused: boolean = $state(false);
let current_info = $state(''); let current_info = $state('');
let input_element: HTMLInputElement; let input_element: HTMLInputElement;
+29 -2
View File
@@ -1,5 +1,6 @@
import { notifications } from './stores/notification'; import { notifications } from './stores/notification';
import { import {
is_folder,
to_display_status, to_display_status,
type DisplayStatus, type DisplayStatus,
type Inode, type Inode,
@@ -9,6 +10,9 @@ import {
} from './types'; } from './types';
import { dev } from '$app/environment'; import { dev } from '$app/environment';
import { get_sanitized_file_url } from './utils'; import { get_sanitized_file_url } from './utils';
import { online_displays } from './stores/displays';
import { get } from 'svelte/store';
import { update_display_status } from './main';
export async function get_screenshot(ip: string): Promise<Blob | null> { export async function get_screenshot(ip: string): Promise<Blob | null> {
const options = { method: 'PATCH' }; const options = { method: 'PATCH' };
@@ -47,6 +51,11 @@ export async function show_html(ip: string, html: string): Promise<void> {
await request_display(ip, '/showHTML', options); await request_display(ip, '/showHTML', options);
} }
export async function show_website(ip: string, url: string): Promise<void> {
const command = `screen -dmS custom_website chromium-browser --user-data-dir=$(mktemp -d) --start-fullscreen --app="${url}"`;
await run_shell_command(ip, command);
}
export async function get_file_data( export async function get_file_data(
ip: string, ip: string,
path: string path: string
@@ -92,6 +101,7 @@ export async function get_file_data(
size: Number(response_element.size), size: Number(response_element.size),
thumbnail: null thumbnail: null
}; };
if (is_folder(folder_element)) folder_element.size = 0;
folder_element_list.push({ folder_element, date_created: new Date(response_element.created) }); folder_element_list.push({ folder_element, date_created: new Date(response_element.created) });
} }
return folder_element_list; return folder_element_list;
@@ -188,14 +198,30 @@ async function request_display(
supress_error_handling_http_codes: number[] = [] supress_error_handling_http_codes: number[] = []
): Promise<RequestResponse> { ): Promise<RequestResponse> {
const url = `http://${ip}:1323/api${api_route}`; const url = `http://${ip}:1323/api${api_route}`;
return await request(url, options, supress_error_handling_http_codes);
const current_online_displays = get(online_displays);
if (!current_online_displays.map((d) => d.ip).includes(ip)) return { ok: false };
const response = await request(url, options, supress_error_handling_http_codes);
if (!response.ok && response.http_code === 408) {
// Network error -> device possibly not longer online -> test status and throw no error if its offline
const possible_displays = current_online_displays.filter((d) => d.ip === ip);
for (const display of possible_displays) {
const current_status = await update_display_status(display);
if (current_status === 'app_online') {
console.error(`No response from ${url}`);
notifications.push('error', 'Netzwerk-Fehler bei API-Anfrage', `${url}`);
}
}
}
return response;
} }
async function request_control( async function request_control(
api_route: string, api_route: string,
options: { method: string; headers?: Record<string, string>; body?: string } options: { method: string; headers?: Record<string, string>; body?: string }
): Promise<RequestResponse> { ): Promise<RequestResponse> {
const url = `http://127.0.0.1:8080/api${api_route}`; const url = `${dev ? 'http://127.0.0.1:8080' : window.location.origin}/api${api_route}`;
return await request(url, options); return await request(url, options);
} }
@@ -245,6 +271,7 @@ async function request(
if (dev) { if (dev) {
console.warn('Request failed - Is the targeted device online?'); console.warn('Request failed - Is the targeted device online?');
} }
return { ok: false, http_code: 408 };
} else { } else {
console.error(url, error); console.error(url, error);
notifications.push('error', `Fataler Fehler bei API-Anfrage`, `${url}\nFehler: ${error}`); notifications.push('error', `Fataler Fehler bei API-Anfrage`, `${url}\nFehler: ${error}`);
+1 -2
View File
@@ -23,8 +23,7 @@ export class FileDatabase extends Dexie {
[display_id+file_primary_key], [display_id+file_primary_key],
display_id, display_id,
file_primary_key, file_primary_key,
date_created, date_created
loading_data
`, `,
displays: ` displays: `
id, id,
@@ -1,3 +1,4 @@
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 } from './stores/displays';
import { import {
@@ -11,6 +12,7 @@ import { notifications } from './stores/notification';
import { generate_thumbnail } from './stores/thumbnails'; import { generate_thumbnail } from './stores/thumbnails';
import { import {
get_file_primary_key, get_file_primary_key,
is_folder,
type FileLoadingData, type FileLoadingData,
type FileOnDisplay, type FileOnDisplay,
type FileTransferTask, type FileTransferTask,
@@ -19,8 +21,17 @@ import {
} 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';
const START_LOADING_DATA = {
percentage: 0,
bytes_per_second: 0,
seconds_until_finish: -1
};
export const file_transfer_tasks: Writable<Record<string, FileTransferTask>> = writable<
Record<string, FileTransferTask>
>({});
let is_processing: boolean = false; let is_processing: boolean = false;
const tasks: FileTransferTask[] = [];
export async function add_upload( export async function add_upload(
file_list: FileList, file_list: FileList,
@@ -28,7 +39,6 @@ export async function add_upload(
current_file_path: string current_file_path: string
) { ) {
if (file_list.length === 0) return console.warn('Upload canceled: no selected files'); if (file_list.length === 0) return console.warn('Upload canceled: no selected files');
await create_path_on_all_selected_displays(current_file_path, selected_display_ids); await create_path_on_all_selected_displays(current_file_path, selected_display_ids);
const used_file_names: string[] = await ( const used_file_names: string[] = await (
@@ -47,6 +57,10 @@ export async function add_upload(
thumbnail: null thumbnail: null
}; };
const file_primary_key = get_file_primary_key(db_file); const file_primary_key = get_file_primary_key(db_file);
if (Object.prototype.hasOwnProperty.call(file_transfer_tasks, file_primary_key))
return show_already_in_tasks_error(db_file, 'upload'); // file is already in task
await db.files.put(db_file); await db.files.put(db_file);
const upload_task_promises = selected_display_ids.map(async (display_id) => { const upload_task_promises = selected_display_ids.map(async (display_id) => {
@@ -56,17 +70,11 @@ export async function add_upload(
const db_file_on_display: FileOnDisplay = { const db_file_on_display: FileOnDisplay = {
display_id, display_id,
file_primary_key, file_primary_key,
date_created: new Date(), date_created: new Date()
loading_data: {
type: 'upload',
percentage: 0,
bytes_per_second: 0,
seconds_until_finish: -1
}
}; };
await db.files_on_display.put(db_file_on_display); await db.files_on_display.put(db_file_on_display);
return { const new_task = {
data: { data: {
type: 'upload' as const, type: 'upload' as const,
file file
@@ -77,13 +85,16 @@ export async function add_upload(
}, },
path: current_file_path, path: current_file_path,
file_name: file_name, file_name: file_name,
file_primary_key, loading_data: START_LOADING_DATA,
bytes_total: file.size bytes_total: file.size
}; };
file_transfer_tasks.update((tasks) => ({
...tasks,
[file_primary_key]: new_task
}));
}); });
const upload_tasks = (await Promise.all(upload_task_promises)).filter((e) => !!e); await Promise.all(upload_task_promises);
tasks.push(...upload_tasks);
} }
await start_task_processing(); await start_task_processing();
@@ -99,7 +110,7 @@ export async function add_sync_recursively(
); );
if (!file_data) return console.warn('Sync canceled: no file_data'); if (!file_data) return console.warn('Sync canceled: no file_data');
if (file_data.file.type === 'inode/directory') { if (is_folder(file_data.file)) {
const new_path = file_data.file.path + file_data.file.name + '/'; const new_path = file_data.file.path + file_data.file.name + '/';
const elements_in_folder = await get_folder_elements(new_path, selected_display_ids); const elements_in_folder = await get_folder_elements(new_path, selected_display_ids);
if (elements_in_folder.length === 0) { if (elements_in_folder.length === 0) {
@@ -113,42 +124,36 @@ export async function add_sync_recursively(
} }
if (file_data.short_displays_without_file.length === 0) return; // file is present on all selected displays if (file_data.short_displays_without_file.length === 0) return; // file is present on all selected displays
if (Object.prototype.hasOwnProperty.call(file_transfer_tasks, selected_file_id))
return show_already_in_tasks_error(file_data.file, 'sync'); // file is already in task
await create_path_on_all_selected_displays(file_data.file.path, selected_display_ids); await create_path_on_all_selected_displays(file_data.file.path, selected_display_ids);
tasks.push({ const new_task: FileTransferTask = {
data: { data: {
type: 'sync', type: 'sync',
destination_displays: file_data.short_displays_without_file destination_display_data: file_data.short_displays_without_file.map((display) => ({
display,
loading_data: START_LOADING_DATA
}))
}, },
display: file_data.short_display_with_file, display: file_data.short_display_with_file,
path: file_data.file.path, path: file_data.file.path,
file_name: file_data.file.name, file_name: file_data.file.name,
file_primary_key: selected_file_id, loading_data: START_LOADING_DATA,
bytes_total: file_data.file.size bytes_total: file_data.file.size
});
await db.files_on_display.update([file_data.short_display_with_file.id, selected_file_id], {
loading_data: {
type: 'sync_download',
percentage: 0,
bytes_per_second: 0,
seconds_until_finish: -1
}
});
const display_ids_without_file = file_data.short_displays_without_file.map((d) => d.id);
const new_file_loading_data: FileLoadingData = {
type: 'sync_upload',
percentage: 0,
bytes_per_second: 0,
seconds_until_finish: -1
}; };
file_transfer_tasks.update((tasks) => ({
...tasks,
[selected_file_id]: new_task
}));
const display_ids_without_file = file_data.short_displays_without_file.map((d) => d.id);
const new_fods: FileOnDisplay[] = display_ids_without_file.map((display_id) => ({ const new_fods: FileOnDisplay[] = display_ids_without_file.map((display_id) => ({
display_id, display_id,
file_primary_key: selected_file_id, file_primary_key: selected_file_id,
date_created: new Date(), date_created: new Date()
loading_data: new_file_loading_data
})); }));
console.log("TEST", new_fods)
await db.files_on_display.bulkPut(new_fods); await db.files_on_display.bulkPut(new_fods);
await start_task_processing(); await start_task_processing();
@@ -222,15 +227,15 @@ function generate_valid_file_name(original_file_name: string, used_file_names: s
return name; return name;
} }
async function upload(task: FileTransferTask): Promise<void> { async function upload(file_primary_key: string, task: FileTransferTask): Promise<void> {
const task_data = task.data; const task_data = task.data;
if (task_data.type !== 'upload' || !task_data.file) if (task_data.type !== 'upload' || !task_data.file)
return console.warn('Task cancelled: wrong task type:', task); return console.warn('Task cancelled: wrong task type:', task);
await upload_file_via_xhr(task, task.display, task_data.file); await upload_file_via_xhr(file_primary_key, task, task_data.file);
} }
export async function sync(task: FileTransferTask) { export async function sync(file_primary_key: string, task: FileTransferTask) {
if (task.data.type !== 'sync') return console.warn('Task cancelled: wrong task type:', task); if (task.data.type !== 'sync') return console.warn('Task cancelled: wrong task type:', task);
const hasOPFS = const hasOPFS =
@@ -238,7 +243,8 @@ export async function sync(task: FileTransferTask) {
'storage' in navigator && 'storage' in navigator &&
'getDirectory' in navigator.storage; 'getDirectory' in navigator.storage;
if (!hasOPFS) { if (!hasOPFS) {
return show_error( return show_general_error(
file_primary_key,
task, task,
'OPFS (navigator.storage.getDirectory) nicht verfügbar bitte Chromium/Edge/Chrome nutzen.' 'OPFS (navigator.storage.getDirectory) nicht verfügbar bitte Chromium/Edge/Chrome nutzen.'
); );
@@ -251,7 +257,7 @@ export async function sync(task: FileTransferTask) {
const url = `http://${task.display.ip}:1323/api${get_sanitized_file_url(task.path + task.file_name)}`; const url = `http://${task.display.ip}:1323/api${get_sanitized_file_url(task.path + task.file_name)}`;
const fetch_source = await fetch(url, { method: 'GET' }); const fetch_source = await fetch(url, { method: 'GET' });
if (!fetch_source.ok || !fetch_source.body) if (!fetch_source.ok || !fetch_source.body)
return show_error(task, `HTTP ${fetch_source.status}`); return show_general_error(file_primary_key, task, `HTTP ${fetch_source.status}`);
const dir = await navigator.storage.getDirectory(); const dir = await navigator.storage.getDirectory();
const file_handle = await dir.getFileHandle(temp_name, { create: true }); const file_handle = await dir.getFileHandle(temp_name, { create: true });
@@ -264,25 +270,23 @@ export async function sync(task: FileTransferTask) {
if (done) break; if (done) break;
if (!value) continue; if (!value) continue;
await update_current_loading_data('sync_download', task, value.byteLength, start_time); update_current_loading_data(file_primary_key, value.byteLength, start_time);
await writable.write(value); await writable.write(value);
} }
await writable.close(); await writable.close();
await db.files_on_display.update([task.display.id, task.file_primary_key], { finish_loading_data(file_primary_key);
loading_data: null
});
// 02 - send downloaded file to every destination_display // 02 - send downloaded file to every destination_display
const temp_file = await file_handle.getFile(); const temp_file = await file_handle.getFile();
for (const current_short_display of task.data.destination_displays) { for (const current_short_display of task.data.destination_display_data) {
await upload_file_via_xhr(task, current_short_display, temp_file); await upload_file_via_xhr(file_primary_key, task, temp_file, current_short_display.display);
} }
await dir.removeEntry(temp_name); await dir.removeEntry(temp_name);
} catch (e) { } catch (e) {
show_error(task, String(e)); show_general_error(file_primary_key, task, String(e));
} }
} }
@@ -291,7 +295,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 || file_data.file.type === 'inode/directory') if (!file_data || is_folder(file_data.file))
return console.warn('Download cancelled: is folder'); return console.warn('Download cancelled: is folder');
try { try {
@@ -315,56 +319,62 @@ export async function download_file(selected_file_id: string, selected_display_i
async function start_task_processing() { async function start_task_processing() {
if (!is_processing) { if (!is_processing) {
is_processing = tasks.length !== 0; is_processing = Object.keys(get(file_transfer_tasks)).length !== 0;
await start_task_loop(); await start_task_loop();
} }
} }
async function start_task_loop() { async function start_task_loop() {
while (tasks.length > 0) { while (Object.keys(get(file_transfer_tasks)).length > 0) {
const current_task = tasks[0]; const tasks = get(file_transfer_tasks);
const current_file_id = Object.keys(tasks)[0];
const current_task = tasks[current_file_id];
if (current_task.data.type === 'upload') { if (current_task.data.type === 'upload') {
await upload(current_task); await upload(current_file_id, current_task);
} else if (current_task.data.type === 'sync') { } else if (current_task.data.type === 'sync') {
await sync(current_task); await sync(current_file_id, current_task);
} }
tasks.shift(); // Remove current_task from tasks
file_transfer_tasks.update((all_tasks) => {
const next = { ...all_tasks };
delete next[current_file_id];
return next;
});
} }
is_processing = false; is_processing = false;
} }
async function upload_file_via_xhr( async function upload_file_via_xhr(
file_primary_key: string,
task: FileTransferTask, task: FileTransferTask,
current_short_display: ShortDisplay, current_file: File,
current_file: File destination_short_display: ShortDisplay | null = null
) { ) {
const start_time = new Date(); const start_time = new Date();
const loading_type = task.data.type === 'upload' ? 'upload' : 'sync_upload';
return new Promise<void>((resolve) => { return new Promise<void>((resolve) => {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.open( xhr.open(
'POST', 'POST',
`http://${current_short_display.ip}:1323/api${get_sanitized_file_url(task.path + task.file_name)}`, `http://${destination_short_display ? destination_short_display.ip : task.display.ip}:1323/api${get_sanitized_file_url(task.path + task.file_name)}`,
true true
); );
xhr.setRequestHeader('content-type', 'application/octet-stream'); xhr.setRequestHeader('content-type', 'application/octet-stream');
xhr.upload.onprogress = (e) => { xhr.upload.onprogress = (e) => {
const apply = async () => { const apply = async () => {
await update_current_loading_data( update_current_loading_data(
loading_type, file_primary_key,
task,
e.loaded, e.loaded,
start_time, start_time,
current_short_display.id destination_short_display ? destination_short_display.id : null
); );
}; };
apply(); apply();
}; };
xhr.onerror = async (e: ProgressEvent) => { xhr.onerror = async (e: ProgressEvent) => {
await show_error(task, e); await show_general_error(file_primary_key, task, e);
resolve(); resolve();
}; };
@@ -372,21 +382,21 @@ async function upload_file_via_xhr(
if (xhr.readyState === 4) { if (xhr.readyState === 4) {
if (xhr.status == 200) { if (xhr.status == 200) {
// set loading_data to 100% // set loading_data to 100%
await db.files_on_display.update([current_short_display.id, task.file_primary_key], { finish_loading_data(
date_created: new Date(), file_primary_key,
loading_data: null destination_short_display ? destination_short_display.id : null
}); );
// Generate Thumbnail if not done already // Generate Thumbnail if not done already
setTimeout(async () => { setTimeout(async () => {
const inode_element: Inode | undefined = await db.files.get( const inode_element: Inode | undefined = await db.files.get(
JSON.parse(task.file_primary_key) as [string, string, number, string] JSON.parse(file_primary_key) as [string, string, number, string]
); );
if (!!inode_element && inode_element.thumbnail === null) { if (!!inode_element && inode_element.thumbnail === null) {
await generate_thumbnail(task.display.ip, task.path, inode_element); await generate_thumbnail(task.display.ip, task.path, inode_element);
} }
}, 10); }, 10);
} else { } else {
await show_error(task, `HTTP ${xhr.status}`); await show_general_error(file_primary_key, task, `HTTP ${xhr.status}`);
} }
resolve(); resolve();
} }
@@ -396,30 +406,74 @@ async function upload_file_via_xhr(
}); });
} }
async function update_current_loading_data( function finish_loading_data(
type: FileLoadingData['type'], file_primary_key: string,
task: FileTransferTask, destination_display_id: string | null = null
) {
file_transfer_tasks.update((tasks) => {
const task = tasks[file_primary_key];
const current_loading_data = {
percentage: 100,
bytes_per_second: 0,
seconds_until_finish: 0
};
return {
...tasks,
[file_primary_key]: get_updated_task(current_loading_data, destination_display_id, task)
};
});
}
function update_current_loading_data(
file_primary_key: string,
current_bytes: number, current_bytes: number,
start_time: Date, start_time: Date,
other_display_id: string | null = null destination_display_id: string | null = null
) { ) {
file_transfer_tasks.update((tasks) => {
const task = tasks[file_primary_key];
if (!task) return tasks;
const current_percentage = Math.min( const current_percentage = Math.min(
task.bytes_total > 0 ? Math.round((current_bytes / task.bytes_total) * 100) : 1, task.bytes_total > 0 ? Math.round((current_bytes / task.bytes_total) * 100) : 1,
99 99
); // calculate percantage, but maximum value is 99% );
const prognosed_data = get_prognosed_data(start_time, current_bytes, task.bytes_total); const prognosed_data = get_prognosed_data(start_time, current_bytes, task.bytes_total);
await db.files_on_display.update( const current_loading_data: FileLoadingData = {
[other_display_id ? other_display_id : task.display.id, task.file_primary_key],
{
loading_data: {
type,
percentage: current_percentage, percentage: current_percentage,
bytes_per_second: prognosed_data.bytes_per_second, bytes_per_second: prognosed_data.bytes_per_second,
seconds_until_finish: prognosed_data.seconds_until_finish seconds_until_finish: prognosed_data.seconds_until_finish
} };
}
return {
...tasks,
[file_primary_key]: get_updated_task(current_loading_data, destination_display_id, task)
};
});
}
function get_updated_task(current_loading_data: FileLoadingData, destination_display_id: string | null, task: FileTransferTask): FileTransferTask {
if (destination_display_id && task.data.type === 'sync') {
const updatedDestinations = task.data.destination_display_data.map((dd) =>
dd.display.id === destination_display_id ? { ...dd, loading_data: current_loading_data } : dd
); );
return {
...task,
data: {
...task.data,
destination_display_data: updatedDestinations
}
};
} else {
return {
...task,
loading_data: current_loading_data
};
}
} }
function get_prognosed_data( function get_prognosed_data(
@@ -434,7 +488,11 @@ function get_prognosed_data(
return { bytes_per_second, seconds_until_finish }; return { bytes_per_second, seconds_until_finish };
} }
async function show_error(task: FileTransferTask, error: ProgressEvent | string) { async function show_general_error(
file_primary_key: string,
task: FileTransferTask,
error: ProgressEvent | string
) {
const task_data = task.data; const task_data = task.data;
console.error('Error in File-Transfer-Handler:', error, task); console.error('Error in File-Transfer-Handler:', error, task);
notifications.push( notifications.push(
@@ -443,12 +501,20 @@ async function show_error(task: FileTransferTask, error: ProgressEvent | string)
`Datei: "${task.file_name}", Display-IP: ${task.display.ip}\nFehler: ${error}` `Datei: "${task.file_name}", Display-IP: ${task.display.ip}\nFehler: ${error}`
); );
if (task_data.type === 'upload') { if (task_data.type === 'upload') {
await remove_file_from_display_recusively(task.display.id, task.file_primary_key); await remove_file_from_display_recusively(task.display.id, file_primary_key);
await remove_all_files_without_display(); await remove_all_files_without_display();
} else if (task_data.type === 'sync') { } else if (task_data.type === 'sync') {
for (const display_id of task_data.destination_displays.map((e) => e.id)) { for (const display_id of task_data.destination_display_data.map((e) => e.display.id)) {
await remove_file_from_display_recusively(display_id, task.file_primary_key); await remove_file_from_display_recusively(display_id, file_primary_key);
} }
await remove_all_files_without_display(); await remove_all_files_without_display();
} }
} }
function show_already_in_tasks_error(file: Inode, process: 'upload' | 'sync') {
notifications.push(
'error',
`Datei '${file.name}' konnte nicht ${process === 'upload' ? 'hochgeladen' : 'synchronisiert'} werden`,
`Eine Datei kann nicht in mehreren file_transfer_tasks enthalten sein. Bitte erneut versuchen, wenn die aktuellen Aktionen fertiggestellt wurden`
);
}
+8 -4
View File
@@ -1,6 +1,6 @@
import { screenshot_loop } from './stores/displays'; import { screenshot_loop } from './stores/displays';
import { ping_ip } from './api_handler'; import { ping_ip } from './api_handler';
import type { Display } from './types'; import type { Display, DisplayStatus } from './types';
import { update_folder_elements_recursively } from './stores/files'; import { update_folder_elements_recursively } from './stores/files';
import { db } from './database'; import { db } from './database';
@@ -12,6 +12,9 @@ const loading_display_ids: string[] = [];
export async function on_app_start() { export async function on_app_start() {
await db.files.clear(); await db.files.clear();
await db.files_on_display.clear(); await db.files_on_display.clear();
await db.displays
.toCollection()
.modify({ status: null, preview: { currently_updating: false, url: null } });
await update_all_display_status(false); await update_all_display_status(false);
await setInterval( await setInterval(
() => update_all_display_status(false), () => update_all_display_status(false),
@@ -36,9 +39,9 @@ async function update_all_display_status(only_loading_displays: boolean) {
} }
} }
export async function update_display_status(display: Display) { export async function update_display_status(display: Display): Promise<DisplayStatus> {
const new_status = await ping_ip(display.ip); const new_status = await ping_ip(display.ip);
if (new_status === null && display.status !== null) return; if (new_status === null && display.status !== null) return null;
if (new_status !== display.status) { if (new_status !== display.status) {
// status change // status change
if (new_status === 'app_offline') { if (new_status === 'app_offline') {
@@ -52,6 +55,7 @@ export async function update_display_status(display: Display) {
display.status = new_status; display.status = new_status;
await db.displays.put(display); // save await db.displays.put(display); // save
} }
return new_status;
} }
export function remove_display_from_loading_displays(display_id: string) { export function remove_display_from_loading_displays(display_id: string) {
@@ -63,5 +67,5 @@ export function remove_display_from_loading_displays(display_id: string) {
async function on_display_start(display: Display) { async function on_display_start(display: Display) {
await update_folder_elements_recursively(display, '/'); await update_folder_elements_recursively(display, '/');
await screenshot_loop(display.id); screenshot_loop(display.id);
} }
+42 -5
View File
@@ -14,6 +14,15 @@ import { db } from '../database';
import { dev } from '$app/environment'; import { dev } from '$app/environment';
import { remove_display_from_loading_displays } from '../main'; import { remove_display_from_loading_displays } from '../main';
import { preview_settings } from './ui_behavior'; import { preview_settings } from './ui_behavior';
import { liveQuery } from 'dexie';
export const online_displays: Writable<Display[]> = writable<Display[]>([]);
export const online_displays_sub = liveQuery(() =>
db.displays.where('status').equals('app_online').toArray()
).subscribe((value) => {
online_displays.set(value);
});
export const local_displays: Writable<DisplayIdGroup[]> = writable<DisplayIdGroup[]>([]); export const local_displays: Writable<DisplayIdGroup[]> = writable<DisplayIdGroup[]>([]);
@@ -62,8 +71,15 @@ export async function edit_display_data(
): Promise<Display | null> { ): Promise<Display | null> {
let display = await db.displays.get(display_id); let display = await db.displays.get(display_id);
if (!display) return null; if (!display) return null;
display = { ...display, ip: ip, mac: mac, name: name }; display = {
...display,
ip: ip,
mac: mac,
name,
preview: { currently_updating: false, url: null }
};
await db.displays.put(display); // save await db.displays.put(display); // save
screenshot_loop(display.id);
return display; return display;
} }
@@ -118,8 +134,9 @@ export async function get_display_by_id(display_id: string): Promise<Display | n
return (await db.displays.get(display_id)) ?? null; return (await db.displays.get(display_id)) ?? null;
} }
export async function screenshot_loop(display_id: string) { export function screenshot_loop(display_id: string) {
const settings = get(preview_settings); setTimeout(async () => {
let settings = get(preview_settings);
if (settings.mode === 'never') return; if (settings.mode === 'never') return;
const initial_retry_count = settings.retry_count.now; const initial_retry_count = settings.retry_count.now;
@@ -135,9 +152,14 @@ export async function screenshot_loop(display_id: string) {
let retry_count = initial_retry_count; let retry_count = initial_retry_count;
while (retry_count > 0) { while (retry_count > 0) {
settings = get(preview_settings);
if (settings.mode === 'never') break;
if (settings.mode !== 'always') retry_count -= 1; if (settings.mode !== 'always') retry_count -= 1;
const new_blob = await get_screenshot(display.ip); const new_blob = await get_screenshot(display.ip);
settings = get(preview_settings);
if (settings.mode === 'never') break;
if (!new_blob) { if (!new_blob) {
display.preview = { currently_updating: false, url: null }; display.preview = { currently_updating: false, url: null };
await db.displays.update(display.id, { preview: display.preview }); await db.displays.update(display.id, { preview: display.preview });
@@ -159,8 +181,13 @@ export async function screenshot_loop(display_id: string) {
await new Promise((resolve) => setTimeout(resolve, retry_seconds * 1000)); // sleep await new Promise((resolve) => setTimeout(resolve, retry_seconds * 1000)); // sleep
} }
if (settings.mode === 'never') {
await db.displays.update(display.id, { preview: { currently_updating: false, url: null } });
} else {
display.preview.currently_updating = false; display.preview.currently_updating = false;
await db.displays.update(display.id, { preview: display.preview }); await db.displays.update(display.id, { preview: display.preview });
}
}, 0);
} }
export async function run_on_all_selected_displays( export async function run_on_all_selected_displays(
@@ -179,7 +206,7 @@ export async function run_on_all_selected_displays(
if (!display || (ignore_offline && display.status === 'host_offline')) return; if (!display || (ignore_offline && display.status === 'host_offline')) return;
await run_function(display); await run_function(display);
if (update_screenshot_afterwards) { if (update_screenshot_afterwards) {
await screenshot_loop(display.id); screenshot_loop(display.id);
} }
}) })
); );
@@ -204,7 +231,7 @@ export async function update_local_displays() {
export async function update_db_displays() { export async function update_db_displays() {
local_displays.update((groups) => groups.filter((g) => g.displays.length !== 0)); local_displays.update((groups) => groups.filter((g) => g.displays.length !== 0));
const filtered_local_display_groups = get(local_displays) const filtered_local_display_groups = get(local_displays);
const db_display_group_ids = (await db.display_groups.toArray()).map((group) => group.id); const db_display_group_ids = (await db.display_groups.toArray()).map((group) => group.id);
const local_display_group_ids = filtered_local_display_groups.map((group) => group.id); const local_display_group_ids = filtered_local_display_groups.map((group) => group.id);
@@ -242,6 +269,16 @@ 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);
async function add_testing_displays() { async function add_testing_displays() {
+28 -30
View File
@@ -1,6 +1,7 @@
import { get, writable, type Writable } from 'svelte/store'; import { get, writable, type Writable } from 'svelte/store';
import { import {
get_file_primary_key, get_file_primary_key,
is_folder,
type Display, type Display,
type FileOnDisplay, type FileOnDisplay,
type Inode, type Inode,
@@ -11,6 +12,7 @@ import { is_selected, select, selected_display_ids, selected_file_ids } from './
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';
import { db } from '../database'; import { db } from '../database';
import { file_transfer_tasks } from '../file_transfer_handler';
export const current_file_path: Writable<string> = writable<string>('/'); export const current_file_path: Writable<string> = writable<string>('/');
@@ -58,7 +60,7 @@ export async function remove_file_from_display_recusively(
const inode_element = await get_file_by_id(found.file_primary_key); const inode_element = await get_file_by_id(found.file_primary_key);
if (!inode_element) return; if (!inode_element) return;
if (inode_element.type === 'inode/directory') { if (is_folder(inode_element)) {
const path_inside_folder = inode_element.path + inode_element.name + `/`; const path_inside_folder = inode_element.path + inode_element.name + `/`;
const primary_file_keys_in_folder = ( const primary_file_keys_in_folder = (
await db.files.where('path').equals(path_inside_folder).toArray() await db.files.where('path').equals(path_inside_folder).toArray()
@@ -148,7 +150,7 @@ export async function get_displays_where_path_not_exists(
const folders_of_current_path = await db.files const folders_of_current_path = await db.files
.where('name') .where('name')
.equals(last_path_part) .equals(last_path_part)
.filter((inode) => inode.path === path_without_last_part && inode.type === 'inode/directory') .filter((inode) => inode.path === path_without_last_part && is_folder(inode))
.first(); .first();
if (!folders_of_current_path) return []; if (!folders_of_current_path) return [];
const folder_primary_key = get_file_primary_key(folders_of_current_path); const folder_primary_key = get_file_primary_key(folders_of_current_path);
@@ -231,9 +233,20 @@ export async function update_folder_elements_recursively(
const new_folder_elements = await get_file_data(display.ip, file_path); const new_folder_elements = await get_file_data(display.ip, file_path);
if (!new_folder_elements) return; if (!new_folder_elements) return;
const loading_file_ids = Object.keys(get(file_transfer_tasks));
const loading_file_keys_without_size = (
await db.files.bulkGet(
loading_file_ids.map((string_id) => JSON.parse(string_id) as [string, string, number, string])
)
)
.filter((f) => !!f)
.map((f) => JSON.stringify([f.path, f.name, f.type]));
// Filter new files, which aren't currently uploading
const existing_files_on_display_in_path: FileOnDisplay[] = await db.files_on_display const existing_files_on_display_in_path: FileOnDisplay[] = await db.files_on_display
.where('display_id') .where('display_id')
.equals(display.id) .equals(display.id)
.filter((f) => !loading_file_ids.includes(f.file_primary_key))
.toArray(); .toArray();
const existing_file_keys_on_display_in_path: [string, string, number, string][] = const existing_file_keys_on_display_in_path: [string, string, number, string][] =
existing_files_on_display_in_path.map( existing_files_on_display_in_path.map(
@@ -245,17 +258,14 @@ export async function update_folder_elements_recursively(
.filter((e) => e.path === file_path) .filter((e) => e.path === file_path)
.toArray(); .toArray();
const existing_files_with_loading_state: { folder_element: Inode; is_loading: boolean }[] = const diff = get_folder_elements_difference(existing_files, new_folder_elements);
existing_files.map((folder_element) => ({
folder_element,
is_loading: !!existing_files_on_display_in_path.find(
(e) => e.file_primary_key === get_file_primary_key(folder_element)
)?.loading_data
}));
const diff = get_folder_elements_difference( // Filter new files, which aren't currently uploading -> don't compare size
existing_files_with_loading_state, diff.new = diff.new.filter(
new_folder_elements (e) =>
!loading_file_keys_without_size.includes(
JSON.stringify([e.folder_element.path, e.folder_element.name, e.folder_element.type])
)
); );
if (diff.new.length > 0) { if (diff.new.length > 0) {
@@ -265,12 +275,11 @@ export async function update_folder_elements_recursively(
const file_on_display: FileOnDisplay = { const file_on_display: FileOnDisplay = {
display_id: display.id, display_id: display.id,
file_primary_key: get_file_primary_key(new_element.folder_element), file_primary_key: get_file_primary_key(new_element.folder_element),
loading_data: null,
date_created: new_element.date_created date_created: new_element.date_created
}; };
await db.files_on_display.put(file_on_display); await db.files_on_display.put(file_on_display);
if (new_element.folder_element.type === 'inode/directory') { if (is_folder(new_element.folder_element)) {
await update_folder_elements_recursively( await update_folder_elements_recursively(
display, display,
file_path + new_element.folder_element.name + '/' file_path + new_element.folder_element.name + '/'
@@ -295,15 +304,13 @@ export async function update_folder_elements_recursively(
} }
function get_folder_elements_difference( function get_folder_elements_difference(
old_elements: { folder_element: Inode; is_loading: boolean }[], old_elements: Inode[],
new_elements: { folder_element: Inode; date_created: Date }[] new_elements: { folder_element: Inode; date_created: Date }[]
): { deleted: Inode[]; new: { folder_element: Inode; date_created: Date }[] } { ): { deleted: Inode[]; new: { folder_element: Inode; date_created: Date }[] } {
const old_keys = new Set(old_elements.map((e) => get_file_primary_key(e.folder_element))); const old_keys = new Set(old_elements.map((e) => get_file_primary_key(e)));
const new_keys = new Set(new_elements.map((e) => get_file_primary_key(e.folder_element))); const new_keys = new Set(new_elements.map((e) => get_file_primary_key(e.folder_element)));
const only_in_old = old_elements const only_in_old = old_elements.filter((e) => !new_keys.has(get_file_primary_key(e)));
.filter((e) => !new_keys.has(get_file_primary_key(e.folder_element)) && !e.is_loading)
.map((e) => e.folder_element);
const only_in_new = new_elements.filter( const only_in_new = new_elements.filter(
(e) => !old_keys.has(get_file_primary_key(e.folder_element)) (e) => !old_keys.has(get_file_primary_key(e.folder_element))
); );
@@ -328,8 +335,8 @@ export async function get_folder_elements(
function sort_files(files: Inode[]) { function sort_files(files: Inode[]) {
files.sort((a, b) => { files.sort((a, b) => {
const isDirA = a.type === 'inode/directory'; const isDirA = is_folder(a);
const isDirB = b.type === 'inode/directory'; const isDirB = is_folder(b);
// Ordner zuerst // Ordner zuerst
if (isDirA && !isDirB) return -1; if (isDirA && !isDirB) return -1;
@@ -388,15 +395,6 @@ export async function run_for_selected_files_on_selected_displays(
} }
} }
export async function create_folder_on_all_selected_displays(
folder_name: string,
path: string,
selected_display_ids: string[]
): Promise<void> {
const path_with_folder_name = (path += folder_name + '/');
await create_path_on_all_selected_displays(path_with_folder_name, selected_display_ids);
}
export async function create_path_on_all_selected_displays( export async function create_path_on_all_selected_displays(
path: string, path: string,
selected_display_ids: string[] selected_display_ids: string[]
@@ -1,5 +1,6 @@
import { writable, type Writable } from 'svelte/store'; import { writable, type Writable } from 'svelte/store';
import type { NumberSetting } from '../types'; import type { NumberSetting } from '../types';
import { dev } from '$app/environment';
export const dnd_flip_duration_ms = 300; export const dnd_flip_duration_ms = 300;
@@ -33,7 +34,7 @@ export const preview_settings: Writable<{
retry_seconds: NumberSetting; retry_seconds: NumberSetting;
retry_count: NumberSetting; retry_count: NumberSetting;
}>({ }>({
mode: 'normal', mode: dev ? 'never' : 'normal',
retry_seconds: { retry_seconds: {
max: 10, max: 10,
min: 0.5, min: 0.5,
+22 -25
View File
@@ -33,7 +33,7 @@ export type FileTransferTask = {
display: ShortDisplay; display: ShortDisplay;
path: string; path: string;
file_name: string; file_name: string;
file_primary_key: string; loading_data: FileLoadingData;
bytes_total: number; // if type === 'sync' -> bytes_total = file_size * 2 (1x download + 1x upload) bytes_total: number; // if type === 'sync' -> bytes_total = file_size * 2 (1x download + 1x upload)
}; };
@@ -44,9 +44,18 @@ export type FileTransferTaskData =
} }
| { | {
type: 'sync'; type: 'sync';
destination_displays: ShortDisplay[]; destination_display_data: {
display: ShortDisplay;
loading_data: FileLoadingData;
}[];
}; };
export type FileLoadingData = {
percentage: number;
bytes_per_second: number;
seconds_until_finish: number;
};
export type ShortDisplay = { export type ShortDisplay = {
id: string; id: string;
ip: string; ip: string;
@@ -56,21 +65,6 @@ export type FileOnDisplay = {
display_id: string; display_id: string;
file_primary_key: string; // JSON.stringify([string, string, number, string]) file_primary_key: string; // JSON.stringify([string, string, number, string])
date_created: Date; date_created: Date;
loading_data: FileLoadingData | null; // null if not loading
};
export type FileLoadingData = {
type: 'upload' | 'download' | 'sync_download' | 'sync_upload';
percentage: number;
bytes_per_second: number;
seconds_until_finish: number;
};
export type CompleteFileLoadingData = {
is_loading: boolean;
total_percentage: number;
total_seconds_until_finish: number;
display_data: { loading_data: FileLoadingData; display_name: string }[];
}; };
export type Inode = { export type Inode = {
@@ -132,21 +126,20 @@ export type MenuOption = {
export type PopupContent = { export type PopupContent = {
open: boolean; open: boolean;
snippet: Snippet<[string]> | null; snippet: Snippet<[any]> | Snippet<[]> | Snippet | null | any;
snippet_arg?: string; snippet_arg?: any;
title?: string; title?: string;
title_class?: string; title_class?: string;
title_icon?: typeof X | null; title_icon?: typeof X | null;
window_class?: string; window_class?: string;
closable?: boolean;
}; };
export type NumberSetting = { export type NumberSetting = {
max: number, max: number;
min: number, min: number;
now: number, now: number;
step: number step: number;
} };
export type DisplayStatus = 'host_offline' | 'app_offline' | 'app_online' | null; export type DisplayStatus = 'host_offline' | 'app_offline' | 'app_online' | null;
@@ -155,3 +148,7 @@ export function to_display_status(value: string): DisplayStatus {
? (value as DisplayStatus) ? (value as DisplayStatus)
: null; : null;
} }
export function is_folder(inode: Inode) {
return inode.type === 'inode/directory';
}
+1 -1
View File
@@ -55,7 +55,7 @@ export function get_uuid(): string {
export function get_file_size_display_string(size: number, toFixed: number | null = null): string { export function get_file_size_display_string(size: number, toFixed: number | null = null): string {
if (size < 0) if (size < 0)
return toFixed === null ? 'versch.' : 'Verschiedene Größen auf verschiedenen Bildschirmen'; return toFixed === null ? '...' : 'Größe wird aktuell berechnet';
if (size === 0) return '0 B'; if (size === 0) return '0 B';
const k = 1024; const k = 1024;
+20 -12
View File
@@ -25,7 +25,8 @@
edit_display_data, edit_display_data,
get_display_by_id, get_display_by_id,
is_display_name_taken, is_display_name_taken,
remove_display remove_display,
screenshot_loop
} from '$lib/ts/stores/displays'; } from '$lib/ts/stores/displays';
import { notifications } from '$lib/ts/stores/notification'; import { notifications } from '$lib/ts/stores/notification';
import { ping_ip } from '$lib/ts/api_handler'; import { ping_ip } from '$lib/ts/api_handler';
@@ -35,6 +36,7 @@
import HighlightedText from '$lib/components/HighlightedText.svelte'; import HighlightedText from '$lib/components/HighlightedText.svelte';
import { preview_settings } from '$lib/ts/stores/ui_behavior'; import { preview_settings } from '$lib/ts/stores/ui_behavior';
import NumberSettingInput from '$lib/components/NumberSettingInput.svelte'; import NumberSettingInput from '$lib/components/NumberSettingInput.svelte';
import { db } from '$lib/ts/database';
const ip_regex = const ip_regex =
/^(?:(?:10|127)\.(?:25[0-5]|2[0-4]\d|1?\d?\d)\.(?:25[0-5]|2[0-4]\d|1?\d?\d)\.(?:25[0-5]|2[0-4]\d|1?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|1?\d?\d)\.(?:25[0-5]|2[0-4]\d|1?\d?\d)|172\.(?:1[6-9]|2\d|3[0-1])\.(?:25[0-5]|2[0-4]\d|1?\d?\d)\.(?:25[0-5]|2[0-4]\d|1?\d?\d))$/; /^(?:(?:10|127)\.(?:25[0-5]|2[0-4]\d|1?\d?\d)\.(?:25[0-5]|2[0-4]\d|1?\d?\d)\.(?:25[0-5]|2[0-4]\d|1?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|1?\d?\d)\.(?:25[0-5]|2[0-4]\d|1?\d?\d)|172\.(?:1[6-9]|2\d|3[0-1])\.(?:25[0-5]|2[0-4]\d|1?\d?\d)\.(?:25[0-5]|2[0-4]\d|1?\d?\d))$/;
@@ -45,7 +47,6 @@
snippet: null, snippet: null,
title: '', title: '',
title_class: '!text-xl', title_class: '!text-xl',
closable: true
}); });
let remove_display_name = $state(''); let remove_display_name = $state('');
@@ -93,6 +94,20 @@
} }
} }
async function change_preview_mode(mode: 'never' | 'normal' | 'always') {
$preview_settings.mode = mode;
if (mode === 'never') {
await db.displays
.toCollection()
.modify({ preview: { currently_updating: false, url: null } });
} else {
const display_ids = (await db.displays.toArray()).map((d) => d.id);
for (const display_id of display_ids) {
screenshot_loop(display_id);
}
}
}
function popup_close_function() { function popup_close_function() {
popup_content.open = false; popup_content.open = false;
} }
@@ -102,11 +117,10 @@
popup_content = { popup_content = {
open: true, open: true,
snippet: display_popup, snippet: display_popup,
title: 'Neuen Bildschirm hinzufügen', title: 'Neuen Bildschirm Hinzufügen',
title_icon: Monitor, title_icon: Monitor,
title_class: '!text-xl', title_class: '!text-xl',
window_class: 'w-3xl', window_class: 'w-3xl',
closable: true
}; };
}; };
@@ -118,7 +132,6 @@
title_icon: Settings, title_icon: Settings,
title_class: '!text-xl', title_class: '!text-xl',
window_class: 'w-3xl', window_class: 'w-3xl',
closable: true
}; };
}; };
@@ -131,7 +144,6 @@
title: 'Bildschirm wirklich löschen?', title: 'Bildschirm wirklich löschen?',
title_class: 'text-red-400 !text-xl', title_class: 'text-red-400 !text-xl',
title_icon: Trash2, title_icon: Trash2,
closable: true
}; };
}; };
@@ -150,7 +162,6 @@
title: 'Bildschirm bearbeiten', title: 'Bildschirm bearbeiten',
title_icon: Monitor, title_icon: Monitor,
title_class: '!text-xl', title_class: '!text-xl',
closable: true
}; };
}; };
@@ -163,7 +174,6 @@
title: 'Über PLG MuDiCS', title: 'Über PLG MuDiCS',
title_icon: Info, title_icon: Info,
title_class: '!text-xl', title_class: '!text-xl',
closable: true
}; };
}; };
</script> </script>
@@ -332,9 +342,7 @@
menu_options={(['never', 'normal', 'always'] as const).map((mode) => ({ menu_options={(['never', 'normal', 'always'] as const).map((mode) => ({
icon: mode === $preview_settings.mode ? SquareCheckBig : Square, icon: mode === $preview_settings.mode ? SquareCheckBig : Square,
name: get_display_preview_mode(mode), name: get_display_preview_mode(mode),
on_select: () => { on_select: async () => await change_preview_mode(mode)
$preview_settings.mode = mode;
}
}))}>{get_display_preview_mode($preview_settings.mode)} <ChevronDown /></Button }))}>{get_display_preview_mode($preview_settings.mode)} <ChevronDown /></Button
> >
</div> </div>
@@ -374,7 +382,7 @@
menu_options={[ menu_options={[
{ {
icon: Plus, icon: Plus,
name: 'Neuen Bildschirm hinzufügen', name: 'Neuen Bildschirm Hinzufügen',
on_select: show_new_display_popup on_select: show_new_display_popup
}, },
{ {
+76 -71
View File
@@ -21,9 +21,14 @@
show_blackscreen, show_blackscreen,
shutdown, shutdown,
startup, startup,
show_html show_website
} from '$lib/ts/api_handler'; } 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,
no_active_display_selected,
online_displays,
run_on_all_selected_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';
@@ -39,10 +44,11 @@
let popup_content: PopupContent = $state({ let popup_content: PopupContent = $state({
open: false, open: false,
snippet: null, snippet: null,
title: '', title: ''
closable: true
}); });
let current_text = $state('');
function popup_close_function() { function popup_close_function() {
popup_content.open = false; popup_content.open = false;
} }
@@ -51,9 +57,9 @@
popup_content = { popup_content = {
open: true, open: true,
snippet: send_keys_popup, snippet: send_keys_popup,
title: 'Tastatur-Eingaben durchgeben', title: 'Tastatur-Eingaben Senden',
title_icon: Keyboard, title_icon: Keyboard,
closable: true window_class: 'h-full'
}; };
}; };
@@ -61,9 +67,8 @@
popup_content = { popup_content = {
open: true, open: true,
snippet: text_popup, snippet: text_popup,
title: 'Text anzeigen', title: 'Text Anzeigen',
title_icon: TextAlignStart, title_icon: TextAlignStart,
closable: true,
window_class: 'size-full' window_class: 'size-full'
}; };
}; };
@@ -72,10 +77,9 @@
popup_content = { popup_content = {
open: true, open: true,
snippet: website_popup, snippet: website_popup,
title: 'Webseite anzeigen', title: 'Webseite Anzeigen',
window_class: 'w-xl', window_class: 'w-xl',
title_icon: Globe, title_icon: Globe
closable: true
}; };
}; };
@@ -93,13 +97,12 @@
} }
} }
async function ask_shutdonw() { async function ask_shutdown() {
popup_content = { popup_content = {
open: true, open: true,
snippet: ask_shutdonw_popup, snippet: ask_shutdown_popup,
title: 'PC Herunterfahren', title: 'Bildschirm Herunterfahren',
title_icon: PowerOff, title_icon: PowerOff
closable: true
}; };
} }
@@ -107,7 +110,10 @@
popup_content.open = false; popup_content.open = false;
await run_on_all_selected_displays((d) => { await run_on_all_selected_displays((d) => {
shutdown(d.ip); // no await here because we want to be fast shutdown(d.ip); // no await here because we want to be fast
db.displays.update(d.id, { status: 'app_offline' }); db.displays.update(d.id, {
status: 'app_offline',
preview: { currently_updating: false, url: null }
});
}, false); }, false);
} }
@@ -123,24 +129,15 @@
); );
} }
async function send_single_key_press(key: string) { async function send_single_key_press(key: string, action: 'press' | 'release') {
await run_on_all_selected_displays((d) => await run_on_all_selected_displays((d) => send_keyboard_input(d.ip, [{ key, action }]));
send_keyboard_input(d.ip, [{ key, action: 'press' }])
);
setTimeout(
async () =>
await run_on_all_selected_displays((d) =>
send_keyboard_input(d.ip, [{ key, action: 'release' }])
),
10
);
} }
let website_url = $state(''); let website_url = $state('');
let website_url_valid = $state(false); let website_url_valid = $state(false);
function validate_website_url(url: string): [boolean, string] { function validate_website_url(url: string): [boolean, string] {
if (url === '') return [true, '']; if (url === '') return [true, ''];
const regex = /^https?:\/\/[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/; const regex = /^https?:\/\/[\w\-]+(\.[\w\-]+)+([\w\-\._~:/?#\[\]@!$&'\(\)\*\+,;=.])*/;
if (regex.test(url)) { if (regex.test(url)) {
return [true, '']; return [true, ''];
} }
@@ -149,17 +146,14 @@
async function send_website() { async function send_website() {
popup_content.open = false; popup_content.open = false;
await run_on_all_selected_displays((d) => await run_on_all_selected_displays((d) => show_website(d.ip, website_url));
show_html(d.ip, `<iframe src="${website_url}"></iframe>`)
);
website_url = '';
} }
</script> </script>
{#snippet website_popup()} {#snippet website_popup()}
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<TextInput <TextInput
title="URL" title="URL (mit http:// oder https://)"
placeholder="https://example.com" placeholder="https://example.com"
bind:current_value={website_url} bind:current_value={website_url}
bind:current_valid={website_url_valid} bind:current_valid={website_url_valid}
@@ -180,7 +174,7 @@
</div> </div>
{/snippet} {/snippet}
{#snippet ask_shutdonw_popup()} {#snippet ask_shutdown_popup()}
<p>Bist du sicher, dass du alle ausgewählten Displays herunterfahren möchtest?</p> <p>Bist du sicher, dass du alle ausgewählten Displays herunterfahren möchtest?</p>
<div class="flex flex-row justify-end gap-2"> <div class="flex flex-row justify-end gap-2">
@@ -192,61 +186,70 @@
{/snippet} {/snippet}
{#snippet send_keys_popup()} {#snippet send_keys_popup()}
<div class="overflow-hidden flex flex-col gap-2"> <KeyInput {popup_close_function} />
<div>
<KeyInput />
</div>
<div class="flex flex-row justify-end gap-2">
<Button className="px-4 font-bold" click_function={popup_close_function}>Fertig</Button>
</div>
</div>
{/snippet} {/snippet}
{#snippet text_popup()} {#snippet text_popup()}
<TipTapInput /> <TipTapInput bind:text={current_text} />
{/snippet} {/snippet}
<div class="grid grid-rows-[2.5rem_auto] bg-stone-800 rounded-2xl min-w-0"> <div class="grid grid-rows-[2.5rem_auto] bg-stone-800 rounded-2xl min-w-0">
<div class="text-xl font-bold pl-3 content-center bg-stone-700 rounded-t-2xl truncate min-w-0"> <div class="text-xl font-bold pl-3 content-center bg-stone-700 rounded-t-2xl truncate min-w-0">
Bildschirme steuern Bildschirme Steuern
</div> </div>
<div class="relative flex flex-col gap-2 p-2 overflow-auto"> <div class="relative flex flex-col gap-2 p-2 overflow-auto">
<div class="flex flex-row justify-between gap-2"> <div class="flex flex-row justify-between gap-2">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<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)" title="Vorherige Folie (Pfeil nach Links) [gedrückt halten möglich]"
className="px-9" class="px-9 bg-stone-700 {$selected_display_ids.length === 0
? '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"
disabled={$selected_display_ids.length === 0} disabled={$selected_display_ids.length === 0}
click_function={async () => { onmousedown={async () => {
await send_single_key_press('VK_LEFT'); await send_single_key_press('ArrowLeft', 'press');
}}><ArrowBigLeft /></Button }}
onmouseup={async () => {
await send_single_key_press('ArrowLeft', 'release');
}}
> >
<Button <ArrowBigLeft />
title="Nächste Folie (Pfeil nach Rechts)" </button>
className="px-9"
<button
title="Vorherige Folie (Pfeil nach Links) [gedrückt halten möglich]"
class="px-9 bg-stone-700 {$selected_display_ids.length === 0
? '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"
disabled={$selected_display_ids.length === 0} disabled={$selected_display_ids.length === 0}
click_function={async () => { onmousedown={async () => {
await send_single_key_press('VK_RIGHT'); await send_single_key_press('ArrowRight', 'press');
}}><ArrowBigRight /></Button }}
onmouseup={async () => {
await send_single_key_press('ArrowRight', 'release');
}}
> >
<ArrowBigRight />
</button>
</div> </div>
<Button <Button
className="px-3 flex gap-3 w-75 justify-normal" className="px-3 flex gap-3 w-75 justify-normal"
disabled={$selected_display_ids.length === 0} click_function={show_text_popup}
click_function={show_text_popup}><TextAlignStart /> Text anzeigen</Button disabled={no_active_display_selected($selected_display_ids, $online_displays)}
><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={$selected_display_ids.length === 0} disabled={no_active_display_selected($selected_display_ids, $online_displays)}
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={$selected_display_ids.length === 0} disabled={no_active_display_selected($selected_display_ids, $online_displays)}
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
@@ -254,38 +257,40 @@
<div class="flex flex-row justify-normal"> <div class="flex flex-row justify-normal">
<Button className="rounded-r-none pl-3 flex gap-3 grow w-65 justify-normal" disabled> <Button className="rounded-r-none pl-3 flex gap-3 grow w-65 justify-normal" disabled>
<TrafficCone /> Fallback-Bild anzeigen <TrafficCone /> Fallback-Bild Anzeigen
</Button> </Button>
<Button className="rounded-l-none flex grow-0 w-10" disabled><ChevronDown /></Button> <Button className="rounded-l-none flex grow-0 w-10" disabled><ChevronDown /></Button>
</div> </div>
<Button <Button
className="px-3 flex gap-3 w-75 justify-normal" className="px-3 flex gap-3 w-75 justify-normal"
disabled={$selected_display_ids.length === 0} disabled={no_active_display_selected($selected_display_ids, $online_displays)}
click_function={show_send_keys_popup}><Keyboard /> Tastatur-Eingaben durchgeben</Button click_function={show_send_keys_popup}><Keyboard /> Tastatur-Eingaben Senden</Button
> >
</div> </div>
<div class="flex flex-col gap-2 justify-between"> <div class="flex flex-col gap-2 justify-between">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<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' || $selected_display_ids.length === 0} disabled={$all_display_states === 'on' ||
no_active_display_selected($selected_display_ids, $online_displays)}
click_function={startup_action} click_function={startup_action}
> >
<Power /> PC hochfahren <Power /> Bildschirm Hochfahren
</Button> </Button>
<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' || $selected_display_ids.length === 0} disabled={$all_display_states === 'off' ||
click_function={ask_shutdonw} no_active_display_selected($selected_display_ids, $online_displays)}
click_function={ask_shutdown}
> >
<PowerOff /> PC herunterfahren</Button <PowerOff /> Bildschirm Herunterfahren</Button
> >
</div> </div>
<Button className="px-3 flex gap-3 w-full xl:w-75 justify-normal" disabled> <Button className="px-3 flex gap-3 w-full xl:w-75 justify-normal" disabled>
<SquareTerminal /> <SquareTerminal />
Shell-Befehl ausführen Shell-Befehl Ausführen
</Button> </Button>
</div> </div>
</div> </div>
@@ -218,7 +218,7 @@
class="min-w-40 px-4 rounded-xl cursor-pointer duration-200 transition-colors bg-stone-600" class="min-w-40 px-4 rounded-xl cursor-pointer duration-200 transition-colors bg-stone-600"
onclick={async () => await toggle_all_selected_displays($display_groups)} onclick={async () => await toggle_all_selected_displays($display_groups)}
> >
<span>{$all_groups_selected || false ? 'Alle abwählen' : 'Alle auswählen'}</span> <span>{$all_groups_selected || false ? 'Alle Abwählen' : 'Alle Auswählen'}</span>
</button> </button>
<div class="flex flex-row"> <div class="flex flex-row">
<Button <Button
+25 -27
View File
@@ -14,7 +14,7 @@
import { change_height, current_height, next_height_step_size } from '$lib/ts/stores/ui_behavior'; import { change_height, current_height, next_height_step_size } from '$lib/ts/stores/ui_behavior';
import Button from '$lib/components/Button.svelte'; import Button from '$lib/components/Button.svelte';
import PathBar from './PathBar.svelte'; import PathBar from './PathBar.svelte';
import { selected_display_ids, selected_file_ids } from '$lib/ts/stores/select'; import { select, selected_display_ids, selected_file_ids } from '$lib/ts/stores/select';
import { import {
current_file_path, current_file_path,
get_folder_elements, get_folder_elements,
@@ -22,12 +22,13 @@
run_for_selected_files_on_selected_displays, run_for_selected_files_on_selected_displays,
update_current_folder_on_selected_displays, update_current_folder_on_selected_displays,
get_displays_where_path_not_exists, get_displays_where_path_not_exists,
create_folder_on_all_selected_displays create_path_on_all_selected_displays
} from '$lib/ts/stores/files'; } from '$lib/ts/stores/files';
import { slide } from 'svelte/transition'; import { slide } from 'svelte/transition';
import InodeElement from '../lib/components/InodeElement.svelte'; import InodeElement from '../lib/components/InodeElement.svelte';
import PopUp from '$lib/components/PopUp.svelte'; import PopUp from '$lib/components/PopUp.svelte';
import { get_file_primary_key, type Inode, type PopupContent } from '$lib/ts/types'; import { get_file_primary_key, is_folder, type Inode, type PopupContent } from '$lib/ts/types';
import TextInput from '$lib/components/TextInput.svelte'; import TextInput from '$lib/components/TextInput.svelte';
import { import {
first_letter_is_valid, first_letter_is_valid,
@@ -38,6 +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';
let current_name: string = $state(''); let current_name: string = $state('');
let current_valid: boolean = $state(false); let current_valid: boolean = $state(false);
@@ -58,7 +60,9 @@
$effect(() => { $effect(() => {
const s = $selected_file_ids; const s = $selected_file_ids;
one_file_selected = liveQuery(async () => { one_file_selected = liveQuery(async () => {
return s.length === 1 && (await get_file_by_id(s[0]))?.type !== 'inode/directory'; const inode = await get_file_by_id(s[0]);
if (!inode) return false;
return s.length === 1 && is_folder(inode);
}); });
}); });
@@ -66,7 +70,6 @@
open: false, open: false,
snippet: null, snippet: null,
title: '', title: '',
closable: true
}); });
let file_input: HTMLInputElement; let file_input: HTMLInputElement;
@@ -87,11 +90,8 @@
async function create_new_folder() { async function create_new_folder() {
popup_close_function(); popup_close_function();
await create_folder_on_all_selected_displays( const path_with_folder_name = ($current_file_path += current_name.trim() + '/');
current_name.trim(), await create_path_on_all_selected_displays(path_with_folder_name, $selected_display_ids);
$current_file_path,
$selected_display_ids
);
await update_current_folder_on_selected_displays(); await update_current_folder_on_selected_displays();
} }
@@ -110,17 +110,16 @@
const show_edit_file_popup = async () => { const show_edit_file_popup = async () => {
const file = await get_file_by_id($selected_file_ids[0]); const file = await get_file_by_id($selected_file_ids[0]);
if (!file) return; if (!file) return;
const is_folder = file.type === 'inode/directory'; const file_is_folder = is_folder(file);
const extension = is_folder ? '' : '.' + file.name.split('.').at(-1) || ''; const extension = file_is_folder ? '' : '.' + file.name.split('.').at(-1) || '';
current_name = file.name.slice(0, file.name.length - extension.length); current_name = file.name.slice(0, file.name.length - extension.length);
current_valid = true; current_valid = true;
popup_content = { popup_content = {
open: true, open: true,
snippet: edit_file_name_popup, snippet: edit_file_name_popup,
title: `${is_folder ? 'Ordner' : 'Datei'} umbenennen`, title: `${file_is_folder ? 'Ordner' : 'Datei'} umbenennen`,
title_icon: FolderPlus, title_icon: FolderPlus,
snippet_arg: extension, snippet_arg: extension,
closable: true
}; };
}; };
@@ -135,7 +134,6 @@
snippet: new_folder_popup, snippet: new_folder_popup,
title: 'Neuen Ordner erstellen', title: 'Neuen Ordner erstellen',
title_icon: FolderPlus, title_icon: FolderPlus,
closable: true
}; };
}; };
@@ -145,21 +143,21 @@
snippet: delete_request_popup, snippet: delete_request_popup,
title: `${$selected_file_ids.length} ${$selected_file_ids.length === 1 ? 'Objekt' : 'Objekte'} wirklich löschen?`, title: `${$selected_file_ids.length} ${$selected_file_ids.length === 1 ? 'Objekt' : 'Objekte'} wirklich löschen?`,
title_icon: Trash2, title_icon: Trash2,
closable: true
}; };
}; };
async function sync_selected_files( async function sync_selected_files(
selected_file_ids: string[], current_selected_file_ids: string[],
selected_display_ids: string[], selected_display_ids: string[],
current_folder_elements: Inode[] current_folder_elements: Inode[]
) { ) {
if (selected_file_ids.length === 0 && current_folder_elements.length > 0) { if (current_selected_file_ids.length === 0 && current_folder_elements.length > 0) {
selected_file_ids = current_folder_elements.map((inode) => get_file_primary_key(inode)); current_selected_file_ids = current_folder_elements.map((inode) => get_file_primary_key(inode));
} }
if (selected_file_ids.length === 0) return; if (current_selected_file_ids.length === 0) return;
// Mit For-Schleife über ausgewählte Elemente gehen // Mit For-Schleife über ausgewählte Elemente gehen
for (const file_id of selected_file_ids) { for (const file_id of current_selected_file_ids) {
await select(selected_file_ids, file_id, 'deselect');
await add_sync_recursively(file_id, selected_display_ids); await add_sync_recursively(file_id, selected_display_ids);
} }
} }
@@ -285,7 +283,7 @@
<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">
<div class="bg-stone-700 flex justify-between w-full p-1 rounded-t-2xl min-w-0 gap-2"> <div class="bg-stone-700 flex justify-between w-full p-1 rounded-t-2xl min-w-0 gap-2">
<span class="text-xl font-bold pl-2 content-center truncate min-w-0"> <span class="text-xl font-bold pl-2 content-center truncate min-w-0">
Dateien anzeigen und verwalten Dateien Anzeigen und Verwalten
</span> </span>
<div class="flex flex-row"> <div class="flex flex-row">
<Button <Button
@@ -321,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={$selected_display_ids.length === 0}><FolderPlus /></Button disabled={no_active_display_selected($selected_display_ids, $online_displays)}><FolderPlus /></Button
> >
<div class="border border-stone-700 my-1"></div> <div class="border border-stone-700 my-1"></div>
<Button <Button
@@ -330,7 +328,7 @@
click_function={() => { click_function={() => {
if (file_input) file_input.click(); if (file_input) file_input.click();
}} }}
disabled={$selected_display_ids.length === 0}><Upload /></Button disabled={no_active_display_selected($selected_display_ids, $online_displays)}><Upload /></Button
> >
<Button <Button
title="Ausgewählte Datei herunterladen" title="Ausgewählte Datei herunterladen"
@@ -349,7 +347,7 @@
$selected_display_ids, $selected_display_ids,
$current_folder_elements ?? [] $current_folder_elements ?? []
)} )}
disabled={$selected_display_ids.length === 0} disabled={no_active_display_selected($selected_display_ids, $online_displays)}
><RefreshCcw /> ><RefreshCcw />
<span class="hidden 2xl:flex">Synchronisieren</span> <span class="hidden 2xl:flex">Synchronisieren</span>
</Button> </Button>
@@ -363,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={$selected_display_ids.length === 0} disabled={no_active_display_selected($selected_display_ids, $online_displays)}
> >
<ClipboardPaste /> <ClipboardPaste />
</Button> </Button>
@@ -387,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 $selected_display_ids.length === 0} {#if no_active_display_selected($selected_display_ids, $online_displays)}
<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>
+105 -41
View File
@@ -1,71 +1,83 @@
<script lang="ts"> <script lang="ts">
import { flip } from 'svelte/animate'; import { flip } from 'svelte/animate';
import { get_selectable_color_classes } from '$lib/ts/stores/ui_behavior'; import { get_selectable_color_classes } from '$lib/ts/stores/ui_behavior';
import key_map_json from './../../../../shared/keys.json';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
import { run_on_all_selected_displays } from '$lib/ts/stores/displays'; import { run_on_all_selected_displays } from '$lib/ts/stores/displays';
import { send_keyboard_input } from '$lib/ts/api_handler'; import { send_keyboard_input } from '$lib/ts/api_handler';
import { ArrowDownToLine, ArrowUpFromLine, Grid2x2, Grid2X2, Option } from 'lucide-svelte';
import Button from '$lib/components/Button.svelte';
import { onDestroy } from 'svelte';
const key_map: Record<string, string> = key_map_json as Record<string, string>; let {
popup_close_function
}: {
popup_close_function: () => void;
} = $props();
let active = $state(false); let active = $state(false);
const current_keys: string[] = $state([]); const current_keys: string[] = $state([]);
let last_keys: { id: number; key: string }[] = $state([]); let last_keys: { id: number; key: string }[] = $state([]);
let seq = 0;
let el: HTMLDivElement; let el: HTMLDivElement;
function add_to_last_keys(name: string) { function add_to_last_keys(name: string) {
const id = Date.now(); const id = ++seq;
last_keys.push({ id, key: name });
// Neueste oben
last_keys = [{ id, key: name }, ...last_keys].slice(0, 6);
setTimeout(() => { setTimeout(() => {
last_keys = last_keys.filter((e) => e.id !== id); last_keys = last_keys.filter((e) => e.id !== id);
}, 1500); }, 1500);
} }
async function on_key(e: KeyboardEvent, key_down: boolean) { async function on_keyboard_input(e: KeyboardEvent, key_down: boolean) {
if (!active) return; if (!active) return;
const id = key_map[e.code]; const id = e.code;
if (!id) return; if (!id) return;
if (key_down) {
if (current_keys.includes(e.code)) return;
current_keys.push(e.code);
} else {
const index = current_keys.indexOf(e.code);
if (index === -1) return;
current_keys.splice(index, 1);
}
if (e.repeat) return;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if (e.repeat) return;
await on_key(id, key_down);
}
async function on_key(key: string, key_down: boolean) {
if (key_down) {
if (current_keys.includes(key)) return;
current_keys.push(key);
} else {
const index = current_keys.indexOf(key);
if (index === -1) return;
current_keys.splice(index, 1);
}
const action: 'press' | 'release' = key_down ? 'press' : 'release'; const action: 'press' | 'release' = key_down ? 'press' : 'release';
add_to_last_keys(action.toUpperCase() + ' ' + e.code); add_to_last_keys(action.toUpperCase() + ' ' + key);
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: id, action }]),
true
);
} }
async function release_all_pressed_keys() { async 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);
} }
await run_on_all_selected_displays( await run_on_all_selected_displays((d) => send_keyboard_input(d.ip, inputs), true);
(d) => send_keyboard_input(d.ip, inputs),
true
);
} }
onDestroy(() => {
release_all_pressed_keys();
});
</script> </script>
<div <div class="flex flex-row gap-2 overflow-hidden h-full">
<div
role="textbox" role="textbox"
tabindex="0" tabindex="0"
bind:this={el} bind:this={el}
@@ -81,9 +93,9 @@
active = false; active = false;
await release_all_pressed_keys(); await release_all_pressed_keys();
}} }}
onkeydown={(e) => on_key(e, true)} onkeydown={(e) => on_keyboard_input(e, true)}
onkeyup={(e) => on_key(e, false)} onkeyup={(e) => on_keyboard_input(e, false)}
class="relative flex justify-center items-center h-15 w-full cursor-pointer rounded-xl transition-colors duration-200 select-none {get_selectable_color_classes( class="flex justify-center items-center text-center grow py-2 px-8 w-70 h-full cursor-pointer rounded-xl transition-colors duration-200 select-none {get_selectable_color_classes(
active, active,
{ {
bg: true, bg: true,
@@ -92,15 +104,67 @@
text: true text: true
} }
)}" )}"
>
{active ? 'Erfassung aktiv' : 'Hier für Erfassung klicken'}
<div class="absolute top-full left-0 ml-1 mt-0.5 flex flex-col-reverse text-sm text-stone-400">
{#each last_keys as key (key.id)}
<span
animate:flip={{ duration: 200 }}
in:fade={{ duration: 200 }}
out:fade={{ duration: 500 }}>{key.key}</span
> >
{active ? 'Erfassung aktiv' : 'Hier für Erfassung klicken'}
</div>
<div
class="relative flex flex-col gap-1 text-sm w-40 p-2 bg-stone-750 rounded-xl overflow-hidden h-full"
>
{#each last_keys as item (item.id)}
<span
class="flex flex-row gap-2 {item.key.split(' ')[0] === 'PRESS'
? 'text-sky-600'
: 'text-lime-600'}"
animate:flip={{ duration: 120 }}
in:fade={{ duration: 120 }}
out:fade={{ duration: 200 }}
>
{#if item.key.split(' ')[0] === 'PRESS'}
<ArrowDownToLine />
{:else}
<ArrowUpFromLine />
{/if}
{item.key.split(' ').at(-1)}
</span>
{/each} {/each}
<div
class="absolute bottom-0 right-0 left-0 h-5 bg-linear-to-b from-transparent to-stone-750"
></div>
</div>
<div class="flex flex-col gap-2 justify-between">
<div class="flex flex-col gap-2">
<button
title="Windows-/Meta-Taste [gedrückt halten möglich]"
class="px-3 bg-stone-700 py-2 gap-2 rounded-xl flex items-center transition-colors duration-200 hover:bg-stone-600 active:bg-stone-500 cursor-pointer"
onmousedown={async (e) => {
e.preventDefault();
await on_key('MetaLeft', true);
}}
onmouseup={async () => {
await on_key('MetaLeft', false);
}}
>
<Grid2x2 /> Meta
</button>
<button
title="Alt-Taste [gedrückt halten möglich]"
class="px-3 bg-stone-700 py-2 gap-2 rounded-xl flex items-center transition-colors duration-200 hover:bg-stone-600 active:bg-stone-500 cursor-pointer"
onmousedown={async (e) => {
e.preventDefault();
await on_key('AltLeft', true);
}}
onmouseup={async () => {
await on_key('AltLeft', false);
}}
>
<Option /> Alt
</button>
</div>
<Button
div_class="mt-2 justify-end"
className="px-4 font-bold"
click_function={popup_close_function}>Fertig</Button
>
</div> </div>
</div> </div>
+10 -2
View File
@@ -20,6 +20,12 @@
import { Color } from '@tiptap/extension-text-style'; import { Color } from '@tiptap/extension-text-style';
import Highlight from '@tiptap/extension-highlight'; import Highlight from '@tiptap/extension-highlight';
let {
text = $bindable()
}: {
text: string;
} = $props();
type TextEditOption = { type TextEditOption = {
onclick: () => void; onclick: () => void;
is_selected: () => boolean; is_selected: () => boolean;
@@ -128,15 +134,17 @@
multicolor: true multicolor: true
}) })
], ],
content: '', content: text,
onTransaction: ({ editor }) => { onTransaction: ({ editor }) => {
// Increment the state signal to force a re-render // Increment the state signal to force a re-render
editor_state = { editor }; editor_state = { editor };
}, },
autofocus: true autofocus: true
}); });
editor_state.editor.commands.selectAll();
}); });
onDestroy(() => { onDestroy(() => {
if (editor_state.editor) text = editor_state.editor.getHTML();
editor_state.editor?.destroy(); editor_state.editor?.destroy();
}); });
</script> </script>
@@ -210,7 +218,7 @@
{/each} {/each}
</div> </div>
<Button click_function={show_text} className="w-full font-bold">Text anzeigen</Button> <Button click_function={show_text} className="w-full font-bold">Text Anzeigen</Button>
</div> </div>
</div> </div>
+2 -2
View File
@@ -77,13 +77,13 @@ func pingRoute(ctx echo.Context) error {
return ctx.JSON(http.StatusBadRequest, PingResponse{Error: "missing 'ip' query parameter"}) return ctx.JSON(http.StatusBadRequest, PingResponse{Error: "missing 'ip' query parameter"})
} }
cmd := exec.Command("ping", "-c", "1", "-w", "1", ip) cmd := exec.Command("ping", "-c", "1", "-w", "5", ip)
result := shared.RunShellCommand(cmd) result := shared.RunShellCommand(cmd)
if result.ExitCode != 0 { if result.ExitCode != 0 {
return ctx.JSON(http.StatusOK, PingResponse{Status: "host_offline"}) return ctx.JSON(http.StatusOK, PingResponse{Status: "host_offline"})
} }
conn, err := net.DialTimeout("tcp", ip+":1323", 1*time.Second) conn, err := net.DialTimeout("tcp", ip+":1323", 5*time.Second)
if err != nil { if err != nil {
return ctx.JSON(http.StatusOK, PingResponse{Status: "app_offline"}) return ctx.JSON(http.StatusOK, PingResponse{Status: "app_offline"})
} }
+13 -1
View File
@@ -2,8 +2,10 @@ package pkg
import ( import (
"fmt" "fmt"
"log/slog"
"os" "os"
"os/exec" "os/exec"
"path/filepath"
"plg-mudics/shared" "plg-mudics/shared"
"syscall" "syscall"
@@ -36,7 +38,17 @@ func (fh *fileHandler) OpenFile(path string) error {
switch mType.String() { switch mType.String() {
case "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.oasis.opendocument.presentation": case "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.oasis.opendocument.presentation":
fh.runningProgram = exec.Command("soffice", "--show", path, "--nologo", "--view", "--norestore", fmt.Sprintf("-env:UserInstallation=file://%s", tempDirPath)) // yes, we need this weird workaround to delete lock files since libreoffice
// doesn't expose an option to ignore them or prevent their creation
// the --view argument for some reason doesn't work with --show
parent := filepath.Dir(path)
cmd := exec.Command("find", parent, "-name", ".~lock*", "-type", "f", "-delete")
result := shared.RunShellCommand(cmd)
if result.ExitCode != 0 {
slog.Warn("could not remove lock files", "path", parent, "stderr", result.Stderr, "exitCode", result.ExitCode)
}
fh.runningProgram = exec.Command("soffice", "--show", path, "--nologo", "--norestore", fmt.Sprintf("-env:UserInstallation=file://%s", tempDirPath))
case "application/pdf": case "application/pdf":
fh.runningProgram = exec.Command("xreader", path, "--presentation") fh.runningProgram = exec.Command("xreader", path, "--presentation")
default: default:
+178
View File
@@ -0,0 +1,178 @@
package pkg
import (
"fmt"
"log/slog"
"time"
"github.com/micmonay/keybd_event"
)
type KeyAction int
const (
KeyPress KeyAction = iota
KeyRelease
)
type Input struct {
Key string
Action KeyAction
}
func KeyboardInput(inputs []Input) error {
var err error
kb, err := keybd_event.NewKeyBonding()
if err != nil {
return fmt.Errorf("failed to create key bonding: %w", err)
}
for _, input := range inputs {
switch input.Key {
case "Shift", "ShiftLeft", "ShiftRight":
kb.HasSHIFT(true)
case "Ctrl", "Control", "ControlLeft", "ControlRight":
kb.HasCTRL(true)
case "Alt", "AltLeft", "AltRight":
kb.HasALT(true)
case "Super", "Meta", "MetaLeft", "MetaRight":
kb.HasSuper(true)
default:
keyCode, ok := KeyboardEvents[input.Key]
if !ok {
slog.Warn("Could not parse keyboard input", "key", input.Key)
continue
}
kb.SetKeys(keyCode)
}
switch input.Action {
case KeyPress:
err = kb.Press()
case KeyRelease:
err = kb.Release()
}
if err != nil {
return fmt.Errorf("failed to run key event: %w", err)
}
time.Sleep(time.Microsecond * 10)
}
return nil
}
var KeyboardEvents = map[string]int{
"Escape": keybd_event.VK_ESC,
"Digit1": keybd_event.VK_1,
"Digit2": keybd_event.VK_2,
"Digit3": keybd_event.VK_3,
"Digit4": keybd_event.VK_4,
"Digit5": keybd_event.VK_5,
"Digit6": keybd_event.VK_6,
"Digit7": keybd_event.VK_7,
"Digit8": keybd_event.VK_8,
"Digit9": keybd_event.VK_9,
"Digit0": keybd_event.VK_0,
"KeyQ": keybd_event.VK_Q,
"KeyW": keybd_event.VK_W,
"KeyE": keybd_event.VK_E,
"KeyR": keybd_event.VK_R,
"KeyT": keybd_event.VK_T,
"KeyY": keybd_event.VK_Y,
"KeyU": keybd_event.VK_U,
"KeyI": keybd_event.VK_I,
"KeyO": keybd_event.VK_O,
"KeyP": keybd_event.VK_P,
"KeyA": keybd_event.VK_A,
"KeyS": keybd_event.VK_S,
"KeyD": keybd_event.VK_D,
"KeyF": keybd_event.VK_F,
"KeyG": keybd_event.VK_G,
"KeyH": keybd_event.VK_H,
"KeyJ": keybd_event.VK_J,
"KeyK": keybd_event.VK_K,
"KeyL": keybd_event.VK_L,
"KeyZ": keybd_event.VK_Z,
"KeyX": keybd_event.VK_X,
"KeyC": keybd_event.VK_C,
"KeyV": keybd_event.VK_V,
"KeyB": keybd_event.VK_B,
"KeyN": keybd_event.VK_N,
"KeyM": keybd_event.VK_M,
"F1": keybd_event.VK_F1,
"F2": keybd_event.VK_F2,
"F3": keybd_event.VK_F3,
"F4": keybd_event.VK_F4,
"F5": keybd_event.VK_F5,
"F6": keybd_event.VK_F6,
"F7": keybd_event.VK_F7,
"F8": keybd_event.VK_F8,
"F9": keybd_event.VK_F9,
"F10": keybd_event.VK_F10,
"F11": keybd_event.VK_F11,
"F12": keybd_event.VK_F12,
"F13": keybd_event.VK_F13,
"F14": keybd_event.VK_F14,
"F15": keybd_event.VK_F15,
"F16": keybd_event.VK_F16,
"F17": keybd_event.VK_F17,
"F18": keybd_event.VK_F18,
"F19": keybd_event.VK_F19,
"F20": keybd_event.VK_F20,
"F21": keybd_event.VK_F21,
"F22": keybd_event.VK_F22,
"F23": keybd_event.VK_F23,
"F24": keybd_event.VK_F24,
"NumLock": keybd_event.VK_NUMLOCK,
"ScrollLock": keybd_event.VK_SCROLLLOCK,
"CapsLock": keybd_event.VK_CAPSLOCK,
"Minus": keybd_event.VK_SP2,
"Equal": keybd_event.VK_SP3,
"Backspace": keybd_event.VK_BACKSPACE,
"Tab": keybd_event.VK_TAB,
"BracketLeft": keybd_event.VK_SP4,
"BracketRight": keybd_event.VK_SP5,
"Enter": keybd_event.VK_ENTER,
"Semicolon": keybd_event.VK_SP6,
"Quote": keybd_event.VK_SP7,
"Backquote": keybd_event.VK_SP1,
"Backslash": keybd_event.VK_SP8,
"Comma": keybd_event.VK_SP9,
"Period": keybd_event.VK_SP10,
"Slash": keybd_event.VK_SP11,
"IntlBackslash": keybd_event.VK_SP12,
"NumpadMultiply": keybd_event.VK_KPASTERISK,
"NumpadAdd": keybd_event.VK_KPPLUS,
"NumpadSubtract": keybd_event.VK_KPMINUS,
"NumpadDecimal": keybd_event.VK_KPDOT,
"Space": keybd_event.VK_SPACE,
"Numpad0": keybd_event.VK_KP0,
"Numpad1": keybd_event.VK_KP1,
"Numpad2": keybd_event.VK_KP2,
"Numpad3": keybd_event.VK_KP3,
"Numpad4": keybd_event.VK_KP4,
"Numpad5": keybd_event.VK_KP5,
"Numpad6": keybd_event.VK_KP6,
"Numpad7": keybd_event.VK_KP7,
"Numpad8": keybd_event.VK_KP8,
"Numpad9": keybd_event.VK_KP9,
"PageUp": keybd_event.VK_PAGEUP,
"PageDown": keybd_event.VK_PAGEDOWN,
"End": keybd_event.VK_END,
"Home": keybd_event.VK_HOME,
"ArrowLeft": keybd_event.VK_LEFT,
"ArrowUp": keybd_event.VK_UP,
"ArrowRight": keybd_event.VK_RIGHT,
"ArrowDown": keybd_event.VK_DOWN,
"PrintScreen": keybd_event.VK_PRINT,
"Insert": keybd_event.VK_INSERT,
"Delete": keybd_event.VK_DELETE,
"Help": keybd_event.VK_HELP,
"BrowserBack": keybd_event.VK_BACK,
"Pause": keybd_event.VK_PAUSE,
"Lang1": keybd_event.VK_HANGUEL,
"Lang2": keybd_event.VK_HANJA,
}
-129
View File
@@ -1,129 +0,0 @@
package pkg
import "github.com/micmonay/keybd_event"
var KeyboardEvents = map[string]int{
"VK_SP1": keybd_event.VK_SP1,
"VK_SP2": keybd_event.VK_SP2,
"VK_SP3": keybd_event.VK_SP3,
"VK_SP4": keybd_event.VK_SP4,
"VK_SP5": keybd_event.VK_SP5,
"VK_SP6": keybd_event.VK_SP6,
"VK_SP7": keybd_event.VK_SP7,
"VK_SP8": keybd_event.VK_SP8,
"VK_SP9": keybd_event.VK_SP9,
"VK_SP10": keybd_event.VK_SP10,
"VK_SP11": keybd_event.VK_SP11,
"VK_SP12": keybd_event.VK_SP12,
"VK_ESC": keybd_event.VK_ESC,
"VK_1": keybd_event.VK_1,
"VK_2": keybd_event.VK_2,
"VK_3": keybd_event.VK_3,
"VK_4": keybd_event.VK_4,
"VK_5": keybd_event.VK_5,
"VK_6": keybd_event.VK_6,
"VK_7": keybd_event.VK_7,
"VK_8": keybd_event.VK_8,
"VK_9": keybd_event.VK_9,
"VK_0": keybd_event.VK_0,
"VK_Q": keybd_event.VK_Q,
"VK_W": keybd_event.VK_W,
"VK_E": keybd_event.VK_E,
"VK_R": keybd_event.VK_R,
"VK_T": keybd_event.VK_T,
"VK_Y": keybd_event.VK_Y,
"VK_U": keybd_event.VK_U,
"VK_I": keybd_event.VK_I,
"VK_O": keybd_event.VK_O,
"VK_P": keybd_event.VK_P,
"VK_A": keybd_event.VK_A,
"VK_S": keybd_event.VK_S,
"VK_D": keybd_event.VK_D,
"VK_F": keybd_event.VK_F,
"VK_G": keybd_event.VK_G,
"VK_H": keybd_event.VK_H,
"VK_J": keybd_event.VK_J,
"VK_K": keybd_event.VK_K,
"VK_L": keybd_event.VK_L,
"VK_Z": keybd_event.VK_Z,
"VK_X": keybd_event.VK_X,
"VK_C": keybd_event.VK_C,
"VK_V": keybd_event.VK_V,
"VK_B": keybd_event.VK_B,
"VK_N": keybd_event.VK_N,
"VK_M": keybd_event.VK_M,
"VK_F1": keybd_event.VK_F1,
"VK_F2": keybd_event.VK_F2,
"VK_F3": keybd_event.VK_F3,
"VK_F4": keybd_event.VK_F4,
"VK_F5": keybd_event.VK_F5,
"VK_F6": keybd_event.VK_F6,
"VK_F7": keybd_event.VK_F7,
"VK_F8": keybd_event.VK_F8,
"VK_F9": keybd_event.VK_F9,
"VK_F10": keybd_event.VK_F10,
"VK_F11": keybd_event.VK_F11,
"VK_F12": keybd_event.VK_F12,
"VK_F13": keybd_event.VK_F13,
"VK_F14": keybd_event.VK_F14,
"VK_F15": keybd_event.VK_F15,
"VK_F16": keybd_event.VK_F16,
"VK_F17": keybd_event.VK_F17,
"VK_F18": keybd_event.VK_F18,
"VK_F19": keybd_event.VK_F19,
"VK_F20": keybd_event.VK_F20,
"VK_F21": keybd_event.VK_F21,
"VK_F22": keybd_event.VK_F22,
"VK_F23": keybd_event.VK_F23,
"VK_F24": keybd_event.VK_F24,
"VK_NUMLOCK": keybd_event.VK_NUMLOCK,
"VK_SCROLLLOCK": keybd_event.VK_SCROLLLOCK,
"VK_RESERVED": keybd_event.VK_RESERVED,
"VK_MINUS": keybd_event.VK_MINUS,
"VK_EQUAL": keybd_event.VK_EQUAL,
"VK_BACKSPACE": keybd_event.VK_BACKSPACE,
"VK_TAB": keybd_event.VK_TAB,
"VK_LEFTBRACE": keybd_event.VK_LEFTBRACE,
"VK_RIGHTBRACE": keybd_event.VK_RIGHTBRACE,
"VK_ENTER": keybd_event.VK_ENTER,
"VK_SEMICOLON": keybd_event.VK_SEMICOLON,
"VK_APOSTROPHE": keybd_event.VK_APOSTROPHE,
"VK_GRAVE": keybd_event.VK_GRAVE,
"VK_BACKSLASH": keybd_event.VK_BACKSLASH,
"VK_COMMA": keybd_event.VK_COMMA,
"VK_DOT": keybd_event.VK_DOT,
"VK_SLASH": keybd_event.VK_SLASH,
"VK_KPASTERISK": keybd_event.VK_KPASTERISK,
"VK_SPACE": keybd_event.VK_SPACE,
"VK_CAPSLOCK": keybd_event.VK_CAPSLOCK,
"VK_KP0": keybd_event.VK_KP0,
"VK_KP1": keybd_event.VK_KP1,
"VK_KP2": keybd_event.VK_KP2,
"VK_KP3": keybd_event.VK_KP3,
"VK_KP4": keybd_event.VK_KP4,
"VK_KP5": keybd_event.VK_KP5,
"VK_KP6": keybd_event.VK_KP6,
"VK_KP7": keybd_event.VK_KP7,
"VK_KP8": keybd_event.VK_KP8,
"VK_KP9": keybd_event.VK_KP9,
"VK_KPMINUS": keybd_event.VK_KPMINUS,
"VK_KPPLUS": keybd_event.VK_KPPLUS,
"VK_KPDOT": keybd_event.VK_KPDOT,
"VK_CANCEL": keybd_event.VK_CANCEL,
"VK_BACK": keybd_event.VK_BACK,
"VK_PAUSE": keybd_event.VK_PAUSE,
"VK_HANGUEL": keybd_event.VK_HANGUEL,
"VK_HANJA": keybd_event.VK_HANJA,
"VK_PAGEUP": keybd_event.VK_PAGEUP,
"VK_PAGEDOWN": keybd_event.VK_PAGEDOWN,
"VK_END": keybd_event.VK_END,
"VK_HOME": keybd_event.VK_HOME,
"VK_LEFT": keybd_event.VK_LEFT,
"VK_UP": keybd_event.VK_UP,
"VK_RIGHT": keybd_event.VK_RIGHT,
"VK_DOWN": keybd_event.VK_DOWN,
"VK_PRINT": keybd_event.VK_PRINT,
"VK_INSERT": keybd_event.VK_INSERT,
"VK_DELETE": keybd_event.VK_DELETE,
"VK_HELP": keybd_event.VK_HELP,
}
-42
View File
@@ -11,8 +11,6 @@ import (
"time" "time"
"plg-mudics/shared" "plg-mudics/shared"
"github.com/micmonay/keybd_event"
) )
func GetDeviceIp() (string, error) { func GetDeviceIp() (string, error) {
@@ -46,46 +44,6 @@ func GetDeviceMac() (string, error) {
return "", fmt.Errorf("no suitable MAC address found") return "", fmt.Errorf("no suitable MAC address found")
} }
type KeyAction int
const (
KeyPress KeyAction = iota
KeyRelease
)
type Input struct {
Key int
Action KeyAction
}
func KeyboardInput(inputs []Input) error {
var err error
kb, err := keybd_event.NewKeyBonding()
if err != nil {
return fmt.Errorf("failed to create key bonding: %w", err)
}
for _, input := range inputs {
kb.SetKeys(input.Key)
switch input.Action {
case KeyPress:
err = kb.Press()
case KeyRelease:
err = kb.Release()
}
if err != nil {
return fmt.Errorf("failed to run key event: %w", err)
}
time.Sleep(time.Microsecond * 100)
}
return nil
}
func TakeScreenshot() (string, error) { func TakeScreenshot() (string, error) {
tempFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("screenshot_%d.png", time.Now().Unix())) tempFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("screenshot_%d.png", time.Now().Unix()))
+1 -7
View File
@@ -216,12 +216,6 @@ func keyboardInputRoute(ctx echo.Context) error {
return ctx.JSON(http.StatusBadRequest, shared.ErrorResponse{Description: fmt.Sprintf("Invalid action: %s", input.Action)}) return ctx.JSON(http.StatusBadRequest, shared.ErrorResponse{Description: fmt.Sprintf("Invalid action: %s", input.Action)})
} }
code, ok := pkg.KeyboardEvents[input.Key]
if !ok {
slog.Error("Unsupported key", "key", input.Key)
return ctx.JSON(http.StatusBadRequest, shared.ErrorResponse{Description: fmt.Sprintf("Unsupported key: %s", input.Key)})
}
var action pkg.KeyAction var action pkg.KeyAction
if input.Action == "press" { if input.Action == "press" {
action = pkg.KeyPress action = pkg.KeyPress
@@ -231,7 +225,7 @@ func keyboardInputRoute(ctx echo.Context) error {
} }
inputs = append(inputs, pkg.Input{ inputs = append(inputs, pkg.Input{
Key: code, Key: input.Key,
Action: action, Action: action,
}) })
} }
+1
View File
@@ -95,6 +95,7 @@
xreader xreader
tree tree
jq jq
screen
# Libraries # Libraries
imagemagick imagemagick
-114
View File
@@ -1,114 +0,0 @@
{
"Escape": "VK_ESC",
"Digit1": "VK_1",
"Digit2": "VK_2",
"Digit3": "VK_3",
"Digit4": "VK_4",
"Digit5": "VK_5",
"Digit6": "VK_6",
"Digit7": "VK_7",
"Digit8": "VK_8",
"Digit9": "VK_9",
"Digit0": "VK_0",
"KeyQ": "VK_Q",
"KeyW": "VK_W",
"KeyE": "VK_E",
"KeyR": "VK_R",
"KeyT": "VK_T",
"KeyY": "VK_Y",
"KeyU": "VK_U",
"KeyI": "VK_I",
"KeyO": "VK_O",
"KeyP": "VK_P",
"KeyA": "VK_A",
"KeyS": "VK_S",
"KeyD": "VK_D",
"KeyF": "VK_F",
"KeyG": "VK_G",
"KeyH": "VK_H",
"KeyJ": "VK_J",
"KeyK": "VK_K",
"KeyL": "VK_L",
"KeyZ": "VK_Z",
"KeyX": "VK_X",
"KeyC": "VK_C",
"KeyV": "VK_V",
"KeyB": "VK_B",
"KeyN": "VK_N",
"KeyM": "VK_M",
"F1": "VK_F1",
"F2": "VK_F2",
"F3": "VK_F3",
"F4": "VK_F4",
"F5": "VK_F5",
"F6": "VK_F6",
"F7": "VK_F7",
"F8": "VK_F8",
"F9": "VK_F9",
"F10": "VK_F10",
"F11": "VK_F11",
"F12": "VK_F12",
"F13": "VK_F13",
"F14": "VK_F14",
"F15": "VK_F15",
"F16": "VK_F16",
"F17": "VK_F17",
"F18": "VK_F18",
"F19": "VK_F19",
"F20": "VK_F20",
"F21": "VK_F21",
"F22": "VK_F22",
"F23": "VK_F23",
"F24": "VK_F24",
"NumLock": "VK_NUMLOCK",
"ScrollLock": "VK_SCROLLLOCK",
"CapsLock": "VK_CAPSLOCK",
"Minus": "VK_SP2",
"Equal": "VK_SP3",
"Backspace": "VK_BACKSPACE",
"Tab": "VK_TAB",
"BracketLeft": "VK_SP4",
"BracketRight": "VK_SP5",
"Enter": "VK_ENTER",
"Semicolon": "VK_SP6",
"Quote": "VK_SP7",
"Backquote": "VK_SP1",
"Backslash": "VK_SP8",
"Comma": "VK_SP9",
"Period": "VK_SP10",
"Slash": "VK_SP11",
"IntlBackslash": "VK_SP12",
"NumpadMultiply": "VK_KPASTERISK",
"NumpadDivide": "VK_KPSLASH",
"NumpadAdd": "VK_KPPLUS",
"NumpadSubtract": "VK_KPMINUS",
"NumpadDecimal": "VK_KPDOT",
"NumpadEnter": "VK_KPENTER",
"Space": "VK_SPACE",
"Numpad0": "VK_KP0",
"Numpad1": "VK_KP1",
"Numpad2": "VK_KP2",
"Numpad3": "VK_KP3",
"Numpad4": "VK_KP4",
"Numpad5": "VK_KP5",
"Numpad6": "VK_KP6",
"Numpad7": "VK_KP7",
"Numpad8": "VK_KP8",
"Numpad9": "VK_KP9",
"PageUp": "VK_PAGEUP",
"PageDown": "VK_PAGEDOWN",
"End": "VK_END",
"Home": "VK_HOME",
"ArrowLeft": "VK_LEFT",
"ArrowUp": "VK_UP",
"ArrowRight": "VK_RIGHT",
"ArrowDown": "VK_DOWN",
"PrintScreen": "VK_PRINT",
"Insert": "VK_INSERT",
"Delete": "VK_DELETE",
"Help": "VK_HELP",
"BrowserBack": "VK_BACK",
"Pause": "VK_PAUSE",
"Lang1": "VK_HANGUEL",
"Lang2": "VK_HANJA"
}
-1
View File
@@ -24,7 +24,6 @@ func OpenBrowserWindow(url string, fullscreen bool, profile string) error {
fmt.Sprintf("--app=%s", url), fmt.Sprintf("--app=%s", url),
"--autoplay-policy=no-user-gesture-required", "--autoplay-policy=no-user-gesture-required",
fmt.Sprintf("--user-data-dir=%s", browserProfileDirPath), fmt.Sprintf("--user-data-dir=%s", browserProfileDirPath),
"--disable-web-security",
"--allow-running-insecure-content", "--allow-running-insecure-content",
"--disable-features=XFrameOptions", "--disable-features=XFrameOptions",
} }
+1 -1
View File
@@ -1 +1 @@
v0.0.15 v0.0.19