mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-06 17:07:08 +00:00
Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 86f23077ea | |||
| 47d462ba76 | |||
| 5533696aad | |||
| ac68939abd | |||
| d6bafd4e6f | |||
| ce28a1f771 | |||
| 7632229704 | |||
| b5e997e675 | |||
| ca08d6fb6a | |||
| 4ab8f43295 | |||
| fc59b576b5 | |||
| e2a9558d3f | |||
| 662bcb3b8d | |||
| 9044262ab6 | |||
| 6c654e295c | |||
| a2bbf19fee | |||
| 246549acdf | |||
| 80cee15576 | |||
| 1c59b40971 | |||
| 548f8ccba8 | |||
| 5b93250e22 | |||
| 5ca2487598 | |||
| 464422ec51 | |||
| 128bbb4ca2 | |||
| 8686a1cb47 | |||
| d3f8a0134b | |||
| ea2f063991 | |||
| 9be8a70452 | |||
| 9ce2c1d8bb | |||
| ce8133d59e | |||
| b0a57f9c67 | |||
| c64eb345fd | |||
| 9ed35750c4 | |||
| 2b58c8bc69 | |||
| 9fdd2c4729 | |||
| db925e1509 | |||
| 438c64f055 | |||
| 6a65ac7e70 | |||
| 74779740f7 | |||
| 5d868bc1fd | |||
| 8b7aabb473 | |||
| fe5cc22cc0 | |||
| 30138ebe04 | |||
| f9c3161cf6 | |||
| 0692034344 | |||
| c175e9d3f8 | |||
| e27cf170ef | |||
| 0d6d3a6012 | |||
| 426ea4802e | |||
| bdcb0a8ce3 | |||
| 09adf5dba4 |
@@ -6,14 +6,7 @@ Open source solution for advanced remote control and coordination of one or more
|
||||
|
||||
## Display Requirements
|
||||
|
||||
- Linux
|
||||
- Bash
|
||||
- Chromium
|
||||
- LibreOffice (optional, presentation view)
|
||||
- Xreader (optional, pdf view)
|
||||
- ImageMagick (optional, image preview)
|
||||
- ffmpeg (optional, video preview)
|
||||
- Ghostscript (optional, pdf preview)
|
||||
See [packages in the NixOS config](https://github.com/PLG-Development/PLG-MuDiCS/blob/b0a57f9c679e8c483d1a81cb3c749cf8555785f6/nixos/configuration.nix#L86).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
Executable
BIN
Binary file not shown.
Generated
+286
-261
File diff suppressed because it is too large
Load Diff
Generated
+935
-1168
File diff suppressed because it is too large
Load Diff
@@ -16,40 +16,40 @@
|
||||
"test": "deno task test:e2e"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.5",
|
||||
"@eslint/js": "^9.18.0",
|
||||
"@eslint/compat": "^1.4.1",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@playwright/test": "1.56.1",
|
||||
"@sveltejs/adapter-auto": "^6.0.0",
|
||||
"@sveltejs/adapter-static": "^3.0.9",
|
||||
"@sveltejs/kit": "^2.22.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"@tiptap/extension-placeholder": "^3.11.0",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-svelte": "^3.0.0",
|
||||
"globals": "^16.0.0",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-svelte": "^3.3.3",
|
||||
"sass-embedded": "^1.93.3",
|
||||
"svelte": "^5.0.0",
|
||||
"@sveltejs/adapter-auto": "^6.1.1",
|
||||
"@sveltejs/adapter-static": "^3.0.10",
|
||||
"@sveltejs/kit": "^2.49.3",
|
||||
"@sveltejs/vite-plugin-svelte": "^6.2.3",
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"@tiptap/extension-placeholder": "^3.15.3",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-svelte": "^3.14.0",
|
||||
"globals": "^16.5.0",
|
||||
"prettier": "^3.7.4",
|
||||
"prettier-plugin-svelte": "^3.4.1",
|
||||
"sass-embedded": "^1.97.2",
|
||||
"svelte": "^5.46.1",
|
||||
"svelte-check": "^4.3.5",
|
||||
"svelte-dnd-action": "^0.9.65",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript-eslint": "^8.20.0",
|
||||
"vite": "^7.0.4"
|
||||
"svelte-dnd-action": "^0.9.69",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.52.0",
|
||||
"vite": "^7.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@thisux/sveltednd": "^0.0.20",
|
||||
"@tiptap/core": "^3.11.0",
|
||||
"@tiptap/extension-highlight": "^3.11.0",
|
||||
"@tiptap/extension-text-style": "^3.11.0",
|
||||
"@tiptap/extensions": "^3.11.0",
|
||||
"@tiptap/pm": "^3.11.0",
|
||||
"@tiptap/starter-kit": "^3.11.0",
|
||||
"@tiptap/core": "^3.15.3",
|
||||
"@tiptap/extension-highlight": "^3.15.3",
|
||||
"@tiptap/extension-text-style": "^3.15.3",
|
||||
"@tiptap/extensions": "^3.15.3",
|
||||
"@tiptap/pm": "^3.15.3",
|
||||
"@tiptap/starter-kit": "^3.15.3",
|
||||
"dexie": "^4.2.1",
|
||||
"lucide-svelte": "^0.545.0",
|
||||
"svelte-splitpanes": "^8.0.9"
|
||||
"svelte-splitpanes": "^8.0.12"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
html {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--color-stone-300) transparent;
|
||||
}
|
||||
|
||||
@@ -11,22 +11,25 @@
|
||||
import DisplayObject from './DisplayObject.svelte';
|
||||
import {
|
||||
all_displays_of_group_selected,
|
||||
get_display_ids_in_group,
|
||||
set_select_for_group,
|
||||
update_db_displays,
|
||||
local_displays,
|
||||
set_new_display_order
|
||||
} from '$lib/ts/stores/displays';
|
||||
import DNDGrip from '$lib/components/DNDGrip.svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
import type { MenuOption } from '$lib/ts/types';
|
||||
import type { Display, DisplayIdGroup, MenuOption } from '$lib/ts/types';
|
||||
import { selected_display_ids } from '$lib/ts/stores/select';
|
||||
import { liveQuery, type Observable } from 'dexie';
|
||||
import { onMount } from 'svelte';
|
||||
import { get_uuid } from '$lib/ts/utils';
|
||||
|
||||
let {
|
||||
display_group_id,
|
||||
display_id_group,
|
||||
get_display_menu_options,
|
||||
close_pinned_display
|
||||
}: {
|
||||
display_group_id: string;
|
||||
display_id_group: DisplayIdGroup;
|
||||
get_display_menu_options: (display_id: string) => MenuOption[];
|
||||
close_pinned_display: () => void;
|
||||
} = $props();
|
||||
@@ -34,14 +37,14 @@
|
||||
let all_selected: Observable<boolean> | undefined = $state();
|
||||
$effect(() => {
|
||||
const sdi = $selected_display_ids;
|
||||
all_selected = liveQuery(() => all_displays_of_group_selected(display_group_id, sdi));
|
||||
all_selected = liveQuery(() => all_displays_of_group_selected(display_id_group.id, sdi));
|
||||
});
|
||||
let display_ids_in_group = liveQuery(() => get_display_ids_in_group(display_group_id));
|
||||
|
||||
let hovering_selectable = $state(false);
|
||||
|
||||
async function select_all_of_this_group() {
|
||||
const new_value = !($all_selected || false);
|
||||
await set_select_for_group(display_group_id, new_value);
|
||||
await set_select_for_group(display_id_group.id, new_value);
|
||||
}
|
||||
|
||||
async function handle_consider(e: CustomEvent) {
|
||||
@@ -49,14 +52,21 @@
|
||||
|
||||
if (items.length !== 1 && info.trigger === TRIGGERS.DRAG_STARTED) {
|
||||
$is_display_drag = true;
|
||||
// add_empty_display_group();
|
||||
// add empty display group if its not just one group
|
||||
if (!($local_displays.length === 1 && $local_displays[0].displays.length === 1)) {
|
||||
$local_displays.push({
|
||||
id: get_uuid(),
|
||||
displays: []
|
||||
});
|
||||
}
|
||||
}
|
||||
await set_new_display_order(items);
|
||||
set_new_display_order(display_id_group.id, items);
|
||||
}
|
||||
|
||||
async function handle_finalize(e: CustomEvent) {
|
||||
set_new_display_order(display_id_group.id, e.detail.items);
|
||||
await update_db_displays();
|
||||
$is_display_drag = false;
|
||||
await set_new_display_order(e.detail.items);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -77,7 +87,7 @@
|
||||
<div
|
||||
class="flex flex-col min-w-0 pl-2 py-2 gap-2 w-full"
|
||||
use:dragHandleZone={{
|
||||
items: $display_ids_in_group || [],
|
||||
items: display_id_group.displays,
|
||||
type: 'item',
|
||||
flipDurationMs: dnd_flip_duration_ms,
|
||||
dropTargetStyle: { outline: 'none' }
|
||||
@@ -85,18 +95,15 @@
|
||||
onconsider={handle_consider}
|
||||
onfinalize={handle_finalize}
|
||||
>
|
||||
{#each $display_ids_in_group || [] as display (display.id)}
|
||||
{#each display_id_group.displays as display_id_object (display_id_object.id)}
|
||||
<!-- Each Group -->
|
||||
<section
|
||||
animate:flip={{ duration: $is_group_drag ? 0 : dnd_flip_duration_ms, easing: cubicOut }}
|
||||
class="outline-none"
|
||||
role="figure"
|
||||
>
|
||||
<DisplayObject {display} {get_display_menu_options} {close_pinned_display} />
|
||||
<section class="outline-none" role="figure">
|
||||
<!-- animate:flip={{ duration: $is_group_drag ? 0 : dnd_flip_duration_ms, easing: cubicOut }} -->
|
||||
<DisplayObject {display_id_object} {get_display_menu_options} {close_pinned_display} />
|
||||
</section>
|
||||
{/each}
|
||||
|
||||
{#if ($display_ids_in_group || []).length === 0}
|
||||
{#if display_id_group.displays.length === 0}
|
||||
<div class="min-h-10 h-full w-full pl-2 py-2 flex justify-center items-center">
|
||||
Hier in leere neue Gruppe ablegen
|
||||
</div>
|
||||
|
||||
@@ -8,38 +8,40 @@
|
||||
import DNDGrip from '$lib/components/DNDGrip.svelte';
|
||||
import { Menu, Pin, PinOff, VideoOff } from 'lucide-svelte';
|
||||
import OnlineState from './OnlineState.svelte';
|
||||
import type { Display, MenuOption } from '$lib/ts/types';
|
||||
import type { Display, DisplayIdObject, MenuOption } from '$lib/ts/types';
|
||||
import { is_selected, select, selected_display_ids } from '$lib/ts/stores/select';
|
||||
import { screenshot_loop } from '$lib/ts/stores/displays';
|
||||
import { get_display_by_id, screenshot_loop } from '$lib/ts/stores/displays';
|
||||
import { change_file_path, current_file_path } from '$lib/ts/stores/files';
|
||||
import { liveQuery } from 'dexie';
|
||||
|
||||
let {
|
||||
display,
|
||||
display_id_object,
|
||||
get_display_menu_options,
|
||||
close_pinned_display
|
||||
}: {
|
||||
display: Display;
|
||||
display_id_object: DisplayIdObject;
|
||||
get_display_menu_options: (display_id: string) => MenuOption[];
|
||||
close_pinned_display: () => void;
|
||||
} = $props();
|
||||
|
||||
let hovering_unselectable = $state(false);
|
||||
let display = liveQuery(() => get_display_by_id(display_id_object.id));
|
||||
|
||||
async function onclick(e: Event) {
|
||||
e.stopPropagation();
|
||||
select(selected_display_ids, display.id, 'toggle');
|
||||
select(selected_display_ids, display_id_object.id, 'toggle');
|
||||
|
||||
// force file view update
|
||||
await change_file_path($current_file_path);
|
||||
}
|
||||
|
||||
async function on_preview_click(e: MouseEvent) {
|
||||
if ($pinned_display_id === display.id) {
|
||||
if ($pinned_display_id === display_id_object.id) {
|
||||
close_pinned_display();
|
||||
} else {
|
||||
$pinned_display_id = display.id;
|
||||
$pinned_display_id = display_id_object.id;
|
||||
}
|
||||
await screenshot_loop(display.id);
|
||||
await screenshot_loop(display_id_object.id);
|
||||
e.stopPropagation();
|
||||
}
|
||||
</script>
|
||||
@@ -52,7 +54,7 @@
|
||||
if (e.key === 'Enter' || e.key === ' ') onclick(e);
|
||||
}}
|
||||
{onclick}
|
||||
class="p-1 {get_selectable_color_classes(is_selected(display.id, $selected_display_ids), {
|
||||
class="p-1 {get_selectable_color_classes(is_selected(display_id_object.id, $selected_display_ids), {
|
||||
bg: true,
|
||||
hover: true,
|
||||
active: !hovering_unselectable,
|
||||
@@ -68,12 +70,12 @@
|
||||
onclick={on_preview_click}
|
||||
>
|
||||
<div class="flex h-full w-full items-center justify-center">
|
||||
{#if $pinned_display_id === display.id}
|
||||
{#if $pinned_display_id === display_id_object.id}
|
||||
<div class="size-[50%]">
|
||||
<Pin class="size-full" />
|
||||
</div>
|
||||
{:else if display.preview.url}
|
||||
<img src={display.preview.url} alt="preview" class="w-full object-cover bg-black" />
|
||||
{:else if $display && $display.preview.url}
|
||||
<img src={$display.preview.url} alt="preview" class="w-full object-cover bg-black" />
|
||||
{:else}
|
||||
<!-- No Signal -->
|
||||
<div class="size-full bg-black flex justify-center items-center">
|
||||
@@ -84,11 +86,11 @@
|
||||
|
||||
<!-- Hover Effect -->
|
||||
<span
|
||||
class="pointer-events-none absolute inset-0 {$pinned_display_id === display.id
|
||||
class="pointer-events-none absolute inset-0 {$pinned_display_id === display_id_object.id
|
||||
? 'bg-stone-700'
|
||||
: 'bg-stone-700/70'} opacity-0 transition-opacity duration-200 flex items-center justify-center group-hover:opacity-100"
|
||||
>
|
||||
{#if $pinned_display_id === display.id}
|
||||
{#if $pinned_display_id === display_id_object.id}
|
||||
<PinOff class="size-[50%]" aria-hidden="true" />
|
||||
{:else}
|
||||
<Pin class="size-[50%]" aria-hidden="true" />
|
||||
@@ -100,20 +102,20 @@
|
||||
class="h-full flex flex-col justify-center gap-1 select-none
|
||||
min-w-0 basis-0 flex-1"
|
||||
>
|
||||
<div class="text-xl font-bold truncate w-full" title={display.name}>
|
||||
{display.name}
|
||||
<div class="text-xl font-bold truncate w-full" title={$display?.name ?? ''}>
|
||||
{$display?.name ?? ''}
|
||||
</div>
|
||||
|
||||
<OnlineState
|
||||
selected={is_selected(display.id, $selected_display_ids)}
|
||||
status={display.status}
|
||||
selected={is_selected(display_id_object.id, $selected_display_ids)}
|
||||
status={$display?.status ?? null}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Right Controls -->
|
||||
<div class="flex flex-row h-full items-center gap-2 pr-3">
|
||||
<DNDGrip
|
||||
bg={get_selectable_color_classes(is_selected(display.id, $selected_display_ids), {
|
||||
bg={get_selectable_color_classes(is_selected(display_id_object.id, $selected_display_ids), {
|
||||
bg: true
|
||||
})}
|
||||
/>
|
||||
@@ -125,16 +127,16 @@
|
||||
>
|
||||
<Button
|
||||
bg="bg-transparent"
|
||||
hover_bg={get_selectable_color_classes(is_selected(display.id, $selected_display_ids), {
|
||||
hover_bg={get_selectable_color_classes(is_selected(display_id_object.id, $selected_display_ids), {
|
||||
bg: true
|
||||
})}
|
||||
active_bg={get_selectable_color_classes(is_selected(display.id, $selected_display_ids), {
|
||||
active_bg={get_selectable_color_classes(is_selected(display_id_object.id, $selected_display_ids), {
|
||||
bg: true
|
||||
})}
|
||||
click_function={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
menu_options={get_display_menu_options(display.id)}
|
||||
menu_options={get_display_menu_options(display_id_object.id)}
|
||||
>
|
||||
<Menu />
|
||||
</Button>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
}
|
||||
|
||||
function handle_keydown(event: KeyboardEvent) {
|
||||
if (event.key !== 'Enter') return;
|
||||
if (event.key !== 'Enter' || !current_valid) return;
|
||||
|
||||
if (enter_mode === 'focus_next') {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -22,7 +22,10 @@ export async function open_file(ip: string, path_to_file: string): Promise<void>
|
||||
await request_display(ip, get_sanitized_file_url(path_to_file), options);
|
||||
}
|
||||
|
||||
export async function send_keyboard_input(ip: string, inputs: { key: string; action: 'press' | 'release'}[]): Promise<void> {
|
||||
export async function send_keyboard_input(
|
||||
ip: string,
|
||||
inputs: { key: string; action: 'press' | 'release' }[]
|
||||
): Promise<void> {
|
||||
const options = {
|
||||
method: 'PATCH',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
@@ -294,7 +297,7 @@ async function run_shell_command(ip: string, command: string): Promise<RequestRe
|
||||
}
|
||||
|
||||
export async function shutdown(ip: string): Promise<RequestResponse> {
|
||||
return await run_shell_command(ip, 'shutdown -h now');
|
||||
return await run_shell_command(ip, 'xfce4-session-logout --halt');
|
||||
}
|
||||
|
||||
export async function startup(mac: string): Promise<RequestResponse> {
|
||||
|
||||
@@ -2,9 +2,10 @@ import { db } from './database';
|
||||
import { get_display_by_id } from './stores/displays';
|
||||
import {
|
||||
get_current_folder_elements,
|
||||
create_path_on_all_selected_displays,
|
||||
get_file_by_id,
|
||||
remove_all_files_without_display,
|
||||
remove_file_from_display
|
||||
remove_file_from_display_recusively
|
||||
} from './stores/files';
|
||||
import { notifications } from './stores/notification';
|
||||
import { generate_thumbnail } from './stores/thumbnails';
|
||||
@@ -28,6 +29,8 @@ export async function add_upload(
|
||||
) {
|
||||
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);
|
||||
|
||||
const used_file_names: string[] = await (
|
||||
await get_current_folder_elements(current_file_path, selected_display_ids)
|
||||
).map((e) => e.name);
|
||||
@@ -199,19 +202,10 @@ function generate_valid_file_name(original_file_name: string, used_file_names: s
|
||||
|
||||
async function upload(task: FileTransferTask): Promise<void> {
|
||||
const task_data = task.data;
|
||||
if (task_data.type !== 'upload' || !task_data.file) return console.warn('Task cancelled: wrong task type:', task);
|
||||
if (task_data.type !== 'upload' || !task_data.file)
|
||||
return console.warn('Task cancelled: wrong task type:', task);
|
||||
|
||||
await upload_file_via_xhr(task, task.display, task_data.file);
|
||||
|
||||
// Generate Thumbnail if not done already
|
||||
setTimeout(async () => {
|
||||
const inode_element: Inode | undefined = await db.files.get(
|
||||
JSON.parse(task.file_primary_key) as [string, string, number, string]
|
||||
);
|
||||
if (!!inode_element && inode_element.thumbnail === null) {
|
||||
await generate_thumbnail(task.display.ip, task.path, inode_element);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
export async function sync(task: FileTransferTask) {
|
||||
@@ -271,7 +265,8 @@ export async function download_file(selected_file_id: string, selected_display_i
|
||||
selected_file_id,
|
||||
selected_display_ids
|
||||
);
|
||||
if (!file_data || file_data.file.type === 'inode/directory') return console.warn('Download cancelled: is folder');
|
||||
if (!file_data || file_data.file.type === 'inode/directory')
|
||||
return console.warn('Download cancelled: is folder');
|
||||
|
||||
try {
|
||||
const url = `http://${file_data.short_display_with_file.ip}:1323/api${get_sanitized_file_url(file_data.file.path + file_data.file.name)}`;
|
||||
@@ -301,12 +296,10 @@ async function start_task_processing() {
|
||||
|
||||
async function start_task_loop() {
|
||||
while (tasks.length > 0) {
|
||||
console.log('NOCH', tasks.length, 'ZU TUN');
|
||||
const current_task = tasks[0];
|
||||
if (current_task.data.type === 'upload') {
|
||||
await upload(current_task);
|
||||
}
|
||||
else if (current_task.data.type === 'sync') {
|
||||
} else if (current_task.data.type === 'sync') {
|
||||
await sync(current_task);
|
||||
}
|
||||
tasks.shift(); // Remove current_task from tasks
|
||||
@@ -314,8 +307,13 @@ async function start_task_loop() {
|
||||
is_processing = false;
|
||||
}
|
||||
|
||||
async function upload_file_via_xhr(task: FileTransferTask, current_short_display: ShortDisplay, current_file: File) {
|
||||
async function upload_file_via_xhr(
|
||||
task: FileTransferTask,
|
||||
current_short_display: ShortDisplay,
|
||||
current_file: File
|
||||
) {
|
||||
const start_time = new Date();
|
||||
const loading_type = task.data.type === 'upload' ? 'upload' : 'sync_upload';
|
||||
|
||||
return new Promise<void>((resolve) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
@@ -328,7 +326,13 @@ async function upload_file_via_xhr(task: FileTransferTask, current_short_display
|
||||
|
||||
xhr.upload.onprogress = (e) => {
|
||||
const apply = async () => {
|
||||
await update_current_loading_data(task.data.type === 'upload' ? 'upload' : 'sync_upload', task, e.loaded, start_time, current_short_display.id);
|
||||
await update_current_loading_data(
|
||||
loading_type,
|
||||
task,
|
||||
e.loaded,
|
||||
start_time,
|
||||
current_short_display.id
|
||||
);
|
||||
};
|
||||
apply();
|
||||
};
|
||||
@@ -341,9 +345,20 @@ async function upload_file_via_xhr(task: FileTransferTask, current_short_display
|
||||
xhr.onreadystatechange = async () => {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status == 200) {
|
||||
await db.files_on_display.update([current_short_display.ip, task.file_primary_key], {
|
||||
// set loading_data to 100%
|
||||
await db.files_on_display.update([current_short_display.id, task.file_primary_key], {
|
||||
date_created: new Date(),
|
||||
loading_data: null
|
||||
}); // TODO: Stattdessen update machen und gucken, ob die Datei wirklich da ist
|
||||
});
|
||||
// Generate Thumbnail if not done already
|
||||
setTimeout(async () => {
|
||||
const inode_element: Inode | undefined = await db.files.get(
|
||||
JSON.parse(task.file_primary_key) as [string, string, number, string]
|
||||
);
|
||||
if (!!inode_element && inode_element.thumbnail === null) {
|
||||
await generate_thumbnail(task.display.ip, task.path, inode_element);
|
||||
}
|
||||
}, 10);
|
||||
} else {
|
||||
await show_error(task, `HTTP ${xhr.status}`);
|
||||
}
|
||||
@@ -352,21 +367,33 @@ async function upload_file_via_xhr(task: FileTransferTask, current_short_display
|
||||
};
|
||||
|
||||
xhr.send(current_file);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async function update_current_loading_data(type: FileLoadingData['type'], task: FileTransferTask, current_bytes: number, start_time: Date, other_display_id: string | null = null) {
|
||||
const current_percentage = task.bytes_total > 0 ? Math.round((current_bytes / task.bytes_total) * 100) : 1;
|
||||
async function update_current_loading_data(
|
||||
type: FileLoadingData['type'],
|
||||
task: FileTransferTask,
|
||||
current_bytes: number,
|
||||
start_time: Date,
|
||||
other_display_id: string | null = null
|
||||
) {
|
||||
const current_percentage = Math.min(
|
||||
task.bytes_total > 0 ? Math.round((current_bytes / task.bytes_total) * 100) : 1,
|
||||
99
|
||||
); // calculate percantage, but maximum value is 99%
|
||||
const prognosed_data = get_prognosed_data(start_time, current_bytes, task.bytes_total);
|
||||
|
||||
await db.files_on_display.update([other_display_id ? other_display_id : task.display.id, task.file_primary_key], {
|
||||
loading_data: {
|
||||
type,
|
||||
percentage: current_percentage,
|
||||
bytes_per_second: prognosed_data.bytes_per_second,
|
||||
seconds_until_finish: prognosed_data.seconds_until_finish
|
||||
await db.files_on_display.update(
|
||||
[other_display_id ? other_display_id : task.display.id, task.file_primary_key],
|
||||
{
|
||||
loading_data: {
|
||||
type,
|
||||
percentage: current_percentage,
|
||||
bytes_per_second: prognosed_data.bytes_per_second,
|
||||
seconds_until_finish: prognosed_data.seconds_until_finish
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
function get_prognosed_data(
|
||||
@@ -390,11 +417,11 @@ async function show_error(task: FileTransferTask, error: ProgressEvent | string)
|
||||
`Datei: "${task.file_name}", Display-IP: ${task.display.ip}\nFehler: ${error}`
|
||||
);
|
||||
if (task_data.type === 'upload') {
|
||||
await remove_file_from_display(task.display.id, task.file_primary_key);
|
||||
await remove_file_from_display_recusively(task.display.id, task.file_primary_key);
|
||||
await remove_all_files_without_display();
|
||||
} else if (task_data.type === 'sync') {
|
||||
for (const display_id of task_data.destination_displays.map((e) => e.id)) {
|
||||
await remove_file_from_display(display_id, task.file_primary_key);
|
||||
await remove_file_from_display_recusively(display_id, task.file_primary_key);
|
||||
}
|
||||
await remove_all_files_without_display();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
import { get } from 'svelte/store';
|
||||
import type { Display, DisplayGroup, DisplayStatus } from '../types';
|
||||
import { get, writable, type Writable } from 'svelte/store';
|
||||
import type {
|
||||
Display,
|
||||
DisplayGroup,
|
||||
DisplayIdGroup,
|
||||
DisplayIdObject,
|
||||
DisplayStatus
|
||||
} from '../types';
|
||||
import { is_selected, select, selected_display_ids } from './select';
|
||||
import { get_uuid, image_content_hash } from '../utils';
|
||||
import { get_screenshot } from '../api_handler';
|
||||
import { delete_and_deselect_unique_files_from_display } from './files';
|
||||
import { db } from '../database';
|
||||
import { dev } from '$app/environment';
|
||||
|
||||
export const local_displays: Writable<DisplayIdGroup[]> = writable<DisplayIdGroup[]>([]);
|
||||
|
||||
export async function is_display_name_taken(name: string): Promise<boolean> {
|
||||
const exists = await db.displays.where('name').equals(name).first();
|
||||
@@ -168,30 +177,63 @@ export async function get_display_groups(): Promise<DisplayGroup[]> {
|
||||
return await db.display_groups.orderBy('position').toArray();
|
||||
}
|
||||
|
||||
export async function get_display_ids_in_group(display_group_id: string): Promise<Display[]> {
|
||||
const displays: Display[] = await db.displays
|
||||
.where('group_id')
|
||||
.equals(display_group_id)
|
||||
.sortBy('position');
|
||||
return displays;
|
||||
export async function update_local_displays() {
|
||||
const display_groups = await db.display_groups.orderBy('position').toArray();
|
||||
const displays = await db.displays.orderBy('position').toArray();
|
||||
const out: DisplayIdGroup[] = [];
|
||||
for (const group of display_groups) {
|
||||
out.push({
|
||||
id: group.id,
|
||||
displays: (await displays).filter((d) => d.group_id === group.id).map((d) => ({ id: d.id }))
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export async function set_new_display_order(new_ordered_items: Display[]) {
|
||||
for (let i = 0; i < new_ordered_items.length; i++) {
|
||||
new_ordered_items[i].position = i;
|
||||
await db.displays.put(new_ordered_items[i]);
|
||||
export async function update_db_displays() {
|
||||
local_displays.update((groups) => groups.filter((g) => g.displays.length !== 0));
|
||||
const filtered_local_display_groups = get(local_displays)
|
||||
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 display_group_ids_to_delete = db_display_group_ids.filter(
|
||||
(group) => !local_display_group_ids.includes(group)
|
||||
);
|
||||
await db.display_groups.where('id').anyOf(display_group_ids_to_delete).delete();
|
||||
|
||||
for (let i = 0; i < filtered_local_display_groups.length; i++) {
|
||||
const group = filtered_local_display_groups[i];
|
||||
if (db_display_group_ids.includes(group.id)) {
|
||||
await db.display_groups.update(group.id, { position: i });
|
||||
} else {
|
||||
await db.display_groups.put({
|
||||
id: group.id,
|
||||
position: i
|
||||
});
|
||||
}
|
||||
|
||||
for (let j = 0; j < group.displays.length; j++) {
|
||||
const display_id = group.displays[j].id;
|
||||
await db.displays.update(display_id, { position: j, group_id: group.id });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function set_new_display_group_order(new_ordered_items: DisplayGroup[]) {
|
||||
for (let i = 0; i < new_ordered_items.length; i++) {
|
||||
new_ordered_items[i].position = i;
|
||||
await db.display_groups.put(new_ordered_items[i]);
|
||||
}
|
||||
export function set_new_display_order(display_id_group_id: string, new_data: DisplayIdObject[]) {
|
||||
local_displays.update((local_displays: DisplayIdGroup[]) => {
|
||||
for (const display_id_group of local_displays) {
|
||||
if (display_id_group.id === display_id_group_id) {
|
||||
display_id_group.displays = new_data;
|
||||
}
|
||||
}
|
||||
return local_displays;
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(add_testing_displays, 0);
|
||||
async function add_testing_displays() {
|
||||
await add_display('127.0.0.1', '00:1A:2B:3C:4D:5E', 'PC', 'host_offline');
|
||||
// await add_display("192.168.178.111", "D4:81:D7:C0:DF:3C", "Laptop", "host_offline");
|
||||
if (dev) {
|
||||
setTimeout(add_testing_displays, 0);
|
||||
async function add_testing_displays() {
|
||||
await add_display('127.0.0.1', '00:1A:2B:3C:4D:5E', 'PC', 'host_offline');
|
||||
// await add_display("192.168.178.111", "D4:81:D7:C0:DF:3C", "Laptop", "host_offline");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,16 +42,35 @@ export async function delete_and_deselect_unique_files_from_display(display_id:
|
||||
.equals(display_id)
|
||||
.toArray();
|
||||
for (const file of files_on_display) {
|
||||
await remove_file_from_display(display_id, file.file_primary_key);
|
||||
await remove_file_from_display_recusively(display_id, file.file_primary_key);
|
||||
}
|
||||
await remove_all_files_without_display();
|
||||
}
|
||||
|
||||
export async function remove_file_from_display(display_id: string, file_primary_key: string) {
|
||||
export async function remove_file_from_display_recusively(display_id: string, file_primary_key: string) {
|
||||
const found = await db.files_on_display.get([display_id, file_primary_key]);
|
||||
if (!found) return;
|
||||
select(selected_file_ids, file_primary_key, 'deselect');
|
||||
await db.files_on_display.delete([display_id, file_primary_key]);
|
||||
|
||||
const inode_element = await get_file_by_id(found.file_primary_key);
|
||||
if (!inode_element) return;
|
||||
if (inode_element.type === 'inode/directory') {
|
||||
const path_inside_folder = inode_element.path + inode_element.name + `/`;
|
||||
const primary_file_keys_in_folder = (
|
||||
await db.files.where('path').equals(path_inside_folder).toArray()
|
||||
).map((e) => get_file_primary_key(e));
|
||||
const primary_file_keys_in_folder_on_display = (
|
||||
await db.files_on_display
|
||||
.where('file_primary_key')
|
||||
.anyOf(primary_file_keys_in_folder)
|
||||
.filter((file) => file.display_id === display_id)
|
||||
.toArray()
|
||||
).map((e) => e.file_primary_key);
|
||||
for (const file_key of primary_file_keys_in_folder_on_display) {
|
||||
await remove_file_from_display_recusively(display_id, file_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function remove_all_files_without_display() {
|
||||
@@ -125,19 +144,23 @@ export async function get_displays_where_path_exists(
|
||||
const path_without_last_part = path.slice(0, path.length - (last_path_part.length + 1));
|
||||
|
||||
const folders_of_current_path = await db.files
|
||||
.where('[path+name+type]')
|
||||
.equals([path_without_last_part, last_path_part, 'inode/directory'])
|
||||
.where('name')
|
||||
.equals(last_path_part)
|
||||
.filter((inode) => inode.path === path_without_last_part && inode.type === 'inode/directory')
|
||||
.first();
|
||||
if (!folders_of_current_path)
|
||||
return await db.displays.where('id').anyOf(selected_display_ids).toArray();
|
||||
const folder_primary_key = get_file_primary_key(folders_of_current_path);
|
||||
|
||||
const display_ids = selected_display_ids.filter(async (display_id) => {
|
||||
const folder_exists = await db.files_on_display.get([display_id, folder_primary_key]);
|
||||
const display_ids_with_folder = (
|
||||
await db.files_on_display.where('file_primary_key').equals(folder_primary_key).toArray()
|
||||
).map((fod) => fod.display_id);
|
||||
|
||||
const display_ids = selected_display_ids.filter((display_id) => {
|
||||
if (invert) {
|
||||
return !folder_exists;
|
||||
return !display_ids_with_folder.includes(display_id);
|
||||
} else {
|
||||
return folder_exists;
|
||||
return display_ids_with_folder.includes(display_id);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -211,17 +234,30 @@ export async function update_folder_elements_recursively(
|
||||
const new_folder_elements = await get_file_data(display.ip, file_path);
|
||||
if (!new_folder_elements) return;
|
||||
|
||||
const existing_file_keys_on_display_in_path: [string, string, number, string][] = (
|
||||
await db.files_on_display.where('display_id').equals(display.id).toArray()
|
||||
).map((e) => JSON.parse(e.file_primary_key) as [string, string, number, string]);
|
||||
const existing_files_on_display_in_path: Inode[] = await db.files
|
||||
const existing_files_on_display_in_path: FileOnDisplay[] = await db.files_on_display
|
||||
.where('display_id')
|
||||
.equals(display.id)
|
||||
.toArray();
|
||||
const existing_file_keys_on_display_in_path: [string, string, number, string][] =
|
||||
existing_files_on_display_in_path.map(
|
||||
(e) => JSON.parse(e.file_primary_key) as [string, string, number, string]
|
||||
);
|
||||
const existing_files: Inode[] = await db.files
|
||||
.where('[path+name+size+type]')
|
||||
.anyOf(existing_file_keys_on_display_in_path)
|
||||
.filter((e) => e.path === file_path)
|
||||
.toArray();
|
||||
|
||||
const existing_files_with_loading_state: { folder_element: Inode; is_loading: boolean }[] =
|
||||
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(
|
||||
existing_files_on_display_in_path,
|
||||
existing_files_with_loading_state,
|
||||
new_folder_elements
|
||||
);
|
||||
|
||||
@@ -255,20 +291,22 @@ export async function update_folder_elements_recursively(
|
||||
if (diff.deleted.length > 0) {
|
||||
// Remove old Folder-Elements
|
||||
for (const old_element of diff.deleted) {
|
||||
remove_file_from_display(display.id, get_file_primary_key(old_element));
|
||||
remove_file_from_display_recusively(display.id, get_file_primary_key(old_element));
|
||||
}
|
||||
await remove_all_files_without_display();
|
||||
}
|
||||
}
|
||||
|
||||
function get_folder_elements_difference(
|
||||
old_elements: Inode[],
|
||||
old_elements: { folder_element: Inode; is_loading: boolean }[],
|
||||
new_elements: { 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)));
|
||||
const old_keys = new Set(old_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.filter((e) => !new_keys.has(get_file_primary_key(e)));
|
||||
const only_in_old = old_elements
|
||||
.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(
|
||||
(e) => !old_keys.has(get_file_primary_key(e.folder_element))
|
||||
);
|
||||
@@ -358,6 +396,14 @@ export async function create_folder_on_all_selected_displays(
|
||||
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(
|
||||
path: string,
|
||||
selected_display_ids: string[]
|
||||
) {
|
||||
const path_parts = path
|
||||
.slice(1, path.length - 1)
|
||||
.split('/')
|
||||
@@ -378,9 +424,8 @@ export async function create_folder_on_all_selected_displays(
|
||||
const displays = await getDisplaysForPath(currentPath);
|
||||
if (!displays.length) continue;
|
||||
|
||||
const folders_to_create = [...path_parts.slice(depth), folder_name];
|
||||
for (const display of displays) {
|
||||
await create_folders(display.ip, currentPath, folders_to_create);
|
||||
await create_folders(display.ip, currentPath, path_parts.slice(depth));
|
||||
remaining_display_ids = remaining_display_ids.filter((id) => id !== display.id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +1,71 @@
|
||||
import { writable, type Writable } from "svelte/store";
|
||||
import { writable, type Writable } from 'svelte/store';
|
||||
|
||||
export const dnd_flip_duration_ms = 300;
|
||||
|
||||
const heights_options: Record<string, { min: number; max: number; step: number }> = {
|
||||
display: {
|
||||
min: 15,
|
||||
max: 40,
|
||||
step: 5,
|
||||
},
|
||||
file: {
|
||||
min: 10,
|
||||
max: 20,
|
||||
step: 5,
|
||||
}
|
||||
}
|
||||
display: {
|
||||
min: 15,
|
||||
max: 40,
|
||||
step: 5
|
||||
},
|
||||
file: {
|
||||
min: 10,
|
||||
max: 20,
|
||||
step: 5
|
||||
}
|
||||
};
|
||||
|
||||
export const current_height: Writable<Record<string, number>> = writable<Record<string, number>>({
|
||||
display: 25,
|
||||
file: 10,
|
||||
display: 25,
|
||||
file: 10
|
||||
});
|
||||
|
||||
|
||||
export const is_group_drag: Writable<boolean> = writable<boolean>(false);
|
||||
export const is_display_drag: Writable<boolean> = writable<boolean>(false);
|
||||
|
||||
export const pinned_display_id: Writable<string | null> = writable<string | null>(null);
|
||||
|
||||
|
||||
export function change_height(key: 'display' | 'file', factor: number) {
|
||||
current_height.update((height) => {
|
||||
height[key] = next_height_step_size(key, height, factor) || height[key];
|
||||
return height;
|
||||
});
|
||||
current_height.update((height) => {
|
||||
height[key] = next_height_step_size(key, height, factor) || height[key];
|
||||
return height;
|
||||
});
|
||||
}
|
||||
|
||||
export function next_height_step_size(key: 'display' | 'file', current_height_array: Record<string, number>, factor: number): number {
|
||||
const new_size = current_height_array[key] + (factor * heights_options[key].step);
|
||||
if (new_size > heights_options[key].max || new_size < heights_options[key].min) {
|
||||
return 0;
|
||||
} else {
|
||||
return new_size;
|
||||
}
|
||||
export function next_height_step_size(
|
||||
key: 'display' | 'file',
|
||||
current_height_array: Record<string, number>,
|
||||
factor: number
|
||||
): number {
|
||||
const new_size = current_height_array[key] + factor * heights_options[key].step;
|
||||
if (new_size > heights_options[key].max || new_size < heights_options[key].min) {
|
||||
return 0;
|
||||
} else {
|
||||
return new_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export function get_selectable_color_classes(
|
||||
selected: boolean,
|
||||
returning_classes: { bg?: boolean; hover?: boolean; active?: boolean; text?: boolean } = {},
|
||||
base_bg_distance: number = 0,
|
||||
shifted_distance: number = 0
|
||||
selected: boolean,
|
||||
returning_classes: { bg?: boolean; hover?: boolean; active?: boolean; text?: boolean } = {},
|
||||
base_bg_distance: number = 0,
|
||||
shifted_distance: number = 0
|
||||
) {
|
||||
let base_bg = selected ? 'bg-stone-400' : 'bg-stone-600';
|
||||
const base_text = selected ? 'text-stone-950' : 'text-stone-200';
|
||||
base_bg = get_shifted_color(base_bg, base_bg_distance);
|
||||
let base_bg = selected ? 'bg-stone-400' : 'bg-stone-600';
|
||||
const base_text = selected ? 'text-stone-950' : 'text-stone-200';
|
||||
base_bg = get_shifted_color(base_bg, base_bg_distance);
|
||||
|
||||
const { bg = false, hover = false, active = false, text = false } = returning_classes;
|
||||
const { bg = false, hover = false, active = false, text = false } = returning_classes;
|
||||
|
||||
const out: string[] = [];
|
||||
if (bg) out.push(base_bg);
|
||||
if (hover) out.push('hover:' + get_shifted_color(base_bg, 100 + shifted_distance));
|
||||
if (active) out.push('active:' + get_shifted_color(base_bg, 150 + shifted_distance));
|
||||
if (text) out.push(base_text);
|
||||
const out: string[] = [];
|
||||
if (bg) out.push(base_bg);
|
||||
if (hover) out.push('hover:' + get_shifted_color(base_bg, 100 + shifted_distance));
|
||||
if (active) out.push('active:' + get_shifted_color(base_bg, 150 + shifted_distance));
|
||||
if (text) out.push(base_text);
|
||||
|
||||
return out.join(' ');
|
||||
return out.join(' ');
|
||||
}
|
||||
|
||||
export function get_shifted_color(base_color: string, distance: number): string {
|
||||
return base_color.replace(/(\d+)(?=(?:\/\d+)?$)/, (m: string) => String(+Number(m) - distance));
|
||||
return base_color.replace(/(\d+)(?=(?:\/\d+)?$)/, (m: string) => String(+Number(m) - distance));
|
||||
}
|
||||
@@ -37,20 +37,20 @@ export type FileTransferTask = {
|
||||
bytes_total: number; // if type === 'sync' -> bytes_total = file_size * 2 (1x download + 1x upload)
|
||||
};
|
||||
|
||||
export type FileTransferTaskData = {
|
||||
type: 'upload',
|
||||
file: File,
|
||||
} | {
|
||||
type: "sync",
|
||||
destination_displays: ShortDisplay[],
|
||||
}
|
||||
|
||||
export type FileTransferTaskData =
|
||||
| {
|
||||
type: 'upload';
|
||||
file: File;
|
||||
}
|
||||
| {
|
||||
type: 'sync';
|
||||
destination_displays: ShortDisplay[];
|
||||
};
|
||||
|
||||
export type ShortDisplay = {
|
||||
id: string;
|
||||
ip: string;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export type FileOnDisplay = {
|
||||
display_id: string;
|
||||
@@ -64,7 +64,7 @@ export type FileLoadingData = {
|
||||
percentage: number;
|
||||
bytes_per_second: number;
|
||||
seconds_until_finish: number;
|
||||
}
|
||||
};
|
||||
|
||||
export type Inode = {
|
||||
path: string;
|
||||
@@ -101,6 +101,15 @@ export type DisplayGroup = {
|
||||
position: number;
|
||||
};
|
||||
|
||||
export type DisplayIdGroup = {
|
||||
id: string;
|
||||
displays: DisplayIdObject[];
|
||||
};
|
||||
|
||||
export type DisplayIdObject = {
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type PreviewObject = {
|
||||
currently_updating: boolean;
|
||||
url: string | null;
|
||||
|
||||
@@ -1,10 +1,29 @@
|
||||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import Notification from './Notification.svelte';
|
||||
import SplashScreen from './../../../../shared/splash_screen.html?raw';
|
||||
import version from './../../../../shared/version.txt?raw';
|
||||
import { dev } from '$app/environment';
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
let versionSplashScreen = SplashScreen.replaceAll('%%APP-VERSION%%', version.trim());
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>PLG MuDiCS Control</title>
|
||||
</svelte:head>
|
||||
|
||||
{#if !dev}
|
||||
{@html versionSplashScreen}
|
||||
{/if}
|
||||
|
||||
{@render children()}
|
||||
|
||||
<Notification />
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--splash-fade-out-delay: 3.5s !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Monitor, Plus, Radio, Settings, Trash2, X } from 'lucide-svelte';
|
||||
import { Monitor, Plus, Radio, Settings, Trash2, Menu } from 'lucide-svelte';
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import FileView from './FileView.svelte';
|
||||
import ControlView from './ControlView.svelte';
|
||||
@@ -75,6 +75,7 @@
|
||||
title: 'Neuen Bildschirm hinzufügen',
|
||||
title_icon: Monitor,
|
||||
title_class: '!text-xl',
|
||||
window_class: 'w-3xl',
|
||||
closable: true
|
||||
};
|
||||
};
|
||||
@@ -185,7 +186,7 @@
|
||||
<TextInput
|
||||
bind:current_value={text_inputs_valid.mac.value}
|
||||
bind:current_valid={text_inputs_valid.mac.valid}
|
||||
title="MAC-Adresse (optional)"
|
||||
title="MAC-Adresse (optional, wird zum aufwecken des Displays benötigt)"
|
||||
placeholder="z.B. D4:81:A6:C4:BF:3F"
|
||||
is_valid_function={(input: string) => {
|
||||
return input === ''
|
||||
@@ -221,8 +222,6 @@
|
||||
{/snippet}
|
||||
|
||||
<main class="bg-stone-900 h-dvh w-dvw text-stone-200 px-4 py-2 gap-2 grid grid-rows-[3rem_auto]">
|
||||
<!-- {@html SplashScreen} -->
|
||||
|
||||
<div class="w-[calc(100dvw-(8*var(--spacing)))] flex justify-between">
|
||||
<span class="text-4xl font-bold content-center pl-1"> PLG MuDiCS </span>
|
||||
<Button
|
||||
@@ -233,14 +232,10 @@
|
||||
icon: Plus,
|
||||
name: 'Neuen Bildschirm hinzufügen',
|
||||
on_select: show_new_display_popup
|
||||
},
|
||||
{
|
||||
icon: Settings,
|
||||
name: 'Weitere Einstellungen'
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Settings></Settings>
|
||||
<Menu />
|
||||
</Button>
|
||||
</div>
|
||||
<div class="w-[calc(100dvw-(8*var(--spacing)))] grid grid-cols-2 gap-2">
|
||||
|
||||
@@ -20,6 +20,13 @@
|
||||
import { selected_display_ids } from '$lib/ts/stores/select';
|
||||
import TipTapInput from './TipTapInput.svelte';
|
||||
import { db } from '$lib/ts/database';
|
||||
import { liveQuery, type Observable } from 'dexie';
|
||||
|
||||
let all_display_states: Observable<'on' | 'off' | 'mixed'> | undefined = $state();
|
||||
$effect(() => {
|
||||
const ids = $selected_display_ids;
|
||||
all_display_states = liveQuery(() => all_state(ids));
|
||||
});
|
||||
|
||||
let popup_content: PopupContent = $state({
|
||||
open: false,
|
||||
@@ -115,7 +122,7 @@
|
||||
<p>Bist du sicher, dass du alle ausgewählten Displays herunterfahren möchtest?</p>
|
||||
|
||||
<div class="flex flex-row justify-end gap-2">
|
||||
<Button className="button space" click_function={() => (popup_content.open = false)}>
|
||||
<Button className="button space font-bold" click_function={() => (popup_content.open = false)}>
|
||||
Abbrechen
|
||||
</Button>
|
||||
<Button click_function={shutdown_action} className="button error space">Herunterfahren</Button>
|
||||
@@ -162,11 +169,13 @@
|
||||
}}><ArrowBigRight /></Button
|
||||
>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
className="px-3 flex gap-3 w-75 justify-normal"
|
||||
disabled={$selected_display_ids.length === 0}
|
||||
click_function={show_text_popup}><TextAlignStart /> Text anzeigen</Button
|
||||
>
|
||||
|
||||
<Button
|
||||
className="px-3 flex gap-3 w-75 justify-normal"
|
||||
disabled={$selected_display_ids.length === 0}
|
||||
@@ -174,14 +183,14 @@
|
||||
await run_on_all_selected_displays((d) => show_blackscreen(d.ip));
|
||||
}}><Presentation />Blackout</Button
|
||||
>
|
||||
|
||||
<div class="flex flex-row justify-normal">
|
||||
<Button
|
||||
className="rounded-r-none pl-3 flex gap-3 grow w-65 justify-normal"
|
||||
disabled={$selected_display_ids.length === 0}
|
||||
><TrafficCone /> Fallback-Bild anzeigen</Button
|
||||
>
|
||||
<Button className="rounded-l-none flex grow-0 w-10"><ChevronDown /></Button>
|
||||
<Button className="rounded-r-none pl-3 flex gap-3 grow w-65 justify-normal" disabled>
|
||||
<TrafficCone /> Fallback-Bild anzeigen
|
||||
</Button>
|
||||
<Button className="rounded-l-none flex grow-0 w-10" disabled><ChevronDown /></Button>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
className="px-3 flex gap-3 w-75 justify-normal"
|
||||
disabled={$selected_display_ids.length === 0}
|
||||
@@ -190,29 +199,26 @@
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 justify-between">
|
||||
<div class="flex flex-col gap-2">
|
||||
{#await all_state($selected_display_ids) then all}
|
||||
<Button
|
||||
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
||||
disabled={all === 'on' || $selected_display_ids.length === 0}
|
||||
click_function={startup_action}
|
||||
>
|
||||
<Power /> PC hochfahren
|
||||
</Button>
|
||||
<Button
|
||||
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
||||
disabled={$all_display_states === 'on' || $selected_display_ids.length === 0}
|
||||
click_function={startup_action}
|
||||
>
|
||||
<Power /> PC hochfahren
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
||||
disabled={all === 'off' || $selected_display_ids.length === 0}
|
||||
click_function={ask_shutdonw}
|
||||
>
|
||||
<PowerOff /> PC herunterfahren</Button
|
||||
>
|
||||
{/await}
|
||||
<Button
|
||||
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
||||
disabled={$all_display_states === 'off' || $selected_display_ids.length === 0}
|
||||
click_function={ask_shutdonw}
|
||||
>
|
||||
<PowerOff /> PC herunterfahren</Button
|
||||
>
|
||||
</div>
|
||||
<Button
|
||||
className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
|
||||
disabled={$selected_display_ids.length === 0}
|
||||
><SquareTerminal /> Shell-Befehl ausführen</Button
|
||||
>
|
||||
<Button className="px-3 flex gap-3 w-full xl:w-75 justify-normal" disabled>
|
||||
<SquareTerminal />
|
||||
Shell-Befehl ausführen
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<PopUp
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
import {
|
||||
all_displays_of_group_selected,
|
||||
get_display_by_id,
|
||||
get_display_groups,
|
||||
set_select_for_group,
|
||||
set_new_display_group_order
|
||||
local_displays,
|
||||
update_local_displays,
|
||||
update_db_displays,
|
||||
get_display_groups
|
||||
} from '$lib/ts/stores/displays';
|
||||
import {
|
||||
change_height,
|
||||
@@ -19,15 +21,16 @@
|
||||
import { type Display, type DisplayGroup, type MenuOption } from '$lib/ts/types';
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import OnlineState from '../lib/components/OnlineState.svelte';
|
||||
import { cubicOut } from 'svelte/easing';
|
||||
import { Menu, Pencil, PinOff, Settings, Trash2, VideoOff, ZoomIn, ZoomOut } from 'lucide-svelte';
|
||||
import { Menu, Pencil, PinOff, Trash2, VideoOff, ZoomIn, ZoomOut } from 'lucide-svelte';
|
||||
import { selected_display_ids } from '$lib/ts/stores/select';
|
||||
import { dragHandleZone } from 'svelte-dnd-action';
|
||||
import { flip } from 'svelte/animate';
|
||||
import DisplayGroupObject from '../lib/components/DisplayGroupObject.svelte';
|
||||
import { Pane, Splitpanes } from 'svelte-splitpanes';
|
||||
import HighlightedText from '$lib/components/HighlightedText.svelte';
|
||||
import { liveQuery, type Observable } from 'dexie';
|
||||
import { onMount } from 'svelte';
|
||||
import { flip } from 'svelte/animate';
|
||||
import { cubicOut } from 'svelte/easing';
|
||||
|
||||
let {
|
||||
handle_display_deletion,
|
||||
@@ -43,7 +46,16 @@
|
||||
const pdi = $pinned_display_id;
|
||||
pinned_display = liveQuery(() => get_display_by_id(pdi || ''));
|
||||
});
|
||||
|
||||
let display_groups = liveQuery(() => get_display_groups());
|
||||
let display_id_groups = liveQuery(() => update_local_displays());
|
||||
$effect(() => {
|
||||
const current_displays = $display_id_groups;
|
||||
if (!$is_group_drag && !$is_display_drag && current_displays) {
|
||||
$local_displays = current_displays;
|
||||
}
|
||||
});
|
||||
|
||||
let all_groups_selected: Observable<boolean> | undefined = $state();
|
||||
$effect(() => {
|
||||
const d = $display_groups;
|
||||
@@ -234,51 +246,50 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="min-h-0 overflow-y-auto" bind:this={displays_scroll_box}>
|
||||
<div
|
||||
class="min-h-full p-2 flex flex-col gap-4"
|
||||
use:dragHandleZone={{
|
||||
items: $display_groups || [],
|
||||
type: 'group',
|
||||
flipDurationMs: dnd_flip_duration_ms,
|
||||
dropFromOthersDisabled: true,
|
||||
dropTargetStyle: { outline: 'none' }
|
||||
}}
|
||||
onconsider={async (e: CustomEvent) => {
|
||||
$is_group_drag = true;
|
||||
await set_new_display_group_order(e.detail.items);
|
||||
}}
|
||||
onfinalize={async (e: CustomEvent) => {
|
||||
await set_new_display_group_order(e.detail.items);
|
||||
$is_group_drag = false;
|
||||
}}
|
||||
>
|
||||
{#if ($display_groups || []).length === 0}
|
||||
<div class="text-stone-500 px-10 py-6 leading-relaxed text-center">
|
||||
Es wurden noch keine Bildschirme hinzugefügt. Klicke oben rechts auf
|
||||
<HighlightedText fg="text-stone-450" className="p-1!"
|
||||
><Settings class="inline pb-1" /></HighlightedText
|
||||
>
|
||||
und
|
||||
<HighlightedText fg="text-stone-450">Neuen Bildschirm hinzufügen</HighlightedText>.
|
||||
</div>
|
||||
{:else}
|
||||
{#each $display_groups || [] as display_group (display_group.id)}
|
||||
<div class="min-h-0 overflow-y-auto overflow-x-hidden" bind:this={displays_scroll_box}>
|
||||
{#if $local_displays.length === 0}
|
||||
<div class="text-stone-500 px-10 py-6 leading-relaxed text-center">
|
||||
Es wurden noch keine Bildschirme hinzugefügt. Klicke oben rechts auf
|
||||
<HighlightedText fg="text-stone-450" className="p-1!">
|
||||
<Menu class="inline pb-1" />
|
||||
</HighlightedText>
|
||||
und
|
||||
<HighlightedText fg="text-stone-450">Neuen Bildschirm hinzufügen</HighlightedText>.
|
||||
</div>
|
||||
{:else}
|
||||
<div
|
||||
class="min-h-full p-2 flex flex-col gap-4"
|
||||
use:dragHandleZone={{
|
||||
items: $local_displays,
|
||||
type: 'group',
|
||||
flipDurationMs: dnd_flip_duration_ms,
|
||||
dropFromOthersDisabled: true,
|
||||
dropTargetStyle: { outline: 'none' }
|
||||
}}
|
||||
onconsider={(e: CustomEvent) => {
|
||||
$is_group_drag = true;
|
||||
$local_displays = e.detail.items;
|
||||
}}
|
||||
onfinalize={async (e: CustomEvent) => {
|
||||
$local_displays = e.detail.items;
|
||||
await update_db_displays();
|
||||
$is_group_drag = false;
|
||||
}}
|
||||
>
|
||||
{#each $local_displays as display_id_group (display_id_group.id)}
|
||||
<!-- Each Group -->
|
||||
<section
|
||||
out:scale={{ duration: dnd_flip_duration_ms, easing: cubicOut }}
|
||||
animate:flip={{ duration: dnd_flip_duration_ms, easing: cubicOut }}
|
||||
class="outline-none"
|
||||
>
|
||||
<section class="outline-none">
|
||||
<!-- out:scale={{ duration: dnd_flip_duration_ms, easing: cubicOut }}
|
||||
animate:flip={{ duration: dnd_flip_duration_ms, easing: cubicOut }} -->
|
||||
<DisplayGroupObject
|
||||
display_group_id={display_group.id}
|
||||
{display_id_group}
|
||||
{get_display_menu_options}
|
||||
{close_pinned_display}
|
||||
/>
|
||||
</section>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</Pane>
|
||||
|
||||
@@ -363,7 +363,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="min-h-0 h-full overflow-y-auto 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">
|
||||
{#if $selected_display_ids.length === 0}
|
||||
<span class="text-stone-450 px-10 py-6 leading-relaxed text-center">
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
>
|
||||
</div>
|
||||
|
||||
<span class="whitespace-break-spaces max-h-[60vh] overflow-y-auto">{n.message}</span>
|
||||
<span class="max-h-[60vh] overflow-y-auto overflow-x-hidden whitespace-pre-line max-w-full break-normal wrap-anywhere">{n.message}</span>
|
||||
|
||||
<div class="absolute inset-x-0 bottom-0 h-1 bg-white/25">
|
||||
<div class="block h-full w-full bg-white/80 origin-left animate-progress-bar"></div>
|
||||
|
||||
@@ -66,12 +66,6 @@
|
||||
is_selected: () => editor_state.editor?.isActive('strike') ?? false,
|
||||
title: 'Durchgestrichen',
|
||||
icon: Strikethrough
|
||||
},
|
||||
{
|
||||
onclick: () => {},
|
||||
is_selected: () => false,
|
||||
title: 'QR-Code anfügen',
|
||||
icon: QrCode
|
||||
}
|
||||
],
|
||||
[
|
||||
|
||||
@@ -1,221 +1,221 @@
|
||||
module.exports = {
|
||||
content: ['./src/**/*.{html,js,svelte,ts}'],
|
||||
safelist: [
|
||||
'bg-stone-50',
|
||||
'bg-stone-100',
|
||||
'bg-stone-150',
|
||||
'bg-stone-200',
|
||||
'bg-stone-250',
|
||||
'bg-stone-300',
|
||||
'bg-stone-350',
|
||||
'bg-stone-400',
|
||||
'bg-stone-450',
|
||||
'bg-stone-500',
|
||||
'bg-stone-550',
|
||||
'bg-stone-600',
|
||||
'bg-stone-650',
|
||||
'bg-stone-700',
|
||||
'bg-stone-750',
|
||||
'bg-stone-800',
|
||||
'bg-stone-850',
|
||||
'bg-stone-900',
|
||||
'bg-stone-950',
|
||||
content: ['./src/**/*.{html,js,svelte,ts}'],
|
||||
safelist: [
|
||||
'bg-stone-50',
|
||||
'bg-stone-100',
|
||||
'bg-stone-150',
|
||||
'bg-stone-200',
|
||||
'bg-stone-250',
|
||||
'bg-stone-300',
|
||||
'bg-stone-350',
|
||||
'bg-stone-400',
|
||||
'bg-stone-450',
|
||||
'bg-stone-500',
|
||||
'bg-stone-550',
|
||||
'bg-stone-600',
|
||||
'bg-stone-650',
|
||||
'bg-stone-700',
|
||||
'bg-stone-750',
|
||||
'bg-stone-800',
|
||||
'bg-stone-850',
|
||||
'bg-stone-900',
|
||||
'bg-stone-950',
|
||||
|
||||
'hover:bg-stone-50',
|
||||
'hover:bg-stone-100',
|
||||
'hover:bg-stone-150',
|
||||
'hover:bg-stone-200',
|
||||
'hover:bg-stone-250',
|
||||
'hover:bg-stone-300',
|
||||
'hover:bg-stone-350',
|
||||
'hover:bg-stone-400',
|
||||
'hover:bg-stone-450',
|
||||
'hover:bg-stone-500',
|
||||
'hover:bg-stone-550',
|
||||
'hover:bg-stone-600',
|
||||
'hover:bg-stone-650',
|
||||
'hover:bg-stone-700',
|
||||
'hover:bg-stone-750',
|
||||
'hover:bg-stone-800',
|
||||
'hover:bg-stone-850',
|
||||
'hover:bg-stone-900',
|
||||
'hover:bg-stone-950',
|
||||
'hover:bg-stone-50',
|
||||
'hover:bg-stone-100',
|
||||
'hover:bg-stone-150',
|
||||
'hover:bg-stone-200',
|
||||
'hover:bg-stone-250',
|
||||
'hover:bg-stone-300',
|
||||
'hover:bg-stone-350',
|
||||
'hover:bg-stone-400',
|
||||
'hover:bg-stone-450',
|
||||
'hover:bg-stone-500',
|
||||
'hover:bg-stone-550',
|
||||
'hover:bg-stone-600',
|
||||
'hover:bg-stone-650',
|
||||
'hover:bg-stone-700',
|
||||
'hover:bg-stone-750',
|
||||
'hover:bg-stone-800',
|
||||
'hover:bg-stone-850',
|
||||
'hover:bg-stone-900',
|
||||
'hover:bg-stone-950',
|
||||
|
||||
'active:bg-stone-50',
|
||||
'active:bg-stone-100',
|
||||
'active:bg-stone-150',
|
||||
'active:bg-stone-200',
|
||||
'active:bg-stone-250',
|
||||
'active:bg-stone-300',
|
||||
'active:bg-stone-350',
|
||||
'active:bg-stone-400',
|
||||
'active:bg-stone-450',
|
||||
'active:bg-stone-500',
|
||||
'active:bg-stone-550',
|
||||
'active:bg-stone-600',
|
||||
'active:bg-stone-650',
|
||||
'active:bg-stone-700',
|
||||
'active:bg-stone-750',
|
||||
'active:bg-stone-800',
|
||||
'active:bg-stone-850',
|
||||
'active:bg-stone-900',
|
||||
'active:bg-stone-950',
|
||||
'active:bg-stone-50',
|
||||
'active:bg-stone-100',
|
||||
'active:bg-stone-150',
|
||||
'active:bg-stone-200',
|
||||
'active:bg-stone-250',
|
||||
'active:bg-stone-300',
|
||||
'active:bg-stone-350',
|
||||
'active:bg-stone-400',
|
||||
'active:bg-stone-450',
|
||||
'active:bg-stone-500',
|
||||
'active:bg-stone-550',
|
||||
'active:bg-stone-600',
|
||||
'active:bg-stone-650',
|
||||
'active:bg-stone-700',
|
||||
'active:bg-stone-750',
|
||||
'active:bg-stone-800',
|
||||
'active:bg-stone-850',
|
||||
'active:bg-stone-900',
|
||||
'active:bg-stone-950',
|
||||
|
||||
'focus:bg-stone-50',
|
||||
'focus:bg-stone-100',
|
||||
'focus:bg-stone-150',
|
||||
'focus:bg-stone-200',
|
||||
'focus:bg-stone-250',
|
||||
'focus:bg-stone-300',
|
||||
'focus:bg-stone-350',
|
||||
'focus:bg-stone-400',
|
||||
'focus:bg-stone-450',
|
||||
'focus:bg-stone-500',
|
||||
'focus:bg-stone-550',
|
||||
'focus:bg-stone-600',
|
||||
'focus:bg-stone-650',
|
||||
'focus:bg-stone-700',
|
||||
'focus:bg-stone-750',
|
||||
'focus:bg-stone-800',
|
||||
'focus:bg-stone-850',
|
||||
'focus:bg-stone-900',
|
||||
'focus:bg-stone-950',
|
||||
'focus:bg-stone-50',
|
||||
'focus:bg-stone-100',
|
||||
'focus:bg-stone-150',
|
||||
'focus:bg-stone-200',
|
||||
'focus:bg-stone-250',
|
||||
'focus:bg-stone-300',
|
||||
'focus:bg-stone-350',
|
||||
'focus:bg-stone-400',
|
||||
'focus:bg-stone-450',
|
||||
'focus:bg-stone-500',
|
||||
'focus:bg-stone-550',
|
||||
'focus:bg-stone-600',
|
||||
'focus:bg-stone-650',
|
||||
'focus:bg-stone-700',
|
||||
'focus:bg-stone-750',
|
||||
'focus:bg-stone-800',
|
||||
'focus:bg-stone-850',
|
||||
'focus:bg-stone-900',
|
||||
'focus:bg-stone-950',
|
||||
|
||||
'text-stone-50',
|
||||
'text-stone-150',
|
||||
'text-stone-200',
|
||||
'text-stone-250',
|
||||
'text-stone-300',
|
||||
'text-stone-350',
|
||||
'text-stone-100',
|
||||
'text-stone-400',
|
||||
'text-stone-450',
|
||||
'text-stone-500',
|
||||
'text-stone-550',
|
||||
'text-stone-600',
|
||||
'text-stone-650',
|
||||
'text-stone-700',
|
||||
'text-stone-750',
|
||||
'text-stone-800',
|
||||
'text-stone-850',
|
||||
'text-stone-900',
|
||||
'text-stone-950',
|
||||
'text-stone-50',
|
||||
'text-stone-150',
|
||||
'text-stone-200',
|
||||
'text-stone-250',
|
||||
'text-stone-300',
|
||||
'text-stone-350',
|
||||
'text-stone-100',
|
||||
'text-stone-400',
|
||||
'text-stone-450',
|
||||
'text-stone-500',
|
||||
'text-stone-550',
|
||||
'text-stone-600',
|
||||
'text-stone-650',
|
||||
'text-stone-700',
|
||||
'text-stone-750',
|
||||
'text-stone-800',
|
||||
'text-stone-850',
|
||||
'text-stone-900',
|
||||
'text-stone-950',
|
||||
|
||||
'group-hover:text-stone-100',
|
||||
'group-hover:text-stone-150',
|
||||
'group-hover:text-stone-200',
|
||||
'group-hover:text-stone-50',
|
||||
'group-hover:text-stone-250',
|
||||
'group-hover:text-stone-300',
|
||||
'group-hover:text-stone-350',
|
||||
'group-hover:text-stone-400',
|
||||
'group-hover:text-stone-450',
|
||||
'group-hover:text-stone-500',
|
||||
'group-hover:text-stone-550',
|
||||
'group-hover:text-stone-600',
|
||||
'group-hover:text-stone-650',
|
||||
'group-hover:text-stone-700',
|
||||
'group-hover:text-stone-750',
|
||||
'group-hover:text-stone-800',
|
||||
'group-hover:text-stone-850',
|
||||
'group-hover:text-stone-900',
|
||||
'group-hover:text-stone-950',
|
||||
'group-hover:text-stone-100',
|
||||
'group-hover:text-stone-150',
|
||||
'group-hover:text-stone-200',
|
||||
'group-hover:text-stone-50',
|
||||
'group-hover:text-stone-250',
|
||||
'group-hover:text-stone-300',
|
||||
'group-hover:text-stone-350',
|
||||
'group-hover:text-stone-400',
|
||||
'group-hover:text-stone-450',
|
||||
'group-hover:text-stone-500',
|
||||
'group-hover:text-stone-550',
|
||||
'group-hover:text-stone-600',
|
||||
'group-hover:text-stone-650',
|
||||
'group-hover:text-stone-700',
|
||||
'group-hover:text-stone-750',
|
||||
'group-hover:text-stone-800',
|
||||
'group-hover:text-stone-850',
|
||||
'group-hover:text-stone-900',
|
||||
'group-hover:text-stone-950',
|
||||
|
||||
'group-active:text-stone-50',
|
||||
'group-active:text-stone-100',
|
||||
'group-active:text-stone-150',
|
||||
'group-active:text-stone-200',
|
||||
'group-active:text-stone-250',
|
||||
'group-active:text-stone-300',
|
||||
'group-active:text-stone-350',
|
||||
'group-active:text-stone-400',
|
||||
'group-active:text-stone-450',
|
||||
'group-active:text-stone-500',
|
||||
'group-active:text-stone-550',
|
||||
'group-active:text-stone-600',
|
||||
'group-active:text-stone-650',
|
||||
'group-active:text-stone-700',
|
||||
'group-active:text-stone-750',
|
||||
'group-active:text-stone-800',
|
||||
'group-active:text-stone-850',
|
||||
'group-active:text-stone-950',
|
||||
'group-active:text-stone-900',
|
||||
'group-active:text-stone-50',
|
||||
'group-active:text-stone-100',
|
||||
'group-active:text-stone-150',
|
||||
'group-active:text-stone-200',
|
||||
'group-active:text-stone-250',
|
||||
'group-active:text-stone-300',
|
||||
'group-active:text-stone-350',
|
||||
'group-active:text-stone-400',
|
||||
'group-active:text-stone-450',
|
||||
'group-active:text-stone-500',
|
||||
'group-active:text-stone-550',
|
||||
'group-active:text-stone-600',
|
||||
'group-active:text-stone-650',
|
||||
'group-active:text-stone-700',
|
||||
'group-active:text-stone-750',
|
||||
'group-active:text-stone-800',
|
||||
'group-active:text-stone-850',
|
||||
'group-active:text-stone-950',
|
||||
'group-active:text-stone-900',
|
||||
|
||||
'border-stone-50',
|
||||
'border-stone-100',
|
||||
'border-stone-150',
|
||||
'border-stone-200',
|
||||
'border-stone-250',
|
||||
'border-stone-300',
|
||||
'border-stone-350',
|
||||
'border-stone-400',
|
||||
'border-stone-450',
|
||||
'border-stone-500',
|
||||
'border-stone-550',
|
||||
'border-stone-600',
|
||||
'border-stone-650',
|
||||
'border-stone-700',
|
||||
'border-stone-750',
|
||||
'border-stone-800',
|
||||
'border-stone-850',
|
||||
'border-stone-900',
|
||||
'border-stone-950',
|
||||
'border-stone-50',
|
||||
'border-stone-100',
|
||||
'border-stone-150',
|
||||
'border-stone-200',
|
||||
'border-stone-250',
|
||||
'border-stone-300',
|
||||
'border-stone-350',
|
||||
'border-stone-400',
|
||||
'border-stone-450',
|
||||
'border-stone-500',
|
||||
'border-stone-550',
|
||||
'border-stone-600',
|
||||
'border-stone-650',
|
||||
'border-stone-700',
|
||||
'border-stone-750',
|
||||
'border-stone-800',
|
||||
'border-stone-850',
|
||||
'border-stone-900',
|
||||
'border-stone-950',
|
||||
|
||||
'group-hover:border-stone-50',
|
||||
'group-hover:border-stone-100',
|
||||
'group-hover:border-stone-150',
|
||||
'group-hover:border-stone-200',
|
||||
'group-hover:border-stone-250',
|
||||
'group-hover:border-stone-300',
|
||||
'group-hover:border-stone-350',
|
||||
'group-hover:border-stone-400',
|
||||
'group-hover:border-stone-450',
|
||||
'group-hover:border-stone-500',
|
||||
'group-hover:border-stone-550',
|
||||
'group-hover:border-stone-600',
|
||||
'group-hover:border-stone-650',
|
||||
'group-hover:border-stone-700',
|
||||
'group-hover:border-stone-750',
|
||||
'group-hover:border-stone-800',
|
||||
'group-hover:border-stone-850',
|
||||
'group-hover:border-stone-950',
|
||||
'group-hover:border-stone-900',
|
||||
'group-hover:border-stone-50',
|
||||
'group-hover:border-stone-100',
|
||||
'group-hover:border-stone-150',
|
||||
'group-hover:border-stone-200',
|
||||
'group-hover:border-stone-250',
|
||||
'group-hover:border-stone-300',
|
||||
'group-hover:border-stone-350',
|
||||
'group-hover:border-stone-400',
|
||||
'group-hover:border-stone-450',
|
||||
'group-hover:border-stone-500',
|
||||
'group-hover:border-stone-550',
|
||||
'group-hover:border-stone-600',
|
||||
'group-hover:border-stone-650',
|
||||
'group-hover:border-stone-700',
|
||||
'group-hover:border-stone-750',
|
||||
'group-hover:border-stone-800',
|
||||
'group-hover:border-stone-850',
|
||||
'group-hover:border-stone-950',
|
||||
'group-hover:border-stone-900',
|
||||
|
||||
'group-active:border-stone-50',
|
||||
'group-active:border-stone-100',
|
||||
'group-active:border-stone-150',
|
||||
'group-active:border-stone-200',
|
||||
'group-active:border-stone-250',
|
||||
'group-active:border-stone-300',
|
||||
'group-active:border-stone-350',
|
||||
'group-active:border-stone-400',
|
||||
'group-active:border-stone-450',
|
||||
'group-active:border-stone-500',
|
||||
'group-active:border-stone-550',
|
||||
'group-active:border-stone-600',
|
||||
'group-active:border-stone-650',
|
||||
'group-active:border-stone-700',
|
||||
'group-active:border-stone-750',
|
||||
'group-active:border-stone-800',
|
||||
'group-active:border-stone-850',
|
||||
'group-active:border-stone-900',
|
||||
'group-active:border-stone-950',
|
||||
'group-active:border-stone-50',
|
||||
'group-active:border-stone-100',
|
||||
'group-active:border-stone-150',
|
||||
'group-active:border-stone-200',
|
||||
'group-active:border-stone-250',
|
||||
'group-active:border-stone-300',
|
||||
'group-active:border-stone-350',
|
||||
'group-active:border-stone-400',
|
||||
'group-active:border-stone-450',
|
||||
'group-active:border-stone-500',
|
||||
'group-active:border-stone-550',
|
||||
'group-active:border-stone-600',
|
||||
'group-active:border-stone-650',
|
||||
'group-active:border-stone-700',
|
||||
'group-active:border-stone-750',
|
||||
'group-active:border-stone-800',
|
||||
'group-active:border-stone-850',
|
||||
'group-active:border-stone-900',
|
||||
'group-active:border-stone-950',
|
||||
|
||||
'h-10',
|
||||
'h-15',
|
||||
'h-20',
|
||||
'h-25',
|
||||
'h-30',
|
||||
'h-35',
|
||||
'h-40',
|
||||
'h-10',
|
||||
'h-15',
|
||||
'h-20',
|
||||
'h-25',
|
||||
'h-30',
|
||||
'h-35',
|
||||
'h-40',
|
||||
|
||||
'right-0',
|
||||
'left-0',
|
||||
'right-0',
|
||||
'left-0',
|
||||
|
||||
'hover:bg-red-400',
|
||||
'active:bg-red-500',
|
||||
'hover:bg-red-400',
|
||||
'active:bg-red-500',
|
||||
|
||||
'hover:bg-stone-600/70',
|
||||
'active:bg-stone-500/80',
|
||||
],
|
||||
}
|
||||
'hover:bg-stone-600/70',
|
||||
'active:bg-stone-500/80'
|
||||
]
|
||||
};
|
||||
|
||||
+7
-7
@@ -3,7 +3,7 @@ module plg-mudics/control
|
||||
go 1.24.5
|
||||
|
||||
require (
|
||||
github.com/labstack/echo/v4 v4.13.4
|
||||
github.com/labstack/echo/v4 v4.15.0
|
||||
github.com/mdlayher/wol v0.0.0-20220221231636-b763a792253a
|
||||
)
|
||||
|
||||
@@ -17,10 +17,10 @@ require (
|
||||
github.com/mdlayher/socket v0.2.1 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||
golang.org/x/crypto v0.38.0 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sync v0.14.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.25.0 // indirect
|
||||
golang.org/x/time v0.11.0 // indirect
|
||||
golang.org/x/crypto v0.46.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
)
|
||||
|
||||
@@ -8,6 +8,8 @@ github.com/josharian/native v1.0.0 h1:Ts/E8zCSEsG17dUqv7joXJFybuMLjQfWE04tsBODTx
|
||||
github.com/josharian/native v1.0.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
|
||||
github.com/labstack/echo/v4 v4.13.4 h1:oTZZW+T3s9gAu5L8vmzihV7/lkXGZuITzTQkTEhcXEA=
|
||||
github.com/labstack/echo/v4 v4.13.4/go.mod h1:g63b33BZ5vZzcIUF8AtRH40DrTlXnx4UMC8rBdndmjQ=
|
||||
github.com/labstack/echo/v4 v4.15.0 h1:hoRTKWcnR5STXZFe9BmYun9AMTNeSbjHi2vtDuADJ24=
|
||||
github.com/labstack/echo/v4 v4.15.0/go.mod h1:xmw1clThob0BSVRX1CRQkGQ/vjwcpOMjQZSZa9fKA/c=
|
||||
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
@@ -34,13 +36,18 @@ github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
||||
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
|
||||
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
|
||||
golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -48,11 +55,16 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
|
||||
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
|
||||
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
|
||||
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
+8
-2
@@ -37,6 +37,9 @@ func main() {
|
||||
|
||||
e := echo.New()
|
||||
|
||||
// Allow requests from everywhere
|
||||
e.Use(middleware.CORS())
|
||||
|
||||
// Serve the embedded SvelteKit frontend
|
||||
e.Use(middleware.StaticWithConfig(middleware.StaticConfig{
|
||||
Filesystem: http.FS(frontend.BuildDirFS),
|
||||
@@ -61,7 +64,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
err = shared.OpenBrowserWindow("http://localhost:"+port, false, false)
|
||||
err = shared.OpenBrowserWindow("http://localhost:"+port, false)
|
||||
if err != nil {
|
||||
slog.Error("Failed to open browser window", "error", err)
|
||||
os.Exit(1)
|
||||
@@ -105,14 +108,17 @@ func wakeOnLanRoute(ctx echo.Context) error {
|
||||
}
|
||||
mac, err := net.ParseMAC(data.MACAddress)
|
||||
if err != nil {
|
||||
slog.Warn("Invalid MAC address provided", "mac_address", data.MACAddress, "error", err)
|
||||
return ctx.JSON(http.StatusBadRequest, shared.ErrorResponse{Description: "Invalid MAC address"})
|
||||
}
|
||||
|
||||
client, err := wol.NewClient()
|
||||
if err != nil {
|
||||
slog.Error("Failed to create Wake-on-LAN client", "error", err)
|
||||
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to create Wake-on-LAN client"})
|
||||
}
|
||||
if err := client.Wake("255.255.255.255", mac); err != nil {
|
||||
if err := client.Wake("255.255.255.255:7", mac); err != nil {
|
||||
slog.Error("Failed to send Wake-on-LAN packet", "error", err)
|
||||
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to send Wake-on-LAN packet"})
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -4,10 +4,10 @@ go 1.24.4
|
||||
|
||||
require (
|
||||
github.com/a-h/templ v0.3.960
|
||||
github.com/labstack/echo/v4 v4.13.4
|
||||
github.com/gabriel-vasile/mimetype v1.4.11
|
||||
github.com/labstack/echo/v4 v4.15.0
|
||||
github.com/micmonay/keybd_event v1.1.2
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
github.com/gabriel-vasile/mimetype v1.4.11
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -23,14 +23,14 @@ require (
|
||||
github.com/natefinch/atomic v1.0.1 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||
golang.org/x/crypto v0.40.0 // indirect
|
||||
golang.org/x/mod v0.26.0 // indirect
|
||||
golang.org/x/net v0.42.0 // indirect
|
||||
golang.org/x/sync v0.16.0 // indirect
|
||||
golang.org/x/sys v0.34.0 // indirect
|
||||
golang.org/x/text v0.27.0 // indirect
|
||||
golang.org/x/time v0.11.0 // indirect
|
||||
golang.org/x/tools v0.35.0 // indirect
|
||||
golang.org/x/crypto v0.46.0 // indirect
|
||||
golang.org/x/mod v0.30.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
golang.org/x/tools v0.39.0 // indirect
|
||||
)
|
||||
|
||||
tool github.com/a-h/templ/cmd/templ
|
||||
|
||||
@@ -20,6 +20,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/labstack/echo/v4 v4.13.4 h1:oTZZW+T3s9gAu5L8vmzihV7/lkXGZuITzTQkTEhcXEA=
|
||||
github.com/labstack/echo/v4 v4.13.4/go.mod h1:g63b33BZ5vZzcIUF8AtRH40DrTlXnx4UMC8rBdndmjQ=
|
||||
github.com/labstack/echo/v4 v4.15.0 h1:hoRTKWcnR5STXZFe9BmYun9AMTNeSbjHi2vtDuADJ24=
|
||||
github.com/labstack/echo/v4 v4.15.0/go.mod h1:xmw1clThob0BSVRX1CRQkGQ/vjwcpOMjQZSZa9fKA/c=
|
||||
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
@@ -36,26 +38,43 @@ github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
|
||||
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
|
||||
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
|
||||
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
|
||||
golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
|
||||
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
|
||||
golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=
|
||||
golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc=
|
||||
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
|
||||
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
|
||||
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
|
||||
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
|
||||
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
|
||||
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
|
||||
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
|
||||
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
|
||||
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
|
||||
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
|
||||
golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
|
||||
golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
+2
-4
@@ -9,8 +9,6 @@ import (
|
||||
"plg-mudics/shared"
|
||||
)
|
||||
|
||||
const VERSION = "0.1.0"
|
||||
|
||||
//go:generate go tool templ generate
|
||||
|
||||
func main() {
|
||||
@@ -27,8 +25,8 @@ func main() {
|
||||
|
||||
// the order is important, the open browser command exitsts as soon as the winodw is closed
|
||||
// and since its the last action in the main go func all other goroutines (e.g. the webserver) are killed
|
||||
go web.StartWebServer(VERSION, port)
|
||||
err = shared.OpenBrowserWindow("http://localhost:"+port, true, true)
|
||||
go web.StartWebServer(shared.Version, port)
|
||||
err = shared.OpenBrowserWindow("http://localhost:"+port, true)
|
||||
if err != nil {
|
||||
slog.Error("Failed to open browser window", "error", err)
|
||||
os.Exit(1)
|
||||
|
||||
@@ -3,7 +3,6 @@ package pkg
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -100,7 +99,6 @@ func TakeScreenshot() (string, error) {
|
||||
if commandOutput.ExitCode == 0 {
|
||||
return tempFilePath, nil
|
||||
}
|
||||
slog.Warn("Screenshot error", "error", commandOutput.Stderr)
|
||||
}
|
||||
return "", errors.New("no screenshot utility found or all failed")
|
||||
}
|
||||
|
||||
+4
-3
@@ -15,6 +15,7 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
shared "plg-mudics/shared"
|
||||
"strings"
|
||||
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"github.com/labstack/echo/v4"
|
||||
@@ -35,7 +36,9 @@ func StartWebServer(v string, port string) {
|
||||
e.GET("/", indexRoute)
|
||||
e.GET("/sse", sseRoute)
|
||||
e.GET("/splash", func(ctx echo.Context) error {
|
||||
return ctx.HTML(http.StatusOK, shared.SplashScreenTemplate)
|
||||
html := shared.SplashScreenTemplate
|
||||
html = strings.ReplaceAll(html, "%%APP-VERSION%%", version)
|
||||
return ctx.HTML(http.StatusOK, html)
|
||||
})
|
||||
e.GET("/qr", qrRoute)
|
||||
|
||||
@@ -325,7 +328,6 @@ func openFileRoute(ctx echo.Context) error {
|
||||
err = resetView()
|
||||
if err != nil {
|
||||
slog.Error("Failed to reset view", "error", err)
|
||||
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to reset view"})
|
||||
}
|
||||
|
||||
mType, err := mimetype.DetectFile(fullPath)
|
||||
@@ -372,7 +374,6 @@ func showHTMLRoute(ctx echo.Context) error {
|
||||
err := resetView()
|
||||
if err != nil {
|
||||
slog.Error("Failed to reset view", "error", err)
|
||||
return ctx.JSON(http.StatusInternalServerError, shared.ErrorResponse{Description: "Failed to reset view"})
|
||||
}
|
||||
|
||||
sseConnection <- request.HTML
|
||||
|
||||
+39
-36
@@ -1,16 +1,15 @@
|
||||
package web
|
||||
|
||||
templ indexTemplate() {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>PLG Connect Display</title>
|
||||
<script src="/static/htmx.min.js"></script>
|
||||
<script src="/static/htmx-ext-sse.min.js"></script>
|
||||
<style>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>PLG MuDiCS Display</title>
|
||||
<script src="/static/htmx.min.js"></script>
|
||||
<script src="/static/htmx-ext-sse.min.js"></script>
|
||||
<style>
|
||||
:root {
|
||||
--background-color: black;
|
||||
--foreground-color: oklch(92.3% 0.003 48.717);
|
||||
@@ -33,6 +32,7 @@ templ indexTemplate() {
|
||||
background-color: var(--background-color);
|
||||
color: var(--foreground-color);
|
||||
font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
cursor: none;
|
||||
}
|
||||
|
||||
video,
|
||||
@@ -60,7 +60,7 @@ templ indexTemplate() {
|
||||
padding-left: calc(var(--font-size)*1.5);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
<script>
|
||||
document.addEventListener('keydown', function (event) {
|
||||
if (event.code === 'Space') {
|
||||
event.preventDefault();
|
||||
@@ -75,42 +75,45 @@ templ indexTemplate() {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<bod>
|
||||
<div hx-get="/splash" hx-trigger="load"></div>
|
||||
<main hx-ext="sse" sse-connect="/sse" sse-swap="message"></main>
|
||||
</bod>
|
||||
|
||||
</html>
|
||||
</head>
|
||||
<bod>
|
||||
<div hx-get="/splash" hx-trigger="load"></div>
|
||||
<main hx-ext="sse" sse-connect="/sse" sse-swap="message"></main>
|
||||
</bod>
|
||||
</html>
|
||||
}
|
||||
|
||||
templ videoTemplate(path string) {
|
||||
<video autoplay>
|
||||
<source src={ "/api/file/" + path } type="video/mp4" />
|
||||
</video>
|
||||
<video autoplay>
|
||||
<source src={ "/api/file/" + path } type="video/mp4"/>
|
||||
</video>
|
||||
}
|
||||
|
||||
templ imageTemplate(path string) {
|
||||
<img src={ "/api/file/" + path } />
|
||||
<img src={ "/api/file/" + path }/>
|
||||
}
|
||||
|
||||
templ deviceInfoTemplate(ip string, mac string, showQR bool) {
|
||||
<div style="width: 100vw; height: 100vh; display: flex; flex-direction: row; justify-content: space-between;">
|
||||
<div
|
||||
style="display: flex; flex-direction: column; gap: 1rem; justify-content: end; padding: 2rem; font-size: 4rem;">
|
||||
{ ip }
|
||||
<span style="text-transform: uppercase;">{ mac }</span>
|
||||
</div>
|
||||
if showQR {
|
||||
<div style="display: flex; justify-content: end; align-items: end; padding: 2rem;">
|
||||
<div style="padding: 1rem; background-color: var(--foreground-color); border-radius: 1rem;">
|
||||
<img style="height: 30vh; width: auto; image-rendering: pixelated; image-rendering: crisp-edges;"
|
||||
src={ "/qr?data=http://" + ip + ":8080" } alt="QR-Code" />
|
||||
<div style="width: 100vw; height: 100vh; display: flex; flex-direction: row; justify-content: space-between;">
|
||||
<div
|
||||
style="display: flex; flex-direction: column; gap: 1rem; justify-content: end; padding: 2rem; font-size: 4rem;"
|
||||
>
|
||||
{ ip }
|
||||
<span style="text-transform: uppercase;">{ mac }</span>
|
||||
</div>
|
||||
if showQR {
|
||||
<div style="display: flex; justify-content: end; align-items: end; padding: 2rem;">
|
||||
<div style="padding: 1rem; background-color: var(--foreground-color); border-radius: 1rem;">
|
||||
<img
|
||||
style="height: 30vh; width: auto; image-rendering: pixelated; image-rendering: crisp-edges;"
|
||||
src={ "/qr?data=http://" + ip + ":8080" }
|
||||
alt="QR-Code"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<style>
|
||||
<style>
|
||||
:root {
|
||||
--splash-bg: transparent !important;
|
||||
--splash-fade-out-state: paused !important;
|
||||
|
||||
+5
-14
@@ -1,24 +1,15 @@
|
||||
github.com/a-h/htmlformat v0.0.0-20250209131833-673be874c677/go.mod h1:FMIm5afKmEfarNbIXOaPHFY8X7fo+fRQB6I9MPG2nB0=
|
||||
github.com/a-h/templ v0.3.960 h1:trshEpGa8clF5cdI39iY4ZrZG8Z/QixyzEyUnA7feTM=
|
||||
github.com/a-h/templ v0.3.960/go.mod h1:oCZcnKRf5jjsGpf2yELzQfodLphd2mwecwG4Crk5HBo=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
|
||||
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
|
||||
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
|
||||
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
|
||||
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
|
||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
|
||||
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0=
|
||||
golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b/go.mod h1:4ZwOYna0/zsOKwuR5X/m0QFOJpSZvAxFfkQT+Erd9D4=
|
||||
golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54/go.mod h1:hKdjCMrbv9skySur+Nek8Hd0uJ0GuxJIoIX2payrIdQ=
|
||||
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
|
||||
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0=
|
||||
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
|
||||
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
|
||||
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
|
||||
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg=
|
||||
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
||||
+15
-2
@@ -86,7 +86,6 @@
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Programs
|
||||
libreoffice
|
||||
#rustdesk
|
||||
ungoogled-chromium
|
||||
xfce.thunar-archive-plugin
|
||||
git
|
||||
@@ -94,6 +93,8 @@
|
||||
unzip
|
||||
iputils
|
||||
xreader
|
||||
tree
|
||||
jq
|
||||
|
||||
# Libraries
|
||||
imagemagick
|
||||
@@ -115,7 +116,7 @@
|
||||
after = ["network-online.target"];
|
||||
wants = ["network-online.target"];
|
||||
path = config.environment.systemPackages;
|
||||
script = "nu ${./update.sh}";
|
||||
script = "nu ${./update.nu}";
|
||||
serviceConfig = {
|
||||
WorkingDirectory = "/home/mudics/mudics";
|
||||
User = "mudics";
|
||||
@@ -137,6 +138,7 @@
|
||||
environment = {
|
||||
DISPLAY = ":0";
|
||||
XDG_RUNTIME_DIR = "/run/user/1000";
|
||||
XDG_DATA_DIRS = "/run/current-system/sw/share";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -150,6 +152,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.enable-wol = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
after = ["network.target"];
|
||||
path = with pkgs; [ethtool nushell];
|
||||
script = "nu ${./wol.nu}";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /home/mudics/mudics 0755 mudics - -"
|
||||
];
|
||||
|
||||
Generated
+8
-8
@@ -7,32 +7,32 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1763992789,
|
||||
"narHash": "sha256-WHkdBlw6oyxXIra/vQPYLtqY+3G8dUVZM8bEXk0t8x4=",
|
||||
"lastModified": 1767910483,
|
||||
"narHash": "sha256-MOU5YdVu4DVwuT5ztXgQpPuRRBjSjUGIdUzOQr9iQOY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "44831a7eaba4360fb81f2acc5ea6de5fde90aaa3",
|
||||
"rev": "82fb7dedaad83e5e279127a38ef410bcfac6d77c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-25.05",
|
||||
"ref": "release-25.11",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1761999846,
|
||||
"narHash": "sha256-IYlYnp4O4dzEpL77BD/lj5NnJy2J8qbHkNSFiPBCbqo=",
|
||||
"lastModified": 1767799921,
|
||||
"narHash": "sha256-r4GVX+FToWVE2My8VVZH4V0pTIpnu2ZE8/Z4uxGEMBE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3de8f8d73e35724bf9abef41f1bdbedda1e14a31",
|
||||
"rev": "d351d0653aeb7877273920cd3e823994e7579b0b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-25.05",
|
||||
"ref": "nixos-25.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-25.05";
|
||||
url = "github:nix-community/home-manager/release-25.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
ls /sys/class/net | get name | path basename | where $it != "lo" | each {|iface|
|
||||
print $"Enabling WoL on ($iface)..."
|
||||
try {
|
||||
ethtool -s $iface wol g
|
||||
print $"Successfully enabled WoL on ($iface)"
|
||||
} catch {
|
||||
print $"Failed to enable WoL on ($iface). It might not be supported."
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,12 @@ package shared
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:embed splash_screen.html
|
||||
var SplashScreenTemplate string
|
||||
|
||||
//go:embed version.txt
|
||||
var versionNotTrimmed string
|
||||
var Version = strings.TrimSpace(versionNotTrimmed)
|
||||
|
||||
+12
-10
@@ -5,23 +5,25 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func OpenBrowserWindow(url string, fullscreen bool, temp bool) error {
|
||||
func OpenBrowserWindow(url string, fullscreen bool) error {
|
||||
bins := []string{"chromium", "chromium-browser"}
|
||||
|
||||
args := []string{fmt.Sprintf("--app=%s", url), "--autoplay-policy=no-user-gesture-required"}
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to determine user home directory: %w", err)
|
||||
}
|
||||
browserProfileDirPath := filepath.Join(home, ".local", "share", "plg-mudics", "browser")
|
||||
if err := os.MkdirAll(browserProfileDirPath, os.ModePerm); err != nil {
|
||||
return fmt.Errorf("failed to create local config directory: %w", err)
|
||||
}
|
||||
|
||||
args := []string{fmt.Sprintf("--app=%s", url), "--autoplay-policy=no-user-gesture-required", fmt.Sprintf("--user-data-dir=%s", browserProfileDirPath)}
|
||||
if fullscreen {
|
||||
args = append(args, "--start-fullscreen")
|
||||
}
|
||||
if temp {
|
||||
tempDirPath, err := os.MkdirTemp("", "plg-mudics-browser-")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
arg := fmt.Sprintf("--user-data-dir=%s", tempDirPath)
|
||||
args = append(args, arg)
|
||||
}
|
||||
|
||||
errs := []string{}
|
||||
for _, bin := range bins {
|
||||
|
||||
+441
-222
@@ -1,267 +1,486 @@
|
||||
<div id="splash">
|
||||
<svg id="splash-svg" viewBox="0 0 950 550">
|
||||
<!-- Paths -->
|
||||
<!-- Disabled Paths -->
|
||||
<path class="splash-stroke" d="M 385 350 V 270 H 100 V 112.5" />
|
||||
<path class="splash-stroke" d="M 445 350 V 210 H 350 V 112.5" />
|
||||
<path class="splash-stroke" d="M 505 350 V 210 H 600 V 112.5" />
|
||||
<path class="splash-stroke" d="M 565 350 V 270 H 850 V 112.5" />
|
||||
<!-- Masks -->
|
||||
<defs>
|
||||
<mask id="m1" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse">
|
||||
<path class="splash-mask" pathLength="100" d="M 385 350 V 270 H 100 V 112.5" />
|
||||
</mask>
|
||||
<mask id="m2" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse">
|
||||
<path class="splash-mask" pathLength="100" d="M 445 350 V 210 H 350 V 112.5" />
|
||||
</mask>
|
||||
<mask id="m3" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse">
|
||||
<path class="splash-mask" pathLength="100" d="M 505 350 V 210 H 600 V 112.5" />
|
||||
</mask>
|
||||
<mask id="m4" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse">
|
||||
<path class="splash-mask" pathLength="100" d="M 565 350 V 270 H 850 V 112.5" />
|
||||
</mask>
|
||||
</defs>
|
||||
<!-- Active Paths -->
|
||||
<path class="splash-stroke-active" mask="url(#m1)" d="M 385 350 V 270 H 100 V 112.5" />
|
||||
<path class="splash-stroke-active" mask="url(#m2)" d="M 445 350 V 210 H 350 V 112.5" />
|
||||
<path class="splash-stroke-active" mask="url(#m3)" d="M 505 350 V 210 H 600 V 112.5" />
|
||||
<path class="splash-stroke-active" mask="url(#m4)" d="M 565 350 V 270 H 850 V 112.5" />
|
||||
<svg id="splash-svg" class="fade-in" viewBox="0 0 950 550">
|
||||
<!-- Paths -->
|
||||
<!-- Disabled Paths -->
|
||||
<path class="splash-stroke" d="M 385 350 V 270 H 100 V 112.5" />
|
||||
<path class="splash-stroke" d="M 445 350 V 210 H 350 V 112.5" />
|
||||
<path class="splash-stroke" d="M 505 350 V 210 H 600 V 112.5" />
|
||||
<path class="splash-stroke" d="M 565 350 V 270 H 850 V 112.5" />
|
||||
<!-- Masks -->
|
||||
<defs>
|
||||
<mask
|
||||
id="m1"
|
||||
maskUnits="userSpaceOnUse"
|
||||
maskContentUnits="userSpaceOnUse"
|
||||
>
|
||||
<path
|
||||
class="splash-mask"
|
||||
pathLength="100"
|
||||
d="M 385 350 V 270 H 100 V 112.5"
|
||||
/>
|
||||
</mask>
|
||||
<mask
|
||||
id="m2"
|
||||
maskUnits="userSpaceOnUse"
|
||||
maskContentUnits="userSpaceOnUse"
|
||||
>
|
||||
<path
|
||||
class="splash-mask"
|
||||
pathLength="100"
|
||||
d="M 445 350 V 210 H 350 V 112.5"
|
||||
/>
|
||||
</mask>
|
||||
<mask
|
||||
id="m3"
|
||||
maskUnits="userSpaceOnUse"
|
||||
maskContentUnits="userSpaceOnUse"
|
||||
>
|
||||
<path
|
||||
class="splash-mask"
|
||||
pathLength="100"
|
||||
d="M 505 350 V 210 H 600 V 112.5"
|
||||
/>
|
||||
</mask>
|
||||
<mask
|
||||
id="m4"
|
||||
maskUnits="userSpaceOnUse"
|
||||
maskContentUnits="userSpaceOnUse"
|
||||
>
|
||||
<path
|
||||
class="splash-mask"
|
||||
pathLength="100"
|
||||
d="M 565 350 V 270 H 850 V 112.5"
|
||||
/>
|
||||
</mask>
|
||||
</defs>
|
||||
<!-- Active Paths -->
|
||||
<path
|
||||
class="splash-stroke-active"
|
||||
mask="url(#m1)"
|
||||
d="M 385 350 V 270 H 100 V 112.5"
|
||||
/>
|
||||
<path
|
||||
class="splash-stroke-active"
|
||||
mask="url(#m2)"
|
||||
d="M 445 350 V 210 H 350 V 112.5"
|
||||
/>
|
||||
<path
|
||||
class="splash-stroke-active"
|
||||
mask="url(#m3)"
|
||||
d="M 505 350 V 210 H 600 V 112.5"
|
||||
/>
|
||||
<path
|
||||
class="splash-stroke-active"
|
||||
mask="url(#m4)"
|
||||
d="M 565 350 V 270 H 850 V 112.5"
|
||||
/>
|
||||
|
||||
<!-- Displays -->
|
||||
<rect x="0" y="0" width="200" height="112.5" rx="8" ry="8" class="splash-monitor" />
|
||||
<rect x="250" y="0" width="200" height="112.5" rx="8" ry="8" class="splash-monitor" />
|
||||
<rect x="500" y="0" width="200" height="112.5" rx="8" ry="8" class="splash-monitor" />
|
||||
<rect x="750" y="0" width="200" height="112.5" rx="8" ry="8" class="splash-monitor" />
|
||||
<!-- Displays -->
|
||||
<rect
|
||||
x="0"
|
||||
y="0"
|
||||
width="200"
|
||||
height="112.5"
|
||||
rx="8"
|
||||
ry="8"
|
||||
class="splash-monitor"
|
||||
/>
|
||||
<rect
|
||||
x="250"
|
||||
y="0"
|
||||
width="200"
|
||||
height="112.5"
|
||||
rx="8"
|
||||
ry="8"
|
||||
class="splash-monitor"
|
||||
/>
|
||||
<rect
|
||||
x="500"
|
||||
y="0"
|
||||
width="200"
|
||||
height="112.5"
|
||||
rx="8"
|
||||
ry="8"
|
||||
class="splash-monitor"
|
||||
/>
|
||||
<rect
|
||||
x="750"
|
||||
y="0"
|
||||
width="200"
|
||||
height="112.5"
|
||||
rx="8"
|
||||
ry="8"
|
||||
class="splash-monitor"
|
||||
/>
|
||||
|
||||
<!-- Text -->
|
||||
<text class="splash-text" x="100" y="66.25" font-size="90">Mu</text>
|
||||
<text class="splash-text" x="350" y="66.25" font-size="90">Di</text>
|
||||
<text class="splash-text" x="600" y="66.25" font-size="90">C</text>
|
||||
<text class="splash-text" x="850" y="66.25" font-size="90">S</text>
|
||||
<!-- Text -->
|
||||
<text class="splash-text" x="100" y="66.25" font-size="90">Mu</text>
|
||||
<text class="splash-text" x="350" y="66.25" font-size="90">Di</text>
|
||||
<text class="splash-text" x="600" y="66.25" font-size="90">C</text>
|
||||
<text class="splash-text" x="850" y="66.25" font-size="90">S</text>
|
||||
|
||||
<!-- Controller -->
|
||||
<rect x="325" y="350" width="300" height="168.75" rx="8" ry="8" class="splash-control-monitor" />
|
||||
<rect x="335" y="390" width="135" height="120" rx="8" ry="8" class="splash-other-button" />
|
||||
<rect x="480" y="390" width="135" height="55" rx="8" ry="8" class="splash-other-button" />
|
||||
<rect x="480" y="455" width="135" height="55" rx="8" ry="8" class="splash-start-button" />
|
||||
<!-- Controller -->
|
||||
<rect
|
||||
x="325"
|
||||
y="350"
|
||||
width="300"
|
||||
height="168.75"
|
||||
rx="8"
|
||||
ry="8"
|
||||
class="splash-control-monitor"
|
||||
/>
|
||||
<rect
|
||||
x="335"
|
||||
y="390"
|
||||
width="135"
|
||||
height="120"
|
||||
rx="8"
|
||||
ry="8"
|
||||
class="splash-other-button"
|
||||
/>
|
||||
<rect
|
||||
x="480"
|
||||
y="390"
|
||||
width="135"
|
||||
height="55"
|
||||
rx="8"
|
||||
ry="8"
|
||||
class="splash-other-button"
|
||||
/>
|
||||
<rect
|
||||
x="480"
|
||||
y="455"
|
||||
width="135"
|
||||
height="55"
|
||||
rx="8"
|
||||
ry="8"
|
||||
class="splash-start-button"
|
||||
/>
|
||||
|
||||
<!-- Window Controls -->
|
||||
<path class="window-controls" d="M 600 360 L 615 375" />
|
||||
<path class="window-controls" d="M 600 375 L 615 360" />
|
||||
<path class="window-controls" fill="none" d="M 575 360 H 590 V 375 H 575 V 360" />
|
||||
<path class="window-controls" d="M 550 375 H 565" />
|
||||
<!-- Window Controls -->
|
||||
<path class="window-controls" d="M 600 360 l 15 15" />
|
||||
<path class="window-controls" d="M 600 375 l 15 -15" />
|
||||
<path
|
||||
class="window-controls"
|
||||
fill="none"
|
||||
d="M 575 360 h 15 v 15 h -15 v -15"
|
||||
/>
|
||||
<path class="window-controls" d="M 550 375 h 15" />
|
||||
</svg>
|
||||
|
||||
<svg class="cursor" width="50" height="50" viewBox="0 0 24 24" x="510" y="480" aria-hidden="true">
|
||||
<g stroke="#ffffff" fill="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="#000000" d="M 6.5 10 H 18 V 19 H 6" />
|
||||
<path d="M22 14a8 8 0 0 1-8 8" />
|
||||
<path d="M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2" />
|
||||
<path d="M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1" />
|
||||
<path d="M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10" />
|
||||
<path
|
||||
d="M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15" />
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
<span id="version-label" aria-label="Version">%%APP-VERSION%%</span>
|
||||
|
||||
<div class="fade-in">
|
||||
<div
|
||||
class="cursor-x"
|
||||
style="
|
||||
position: absolute;
|
||||
left: calc(50cqw + var(--mouse-start-x));
|
||||
top: calc(50cqh + var(--mouse-start-y));
|
||||
"
|
||||
>
|
||||
<svg class="cursor-y" width="50" height="50" viewBox="0 0 24 24">
|
||||
<g
|
||||
stroke="#ffffff"
|
||||
fill="#000000"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path stroke="#000000" d="M 6.5 10 H 18 V 19 H 6" />
|
||||
<path d="M22 14a8 8 0 0 1-8 8" />
|
||||
<path d="M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2" />
|
||||
<path d="M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1" />
|
||||
<path d="M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10" />
|
||||
<path
|
||||
d="M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--splash-fade-out-delay: 0s;
|
||||
--splash-fade-out-state: running;
|
||||
:root {
|
||||
--splash-fade-out-delay: 0s;
|
||||
--splash-fade-out-state: running;
|
||||
|
||||
--base-stroke: #444444;
|
||||
--base-stroke-active: #109e00;
|
||||
--base-stroke: #444444;
|
||||
--base-stroke-active: #109e00;
|
||||
|
||||
--splash-bg: oklch(21.6% 0.006 56.043);
|
||||
--monitor-dark: #000000;
|
||||
--monitor-active: #ffffff;
|
||||
--window-controls: #cccccc;
|
||||
--start-button-inactive: #cccccc;
|
||||
--start-button-hover: #77a3b1;
|
||||
--start-button-active: #2c819b;
|
||||
--other-button: oklch(55.3% 0.013 58.071);
|
||||
--splash-control-monitor: oklch(44.4% 0.011 73.639);
|
||||
--splash-bg: oklch(21.6% 0.006 56.043);
|
||||
--monitor-dark: #000000;
|
||||
--monitor-active: #ffffff;
|
||||
--window-controls: #cccccc;
|
||||
--start-button-inactive: #cccccc;
|
||||
--start-button-hover: #77a3b1;
|
||||
--start-button-active: #2c819b;
|
||||
--other-button: oklch(55.3% 0.013 58.071);
|
||||
--splash-control-monitor: oklch(44.4% 0.011 73.639);
|
||||
|
||||
--stroke-strength: 8;
|
||||
--dash: 16;
|
||||
--gap: 20;
|
||||
}
|
||||
--version-color: oklch(55.3% 0.013 58.071);
|
||||
|
||||
--mouse-size: 50px;
|
||||
--mouse-bounce-delay: 5s;
|
||||
--mouse-start-x: calc((35 * 100vw) / 1920);
|
||||
--mouse-start-y: calc((60 * 100vh) / 1080);
|
||||
|
||||
#splash {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: var(--splash-bg);
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
/* animation: splash-fade 1s ease 4s forwards; */
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
--dur-x: 16s;
|
||||
--dur-y: 9s;
|
||||
|
||||
animation-name: splash-fade;
|
||||
animation-duration: 1s;
|
||||
animation-timing-function: ease;
|
||||
animation-fill-mode: forwards;
|
||||
animation-delay: var(--splash-fade-out-delay);
|
||||
animation-play-state: var(--splash-fade-out-state);
|
||||
}
|
||||
--stroke-strength: 8;
|
||||
--dash: 16;
|
||||
--gap: 20;
|
||||
}
|
||||
|
||||
#splash-svg {
|
||||
max-height: 50vh;
|
||||
max-width: 80vw;
|
||||
opacity: 0;
|
||||
animation: fade-in 1s ease 500ms forwards;
|
||||
}
|
||||
#version-label {
|
||||
position: absolute;
|
||||
right: 1rem;
|
||||
top: 1rem;
|
||||
display: block;
|
||||
color: var(--version-color);
|
||||
padding: 0.4rem 0.8rem;
|
||||
font-size: 1.4rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.splash-monitor {
|
||||
aspect-ratio: 16/9;
|
||||
rx: 8;
|
||||
ry: 8;
|
||||
width: 200;
|
||||
fill: var(--monitor-dark);
|
||||
}
|
||||
#splash {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: var(--splash-bg);
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
|
||||
.splash-control-monitor {
|
||||
fill: var(--splash-control-monitor);
|
||||
}
|
||||
animation-name: splash-fade;
|
||||
animation-duration: 1s;
|
||||
animation-timing-function: ease;
|
||||
animation-fill-mode: forwards;
|
||||
animation-delay: var(--splash-fade-out-delay);
|
||||
animation-play-state: var(--splash-fade-out-state);
|
||||
}
|
||||
|
||||
.splash-other-button {
|
||||
fill: var(--other-button);
|
||||
}
|
||||
#splash-svg {
|
||||
max-height: 50vh;
|
||||
max-width: 80vw;
|
||||
transform: translateY(-12cqh);
|
||||
}
|
||||
|
||||
.splash-stroke,
|
||||
.splash-stroke-active {
|
||||
fill: none;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: var(--stroke-strength);
|
||||
stroke-dasharray: var(--dash) var(--gap);
|
||||
}
|
||||
.fade-in {
|
||||
opacity: 0;
|
||||
animation: fade-in 1s ease 500ms forwards;
|
||||
}
|
||||
|
||||
.window-controls {
|
||||
stroke: var(--window-controls);
|
||||
stroke-width: 3;
|
||||
}
|
||||
.splash-monitor {
|
||||
aspect-ratio: 16/9;
|
||||
rx: 8;
|
||||
ry: 8;
|
||||
width: 200;
|
||||
fill: var(--monitor-dark);
|
||||
}
|
||||
|
||||
.splash-stroke {
|
||||
stroke: var(--base-stroke);
|
||||
}
|
||||
.splash-control-monitor {
|
||||
fill: var(--splash-control-monitor);
|
||||
}
|
||||
|
||||
.splash-stroke-active {
|
||||
stroke: var(--base-stroke-active);
|
||||
}
|
||||
.splash-other-button {
|
||||
fill: var(--other-button);
|
||||
}
|
||||
|
||||
.splash-mask {
|
||||
fill: none;
|
||||
stroke: #fff;
|
||||
stroke-linecap: round;
|
||||
stroke-width: var(--stroke-strength);
|
||||
stroke-dasharray: 100;
|
||||
stroke-dashoffset: 100;
|
||||
animation: draw 1s ease-in-out 1.35s forwards;
|
||||
}
|
||||
.splash-stroke,
|
||||
.splash-stroke-active {
|
||||
fill: none;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: var(--stroke-strength);
|
||||
stroke-dasharray: var(--dash) var(--gap);
|
||||
}
|
||||
|
||||
.splash-text {
|
||||
text-anchor: middle;
|
||||
dominant-baseline: middle;
|
||||
fill: var(--monitor-dark);
|
||||
user-select: none;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.window-controls {
|
||||
stroke: var(--window-controls);
|
||||
stroke-width: 3;
|
||||
}
|
||||
|
||||
.splash-monitor {
|
||||
fill: var(--monitor-dark);
|
||||
animation: activate-monitor 0ms ease 2.35s forwards;
|
||||
}
|
||||
.splash-stroke {
|
||||
stroke: var(--base-stroke);
|
||||
}
|
||||
|
||||
.splash-start-button {
|
||||
fill: var(--start-button-inactive);
|
||||
animation: start-button-hover-press 1s ease-in-out 450ms forwards;
|
||||
}
|
||||
.splash-stroke-active {
|
||||
stroke: var(--base-stroke-active);
|
||||
}
|
||||
|
||||
.cursor {
|
||||
animation: move-mouse 1s ease-in-out 0ms forwards;
|
||||
}
|
||||
.splash-mask {
|
||||
fill: none;
|
||||
stroke: #fff;
|
||||
stroke-linecap: round;
|
||||
stroke-width: var(--stroke-strength);
|
||||
stroke-dasharray: 100;
|
||||
stroke-dashoffset: 100;
|
||||
animation: draw 1s ease-in-out 1.35s forwards;
|
||||
}
|
||||
|
||||
@keyframes fade-in {
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.splash-text {
|
||||
text-anchor: middle;
|
||||
dominant-baseline: middle;
|
||||
fill: var(--monitor-dark);
|
||||
user-select: none;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
@keyframes move-mouse {
|
||||
0% {
|
||||
transform: translateX(-100px);
|
||||
}
|
||||
.splash-monitor {
|
||||
fill: var(--monitor-dark);
|
||||
animation: activate-monitor 0ms ease 2.35s forwards;
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: translateX(-100px);
|
||||
}
|
||||
.splash-start-button {
|
||||
fill: var(--start-button-inactive);
|
||||
animation: start-button-hover-press 1s ease-in-out 450ms forwards;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(0px);
|
||||
}
|
||||
}
|
||||
.cursor-x {
|
||||
animation-name: move-mouse, mouse-bounceX;
|
||||
animation-duration: 1s, var(--dur-x);
|
||||
animation-delay: 0s, var(--mouse-bounce-delay);
|
||||
animation-iteration-count: 1, infinite;
|
||||
animation-direction: normal, normal;
|
||||
animation-timing-function: ease-in-out, linear;
|
||||
animation-fill-mode: both, none;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
@keyframes start-button-hover-press {
|
||||
0% {
|
||||
fill: var(--start-button-inactive);
|
||||
}
|
||||
.cursor-y {
|
||||
animation-name: mouse-bounceY;
|
||||
animation-duration: var(--dur-y);
|
||||
animation-delay: var(--mouse-bounce-delay);
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: normal;
|
||||
animation-timing-function: linear;
|
||||
animation-fill-mode: none;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
30% {
|
||||
fill: var(--start-button-inactive);
|
||||
}
|
||||
@keyframes fade-in {
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
40% {
|
||||
fill: var(--start-button-hover);
|
||||
}
|
||||
@keyframes move-mouse {
|
||||
0% {
|
||||
transform: translateX(-100px);
|
||||
}
|
||||
|
||||
70% {
|
||||
fill: var(--start-button-hover);
|
||||
}
|
||||
50% {
|
||||
transform: translateX(-100px);
|
||||
}
|
||||
|
||||
80% {
|
||||
fill: var(--start-button-active);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(0px);
|
||||
}
|
||||
}
|
||||
|
||||
90% {
|
||||
fill: var(--start-button-active);
|
||||
}
|
||||
@keyframes mouse-bounceX {
|
||||
0% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
fill: var(--start-button-hover);
|
||||
}
|
||||
}
|
||||
26% {
|
||||
transform: translateX(calc(-50cqw - var(--mouse-start-x)));
|
||||
}
|
||||
|
||||
@keyframes draw {
|
||||
to {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
76% {
|
||||
transform: translateX(
|
||||
calc(50cqw - var(--mouse-size) - var(--mouse-start-x))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes activate-monitor {
|
||||
to {
|
||||
fill: var(--monitor-active);
|
||||
}
|
||||
}
|
||||
@keyframes mouse-bounceY {
|
||||
0% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
@keyframes splash-fade {
|
||||
to {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
27% {
|
||||
transform: translateY(calc(-50cqh - var(--mouse-start-y)));
|
||||
}
|
||||
|
||||
rect {
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
77% {
|
||||
transform: translateY(
|
||||
calc(50cqh - var(--mouse-size) - var(--mouse-start-y))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* verhindert, dass die Linien beim Skalieren dicker werden */
|
||||
.cursor * {
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
@keyframes start-button-hover-press {
|
||||
0% {
|
||||
fill: var(--start-button-inactive);
|
||||
}
|
||||
|
||||
30% {
|
||||
fill: var(--start-button-inactive);
|
||||
}
|
||||
|
||||
40% {
|
||||
fill: var(--start-button-hover);
|
||||
}
|
||||
|
||||
70% {
|
||||
fill: var(--start-button-hover);
|
||||
}
|
||||
|
||||
80% {
|
||||
fill: var(--start-button-active);
|
||||
}
|
||||
|
||||
90% {
|
||||
fill: var(--start-button-active);
|
||||
}
|
||||
|
||||
100% {
|
||||
fill: var(--start-button-hover);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes draw {
|
||||
to {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes activate-monitor {
|
||||
to {
|
||||
fill: var(--monitor-active);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes splash-fade {
|
||||
to {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
rect {
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
|
||||
/* verhindert, dass die Linien beim Skalieren dicker werden */
|
||||
.cursor * {
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
const r =
|
||||
Math.random() < 0.01
|
||||
? 9 / 15.039473684
|
||||
: 0.55 + (Math.random() - 0.5) * 0.18;
|
||||
const tx = 13 + Math.random() * 5;
|
||||
document.documentElement.style.setProperty("--dur-x", tx + "s");
|
||||
document.documentElement.style.setProperty("--dur-y", tx * r + "s");
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
v0.0.13
|
||||
Reference in New Issue
Block a user