mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-06 17:07:08 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ffb9f21ea5 | |||
| c44f009eaf | |||
| 541b626be2 | |||
| 203e48c31c | |||
| 8b878b183b | |||
| a38827da54 | |||
| 25c0fe2b4b |
@@ -51,6 +51,11 @@ export async function show_html(ip: string, html: string): Promise<void> {
|
||||
await request_display(ip, '/showHTML', options);
|
||||
}
|
||||
|
||||
export async function show_website(ip: string, url: string): Promise<void> {
|
||||
const command = `screen -dmS custom_website chromium-browser --user-data-dir=$(mktemp -d) --start-fullscreen --app="${url}"`;
|
||||
await run_shell_command(ip, command);
|
||||
}
|
||||
|
||||
export async function get_file_data(
|
||||
ip: string,
|
||||
path: string
|
||||
|
||||
@@ -395,15 +395,6 @@ export async function run_for_selected_files_on_selected_displays(
|
||||
}
|
||||
}
|
||||
|
||||
export async function create_folder_on_all_selected_displays(
|
||||
folder_name: string,
|
||||
path: string,
|
||||
selected_display_ids: string[]
|
||||
): Promise<void> {
|
||||
const path_with_folder_name = (path += folder_name + '/');
|
||||
await create_path_on_all_selected_displays(path_with_folder_name, selected_display_ids);
|
||||
}
|
||||
|
||||
export async function create_path_on_all_selected_displays(
|
||||
path: string,
|
||||
selected_display_ids: string[]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
show_blackscreen,
|
||||
shutdown,
|
||||
startup,
|
||||
show_html
|
||||
show_website
|
||||
} from '$lib/ts/api_handler';
|
||||
import {
|
||||
get_display_by_id,
|
||||
@@ -44,7 +44,7 @@
|
||||
let popup_content: PopupContent = $state({
|
||||
open: false,
|
||||
snippet: null,
|
||||
title: '',
|
||||
title: ''
|
||||
});
|
||||
|
||||
let current_text = $state('');
|
||||
@@ -79,7 +79,7 @@
|
||||
snippet: website_popup,
|
||||
title: 'Webseite Anzeigen',
|
||||
window_class: 'w-xl',
|
||||
title_icon: Globe,
|
||||
title_icon: Globe
|
||||
};
|
||||
};
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
open: true,
|
||||
snippet: ask_shutdown_popup,
|
||||
title: 'Bildschirm Herunterfahren',
|
||||
title_icon: PowerOff,
|
||||
title_icon: PowerOff
|
||||
};
|
||||
}
|
||||
|
||||
@@ -110,7 +110,10 @@
|
||||
popup_content.open = false;
|
||||
await run_on_all_selected_displays((d) => {
|
||||
shutdown(d.ip); // no await here because we want to be fast
|
||||
db.displays.update(d.id, { status: 'app_offline', preview: { currently_updating: false, url: null} });
|
||||
db.displays.update(d.id, {
|
||||
status: 'app_offline',
|
||||
preview: { currently_updating: false, url: null }
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
@@ -143,9 +146,7 @@
|
||||
|
||||
async function send_website() {
|
||||
popup_content.open = false;
|
||||
await run_on_all_selected_displays((d) =>
|
||||
show_html(d.ip, `<iframe src="${website_url}"></iframe>`)
|
||||
);
|
||||
await run_on_all_selected_displays((d) => show_website(d.ip, website_url));
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -185,11 +186,11 @@
|
||||
{/snippet}
|
||||
|
||||
{#snippet send_keys_popup()}
|
||||
<KeyInput {popup_close_function}/>
|
||||
<KeyInput {popup_close_function} />
|
||||
{/snippet}
|
||||
|
||||
{#snippet text_popup()}
|
||||
<TipTapInput bind:text={current_text}/>
|
||||
<TipTapInput bind:text={current_text} />
|
||||
{/snippet}
|
||||
|
||||
<div class="grid grid-rows-[2.5rem_auto] bg-stone-800 rounded-2xl min-w-0">
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
import { change_height, current_height, next_height_step_size } from '$lib/ts/stores/ui_behavior';
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import PathBar from './PathBar.svelte';
|
||||
import { selected_display_ids, selected_file_ids } from '$lib/ts/stores/select';
|
||||
import { select, selected_display_ids, selected_file_ids } from '$lib/ts/stores/select';
|
||||
import {
|
||||
current_file_path,
|
||||
get_folder_elements,
|
||||
@@ -22,7 +22,8 @@
|
||||
run_for_selected_files_on_selected_displays,
|
||||
update_current_folder_on_selected_displays,
|
||||
get_displays_where_path_not_exists,
|
||||
create_folder_on_all_selected_displays
|
||||
create_path_on_all_selected_displays
|
||||
|
||||
} from '$lib/ts/stores/files';
|
||||
import { slide } from 'svelte/transition';
|
||||
import InodeElement from '../lib/components/InodeElement.svelte';
|
||||
@@ -89,11 +90,8 @@
|
||||
|
||||
async function create_new_folder() {
|
||||
popup_close_function();
|
||||
await create_folder_on_all_selected_displays(
|
||||
current_name.trim(),
|
||||
$current_file_path,
|
||||
$selected_display_ids
|
||||
);
|
||||
const path_with_folder_name = ($current_file_path += current_name.trim() + '/');
|
||||
await create_path_on_all_selected_displays(path_with_folder_name, $selected_display_ids);
|
||||
await update_current_folder_on_selected_displays();
|
||||
}
|
||||
|
||||
@@ -149,16 +147,17 @@
|
||||
};
|
||||
|
||||
async function sync_selected_files(
|
||||
selected_file_ids: string[],
|
||||
current_selected_file_ids: string[],
|
||||
selected_display_ids: string[],
|
||||
current_folder_elements: Inode[]
|
||||
) {
|
||||
if (selected_file_ids.length === 0 && current_folder_elements.length > 0) {
|
||||
selected_file_ids = current_folder_elements.map((inode) => get_file_primary_key(inode));
|
||||
if (current_selected_file_ids.length === 0 && current_folder_elements.length > 0) {
|
||||
current_selected_file_ids = current_folder_elements.map((inode) => get_file_primary_key(inode));
|
||||
}
|
||||
if (selected_file_ids.length === 0) return;
|
||||
if (current_selected_file_ids.length === 0) return;
|
||||
// Mit For-Schleife über ausgewählte Elemente gehen
|
||||
for (const file_id of selected_file_ids) {
|
||||
for (const file_id of current_selected_file_ids) {
|
||||
await select(selected_file_ids, file_id, 'deselect');
|
||||
await add_sync_recursively(file_id, selected_display_ids);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package pkg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"plg-mudics/shared"
|
||||
"syscall"
|
||||
|
||||
@@ -36,7 +38,17 @@ func (fh *fileHandler) OpenFile(path string) error {
|
||||
|
||||
switch mType.String() {
|
||||
case "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.oasis.opendocument.presentation":
|
||||
fh.runningProgram = exec.Command("soffice", "--show", path, "--nologo", "--view", "--norestore", fmt.Sprintf("-env:UserInstallation=file://%s", tempDirPath))
|
||||
// yes, we need this weird workaround to delete lock files since libreoffice
|
||||
// doesn't expose an option to ignore them or prevent their creation
|
||||
// the --view argument for some reason doesn't work with --show
|
||||
parent := filepath.Dir(path)
|
||||
cmd := exec.Command("find", parent, "-name", ".~lock*", "-type", "f", "-delete")
|
||||
result := shared.RunShellCommand(cmd)
|
||||
if result.ExitCode != 0 {
|
||||
slog.Warn("could not remove lock files", "path", parent, "stderr", result.Stderr, "exitCode", result.ExitCode)
|
||||
}
|
||||
|
||||
fh.runningProgram = exec.Command("soffice", "--show", path, "--nologo", "--norestore", fmt.Sprintf("-env:UserInstallation=file://%s", tempDirPath))
|
||||
case "application/pdf":
|
||||
fh.runningProgram = exec.Command("xreader", path, "--presentation")
|
||||
default:
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
xreader
|
||||
tree
|
||||
jq
|
||||
screen
|
||||
|
||||
# Libraries
|
||||
imagemagick
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
v0.0.17
|
||||
v0.0.19
|
||||
Reference in New Issue
Block a user