Embed U-Navigator in Dynamix

This commit is contained in:
Mikei386
2026-06-22 22:21:49 +02:00
parent 92434a945d
commit ae5e192eac
15 changed files with 353 additions and 214 deletions
+8 -14
View File
@@ -11,11 +11,11 @@ Aktueller Stand:
Kurzentscheidung: Kurzentscheidung:
U-Navigator ist als Unraid-Plugin machbar. Empfohlen wird ein hybrider Aufbau aus Unraid-Plugin, lokalem Backend-Dienst und moderner Weboberflaeche. U-Navigator ist als natives Unraid-Dynamix-Plugin umgesetzt. Die Weboberflaeche wird direkt im Unraid-WebGUI geladen; die API-Endpunkte laufen als PHP-Dateien im Plugin.
Naechster sinnvoller Schritt: Naechster sinnvoller Schritt:
Go-Backend oder gebuendelte Runtime, damit das Plugin nicht mehr von einer vorhandenen Node.js-Installation abhaengt. Robuste Hintergrundjobs fuer grosse Copy/Move-Operationen und eine Konfigurationsseite fuer erlaubte Roots.
## Unraid Plugin installieren ## Unraid Plugin installieren
@@ -37,23 +37,17 @@ Oder im WebGUI:
Plugins -> Install Plugin -> URL einfuegen -> Install Plugins -> Install Plugin -> URL einfuegen -> Install
``` ```
Danach starten: Danach oeffnen:
```sh ```text
rc.u-navigator start Tools -> U-Navigator
``` ```
Status pruefen: Es wird kein extra Webserver und kein Node.js auf Unraid benoetigt.
```sh ## Lokal testen
rc.u-navigator status
```
Wichtig: Dieser erste Plugin-Spike benoetigt `node` auf dem Unraid-System. Falls `rc.u-navigator start` meldet, dass Node.js fehlt, muss als naechster Schritt das Backend als Go-Binary gebaut oder Node.js separat bereitgestellt werden. Der historische Node-Prototyp ist fuer lokale API-Tests noch im Repo. Auf Entwicklungsmaschinen ohne `/mnt/user` kann ein Root gesetzt werden:
## Lokal starten
Der Prototyp nutzt standardmaessig `/mnt/user`. Auf Entwicklungsmaschinen ohne diesen Pfad kann ein Root gesetzt werden:
```sh ```sh
U_NAV_ROOT="$PWD" PORT=8088 npm start U_NAV_ROOT="$PWD" PORT=8088 npm start
+4 -7
View File
@@ -2,20 +2,17 @@
set -eu set -eu
PLUGIN="u-navigator" PLUGIN="u-navigator"
VERSION="0.1.0" VERSION="0.2.0"
PKG_DIR="packages" PKG_DIR="packages"
WORK_DIR=".plugin-build" WORK_DIR=".plugin-build"
PKG_NAME="${PLUGIN}-${VERSION}.tgz" PKG_NAME="${PLUGIN}-${VERSION}.tgz"
rm -rf "$WORK_DIR" rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR/usr/local/emhttp/plugins/${PLUGIN}/app" "$PKG_DIR" mkdir -p "$WORK_DIR/usr/local/emhttp/plugins/${PLUGIN}/assets" "$PKG_DIR"
cp -R plugin-root/usr "$WORK_DIR/" cp -R plugin-root/usr "$WORK_DIR/"
cp package.json "$WORK_DIR/usr/local/emhttp/plugins/${PLUGIN}/app/" cp public/app.js "$WORK_DIR/usr/local/emhttp/plugins/${PLUGIN}/assets/app.js"
cp -R public "$WORK_DIR/usr/local/emhttp/plugins/${PLUGIN}/app/" cp public/styles.css "$WORK_DIR/usr/local/emhttp/plugins/${PLUGIN}/assets/styles.css"
cp -R server "$WORK_DIR/usr/local/emhttp/plugins/${PLUGIN}/app/"
find "$WORK_DIR" -name "*.test.js" -delete
chmod +x "$WORK_DIR/usr/local/emhttp/plugins/${PLUGIN}/scripts/rc.u-navigator"
tar -czf "$PKG_DIR/$PKG_NAME" -C "$WORK_DIR" usr tar -czf "$PKG_DIR/$PKG_NAME" -C "$WORK_DIR" usr
rm -rf "$WORK_DIR" rm -rf "$WORK_DIR"
Binary file not shown.
Binary file not shown.
@@ -3,37 +3,24 @@ Title="U-Navigator"
Icon="folder-open" Icon="folder-open"
--- ---
<?PHP <?PHP
$port = 8088; $plugin = "u-navigator";
?> ?>
<style> <link rel="stylesheet" href="/plugins/<?=$plugin?>/assets/styles.css">
.u-navigator-plugin { <div class="u-nav app-shell">
display: grid; <header class="topbar">
gap: 12px; <div>
min-height: calc(100vh - 170px); <h1>U-Navigator</h1>
} <p id="statusText">Initialisiere...</p>
</div>
.u-navigator-plugin iframe { <nav class="toolbar" aria-label="Workspace actions">
border: 1px solid var(--border-color, #d2d8df); <button id="newExplorerButton" title="Explorer oeffnen">Explorer</button>
border-radius: 8px; <button id="newPropertiesButton" title="Eigenschaften oeffnen">Eigenschaften</button>
min-height: calc(100vh - 190px); <button id="newQueueButton" title="Transfer-Queue oeffnen">Transfers</button>
width: 100%; </nav>
} </header>
<main id="workspace" class="workspace" aria-label="U-Navigator Workspace"></main>
.u-navigator-plugin .notice {
color: var(--text-muted, #677);
margin: 0;
}
</style>
<div class="u-navigator-plugin">
<p class="notice">
U-Navigator laeuft als lokaler Dienst auf Port <?=htmlspecialchars($port)?>.
Falls der Rahmen leer bleibt, pruefe den Dienst mit <code>rc.u-navigator status</code>.
</p>
<iframe id="u-navigator-frame" title="U-Navigator"></iframe>
</div> </div>
<script> <script>
(() => { window.UNAV_API_BASE = "/plugins/<?=$plugin?>/api";
const frame = document.getElementById('u-navigator-frame');
frame.src = `${window.location.protocol}//${window.location.hostname}:<?=htmlspecialchars($port)?>/`;
})();
</script> </script>
<script src="/plugins/<?=$plugin?>/assets/app.js"></script>
@@ -0,0 +1,132 @@
<?php
const UNAV_DEFAULT_ROOT = '/mnt/user';
function unav_roots(): array {
$configured = getenv('U_NAV_ROOTS') ?: UNAV_DEFAULT_ROOT;
$roots = array_values(array_filter(array_map('trim', explode(',', $configured))));
if (!$roots) {
$roots = [UNAV_DEFAULT_ROOT];
}
$resolved = [];
foreach ($roots as $root) {
$real = realpath($root);
if ($real !== false && is_dir($real)) {
$resolved[] = [
'id' => 'root' . (count($resolved) + 1),
'label' => $root,
'path' => $real,
];
}
}
if (!$resolved) {
unav_error(500, 'No usable U-Navigator root found');
}
return $resolved;
}
function unav_read_only(): bool {
return getenv('U_NAV_READ_ONLY') === '1';
}
function unav_json($payload, int $status = 200): void {
http_response_code($status);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($payload, JSON_UNESCAPED_SLASHES);
exit;
}
function unav_error(int $status, string $message): void {
unav_json(['error' => $message], $status);
}
function unav_is_inside(string $path, string $root): bool {
if ($path === $root) {
return true;
}
return str_starts_with($path, rtrim($root, '/') . '/');
}
function unav_root_for_real(string $real): array {
foreach (unav_roots() as $root) {
if (unav_is_inside($real, $root['path'])) {
return $root;
}
}
unav_error(403, 'Path is outside allowed roots');
}
function unav_existing_path(?string $input): array {
$roots = unav_roots();
$candidate = $input ?: $roots[0]['path'];
$real = realpath($candidate);
if ($real === false) {
unav_error(404, 'Path not found');
}
$root = unav_root_for_real($real);
return ['root' => $root, 'path' => $real];
}
function unav_destination_path(?string $input): array {
if (!$input) {
unav_error(400, 'Missing destination');
}
$candidate = $input;
$parent = dirname($candidate);
$parentReal = realpath($parent);
if ($parentReal === false) {
unav_error(404, 'Destination parent not found');
}
$root = unav_root_for_real($parentReal);
return ['root' => $root, 'path' => $parentReal . '/' . basename($candidate)];
}
function unav_assert_writable(): void {
if (unav_read_only()) {
unav_error(403, 'Read-only mode is enabled');
}
}
function unav_request_json(): array {
$raw = file_get_contents('php://input');
$data = json_decode($raw ?: '{}', true);
if (!is_array($data)) {
unav_error(400, 'Invalid JSON body');
}
return $data;
}
function unav_copy_recursive(string $source, string $destination): void {
if (is_link($source)) {
unav_error(400, 'Copying symlinks is not allowed');
}
if (is_dir($source)) {
if (!mkdir($destination, 0777, true) && !is_dir($destination)) {
unav_error(500, 'Could not create destination directory');
}
foreach (scandir($source) ?: [] as $entry) {
if ($entry === '.' || $entry === '..') {
continue;
}
unav_copy_recursive($source . '/' . $entry, $destination . '/' . $entry);
}
return;
}
if (!is_file($source)) {
unav_error(400, 'Only files and directories can be copied');
}
if (!copy($source, $destination)) {
unav_error(500, 'Copy failed');
}
}
function unav_guard_destination(string $source, string $destination): void {
if (file_exists($destination)) {
unav_error(409, 'Destination already exists');
}
if ($source === $destination || str_starts_with($destination, rtrim($source, '/') . '/')) {
unav_error(400, 'Destination cannot be inside source');
}
}
@@ -0,0 +1,7 @@
<?php
require_once __DIR__ . '/common.php';
unav_json([
'readOnly' => unav_read_only(),
'roots' => unav_roots(),
]);
@@ -0,0 +1,44 @@
<?php
require_once __DIR__ . '/common.php';
unav_assert_writable();
$action = $_GET['action'] ?? '';
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unav_json([
'id' => $_GET['id'] ?? '0',
'type' => 'unknown',
'status' => 'completed',
'progress' => 100,
'message' => 'Completed',
'error' => null,
'createdAt' => date(DATE_ATOM),
'updatedAt' => date(DATE_ATOM),
]);
}
$data = unav_request_json();
$source = unav_existing_path($data['source'] ?? null);
$destination = unav_destination_path($data['destination'] ?? null);
unav_guard_destination($source['path'], $destination['path']);
if ($action === 'move') {
if (!rename($source['path'], $destination['path'])) {
unav_error(500, 'Move failed');
}
} elseif ($action === 'copy') {
unav_copy_recursive($source['path'], $destination['path']);
} else {
unav_error(404, 'Unknown job action');
}
unav_json([
'id' => (string)time(),
'type' => $action,
'status' => 'completed',
'progress' => 100,
'message' => 'Completed',
'error' => null,
'createdAt' => date(DATE_ATOM),
'updatedAt' => date(DATE_ATOM),
], 202);
@@ -0,0 +1,34 @@
<?php
require_once __DIR__ . '/common.php';
$resolved = unav_existing_path($_GET['path'] ?? null);
if (!is_dir($resolved['path'])) {
unav_error(400, 'Path is not a directory');
}
$entries = [];
foreach (scandir($resolved['path']) ?: [] as $name) {
if ($name === '.' || $name === '..') {
continue;
}
$full = $resolved['path'] . '/' . $name;
$type = is_link($full) ? 'symlink' : (is_dir($full) ? 'directory' : (is_file($full) ? 'file' : 'other'));
$entries[] = [
'name' => $name,
'path' => $full,
'type' => $type,
'size' => is_file($full) ? filesize($full) : 0,
'modifiedAt' => date(DATE_ATOM, filemtime($full) ?: time()),
];
}
usort($entries, function ($a, $b) {
if ($a['type'] === 'directory' && $b['type'] !== 'directory') return -1;
if ($a['type'] !== 'directory' && $b['type'] === 'directory') return 1;
return strnatcasecmp($a['name'], $b['name']);
});
unav_json([
'path' => $resolved['path'],
'entries' => $entries,
]);
@@ -0,0 +1,29 @@
<?php
require_once __DIR__ . '/common.php';
unav_assert_writable();
$target = unav_existing_path($_GET['path'] ?? null);
if (!is_dir($target['path'])) {
unav_error(400, 'Upload target must be a directory');
}
$uploaded = [];
foreach ($_FILES['files']['name'] ?? [] as $index => $name) {
if ($_FILES['files']['error'][$index] !== UPLOAD_ERR_OK) {
unav_error(400, 'Upload failed');
}
$safeName = basename($name);
$destination = unav_destination_path($target['path'] . '/' . $safeName);
if (file_exists($destination['path'])) {
unav_error(409, 'Destination already exists');
}
if (!move_uploaded_file($_FILES['files']['tmp_name'][$index], $destination['path'])) {
unav_error(500, 'Could not store uploaded file');
}
$uploaded[] = [
'name' => $safeName,
'size' => filesize($destination['path']) ?: 0,
];
}
unav_json(['uploaded' => $uploaded], 201);
@@ -1,62 +0,0 @@
#!/bin/bash
PLUGIN="u-navigator"
APP_DIR="/usr/local/emhttp/plugins/${PLUGIN}/app"
PID_FILE="/var/run/${PLUGIN}.pid"
LOG_FILE="/var/log/${PLUGIN}.log"
PORT="${U_NAV_PORT:-8088}"
ROOTS="${U_NAV_ROOTS:-/mnt/user}"
HOST="${U_NAV_HOST:-0.0.0.0}"
is_running() {
[[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null
}
start() {
if is_running; then
echo "${PLUGIN} is already running with PID $(cat "$PID_FILE")"
return 0
fi
if ! command -v node >/dev/null 2>&1; then
echo "node is required but was not found. Install/provide Node.js before starting ${PLUGIN}."
return 1
fi
mkdir -p "$(dirname "$PID_FILE")"
U_NAV_ROOTS="$ROOTS" U_NAV_HOST="$HOST" PORT="$PORT" nohup node "${APP_DIR}/server/server.js" >>"$LOG_FILE" 2>&1 &
echo $! > "$PID_FILE"
echo "${PLUGIN} started on ${HOST}:${PORT} with roots ${ROOTS}"
}
stop() {
if ! is_running; then
rm -f "$PID_FILE"
echo "${PLUGIN} is not running"
return 0
fi
kill "$(cat "$PID_FILE")" 2>/dev/null || true
rm -f "$PID_FILE"
echo "${PLUGIN} stopped"
}
status() {
if is_running; then
echo "${PLUGIN} is running with PID $(cat "$PID_FILE")"
else
echo "${PLUGIN} is not running"
return 1
fi
}
case "$1" in
start) start ;;
stop) stop ;;
restart) stop; start ;;
status) status ;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 2
;;
esac
+10 -5
View File
@@ -1,5 +1,6 @@
const workspace = document.querySelector('#workspace'); const workspace = document.querySelector('#workspace');
const statusText = document.querySelector('#statusText'); const statusText = document.querySelector('#statusText');
const API_BASE = window.UNAV_API_BASE || '/api';
const state = { const state = {
config: null, config: null,
windows: [], windows: [],
@@ -25,7 +26,7 @@ init();
async function init() { async function init() {
try { try {
state.config = await api('/api/config'); state.config = await api(apiUrl('config'));
statusText.textContent = `${state.config.roots.length} Root, ${state.config.readOnly ? 'Read-only' : 'Schreibzugriff aktiv'}`; statusText.textContent = `${state.config.roots.length} Root, ${state.config.readOnly ? 'Read-only' : 'Schreibzugriff aktiv'}`;
openExplorer(state.config.roots[0].path); openExplorer(state.config.roots[0].path);
openProperties(); openProperties();
@@ -276,7 +277,7 @@ async function loadExplorer(win, targetPath) {
win.data.path = targetPath; win.data.path = targetPath;
render(); render();
try { try {
const result = await api(`/api/list?path=${encodeURIComponent(targetPath)}`); const result = await api(apiUrl(`list.php?path=${encodeURIComponent(targetPath)}`));
win.data.path = result.path; win.data.path = result.path;
win.data.entries = result.entries; win.data.entries = result.entries;
} catch (error) { } catch (error) {
@@ -307,7 +308,7 @@ async function handleDrop(event, win, targetPath) {
for (const file of event.dataTransfer.files) { for (const file of event.dataTransfer.files) {
form.append('files', file, file.name); form.append('files', file, file.name);
} }
await fetchChecked(`/api/upload?path=${encodeURIComponent(targetPath)}`, { await fetchChecked(apiUrl(`upload.php?path=${encodeURIComponent(targetPath)}`), {
method: 'POST', method: 'POST',
body: form body: form
}); });
@@ -316,7 +317,7 @@ async function handleDrop(event, win, targetPath) {
} }
async function createJob(type, source, destination) { async function createJob(type, source, destination) {
const job = await api(`/api/jobs/${type}`, { const job = await api(apiUrl(`job.php?action=${encodeURIComponent(type)}`), {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ source, destination }) body: JSON.stringify({ source, destination })
@@ -327,7 +328,7 @@ async function createJob(type, source, destination) {
} }
async function pollJob(id) { async function pollJob(id) {
const job = await api(`/api/jobs/${id}`); const job = await api(apiUrl(`job.php?id=${encodeURIComponent(id)}`));
state.jobs.set(id, job); state.jobs.set(id, job);
render(); render();
if (['queued', 'running', 'cancel_requested'].includes(job.status)) { if (['queued', 'running', 'cancel_requested'].includes(job.status)) {
@@ -446,3 +447,7 @@ function escapeAttr(value) {
function clamp(value, min, max) { function clamp(value, min, max) {
return Math.max(min, Math.min(max, value)); return Math.max(min, Math.min(max, value));
} }
function apiUrl(path) {
return `${API_BASE.replace(/\/$/, '')}/${path.replace(/^\//, '')}`;
}
+58 -74
View File
@@ -1,5 +1,4 @@
:root { .u-nav {
color-scheme: light dark;
--bg: #f4f6f8; --bg: #f4f6f8;
--surface: #ffffff; --surface: #ffffff;
--surface-2: #eef2f5; --surface-2: #eef2f5;
@@ -8,12 +7,17 @@
--line: #cfd8e1; --line: #cfd8e1;
--accent: #e86f2d; --accent: #e86f2d;
--accent-2: #287a65; --accent-2: #287a65;
--danger: #b52c34;
--shadow: 0 18px 55px rgba(24, 34, 45, 0.22); --shadow: 0 18px 55px rgba(24, 34, 45, 0.22);
background: var(--bg);
color: var(--text);
display: grid;
font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
grid-template-rows: auto 1fr;
min-height: calc(100vh - 170px);
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { .u-nav {
--bg: #101418; --bg: #101418;
--surface: #1b2229; --surface: #1b2229;
--surface-2: #242e37; --surface-2: #242e37;
@@ -24,22 +28,16 @@
} }
} }
* { .u-nav *,
.u-nav *::before,
.u-nav *::after {
box-sizing: border-box; box-sizing: border-box;
} }
body { .u-nav button {
margin: 0; background: var(--surface);
min-height: 100vh;
background: var(--bg);
color: var(--text);
font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button {
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: 6px; border-radius: 6px;
background: var(--surface);
color: var(--text); color: var(--text);
cursor: pointer; cursor: pointer;
font: inherit; font: inherit;
@@ -47,17 +45,11 @@ button {
padding: 0 10px; padding: 0 10px;
} }
button:hover { .u-nav button:hover {
border-color: var(--accent); border-color: var(--accent);
} }
button.primary { .u-nav button.icon {
background: var(--accent);
border-color: var(--accent);
color: #fff;
}
button.icon {
align-items: center; align-items: center;
display: inline-flex; display: inline-flex;
height: 30px; height: 30px;
@@ -67,13 +59,7 @@ button.icon {
width: 32px; width: 32px;
} }
.app-shell { .u-nav .topbar {
display: grid;
grid-template-rows: auto 1fr;
min-height: 100vh;
}
.topbar {
align-items: center; align-items: center;
background: var(--surface); background: var(--surface);
border-bottom: 1px solid var(--line); border-bottom: 1px solid var(--line);
@@ -83,30 +69,32 @@ button.icon {
padding: 12px 16px; padding: 12px 16px;
} }
.topbar h1 { .u-nav .topbar h1 {
color: var(--text);
font-size: 18px; font-size: 18px;
line-height: 1; line-height: 1;
margin: 0 0 4px; margin: 0 0 4px;
} }
.topbar p { .u-nav .topbar p,
.u-nav .muted {
color: var(--muted); color: var(--muted);
margin: 0; margin: 0;
} }
.toolbar { .u-nav .toolbar {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 8px; gap: 8px;
} }
.workspace { .u-nav .workspace {
min-height: 0; min-height: 0;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
.window { .u-nav .window {
background: var(--surface); background: var(--surface);
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: 8px; border-radius: 8px;
@@ -119,15 +107,15 @@ button.icon {
position: absolute; position: absolute;
} }
.window.focused { .u-nav .window.focused {
border-color: color-mix(in srgb, var(--accent) 62%, var(--line)); border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
} }
.window.maximized { .u-nav .window.maximized {
border-radius: 0; border-radius: 0;
} }
.titlebar { .u-nav .titlebar {
align-items: center; align-items: center;
background: var(--surface-2); background: var(--surface-2);
border-bottom: 1px solid var(--line); border-bottom: 1px solid var(--line);
@@ -140,24 +128,24 @@ button.icon {
user-select: none; user-select: none;
} }
.titlebar strong { .u-nav .titlebar strong {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.window-actions { .u-nav .window-actions {
display: flex; display: flex;
gap: 6px; gap: 6px;
} }
.window-body { .u-nav .window-body {
min-height: 0; min-height: 0;
overflow: auto; overflow: auto;
padding: 10px; padding: 10px;
} }
.resize-handle { .u-nav .resize-handle {
bottom: 0; bottom: 0;
cursor: nwse-resize; cursor: nwse-resize;
height: 18px; height: 18px;
@@ -166,7 +154,7 @@ button.icon {
width: 18px; width: 18px;
} }
.resize-handle::after { .u-nav .resize-handle::after {
border-bottom: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
border-right: 2px solid var(--muted); border-right: 2px solid var(--muted);
bottom: 5px; bottom: 5px;
@@ -177,7 +165,7 @@ button.icon {
width: 8px; width: 8px;
} }
.pathbar { .u-nav .pathbar {
align-items: center; align-items: center;
display: grid; display: grid;
gap: 8px; gap: 8px;
@@ -185,7 +173,7 @@ button.icon {
margin-bottom: 10px; margin-bottom: 10px;
} }
.pathbar input { .u-nav .pathbar input {
background: var(--surface-2); background: var(--surface-2);
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: 6px; border-radius: 6px;
@@ -196,53 +184,53 @@ button.icon {
width: 100%; width: 100%;
} }
.drop-zone { .u-nav .drop-zone {
border: 1px dashed transparent; border: 1px dashed transparent;
border-radius: 8px; border-radius: 8px;
min-height: 180px; min-height: 180px;
} }
.drop-zone.drag-over { .u-nav .drop-zone.drag-over {
background: color-mix(in srgb, var(--accent) 10%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent);
border-color: var(--accent); border-color: var(--accent);
} }
.file-table { .u-nav .file-table {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
} }
.file-table th, .u-nav .file-table th,
.file-table td { .u-nav .file-table td {
border-bottom: 1px solid var(--line); border-bottom: 1px solid var(--line);
padding: 8px 7px; padding: 8px 7px;
text-align: left; text-align: left;
vertical-align: middle; vertical-align: middle;
} }
.file-table th { .u-nav .file-table th {
color: var(--muted); color: var(--muted);
font-size: 12px; font-size: 12px;
font-weight: 600; font-weight: 600;
} }
.file-row { .u-nav .file-row {
cursor: default; cursor: default;
} }
.file-row:hover, .u-nav .file-row:hover,
.file-row.selected { .u-nav .file-row.selected {
background: var(--surface-2); background: var(--surface-2);
} }
.name-cell { .u-nav .name-cell {
align-items: center; align-items: center;
display: flex; display: flex;
gap: 8px; gap: 8px;
min-width: 150px; min-width: 150px;
} }
.badge { .u-nav .badge {
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: 999px; border-radius: 999px;
color: var(--muted); color: var(--muted);
@@ -253,22 +241,18 @@ button.icon {
padding: 2px 8px; padding: 2px 8px;
} }
.muted { .u-nav .queue-list {
color: var(--muted);
}
.queue-list {
display: grid; display: grid;
gap: 10px; gap: 10px;
} }
.job { .u-nav .job {
border: 1px solid var(--line); border: 1px solid var(--line);
border-radius: 8px; border-radius: 8px;
padding: 10px; padding: 10px;
} }
.progress { .u-nav .progress {
background: var(--surface-2); background: var(--surface-2);
border-radius: 999px; border-radius: 999px;
height: 8px; height: 8px;
@@ -276,40 +260,40 @@ button.icon {
overflow: hidden; overflow: hidden;
} }
.progress div { .u-nav .progress div {
background: var(--accent-2); background: var(--accent-2);
height: 100%; height: 100%;
width: 0; width: 0;
} }
.properties dl { .u-nav .properties dl {
display: grid; display: grid;
grid-template-columns: max-content 1fr;
gap: 8px 14px; gap: 8px 14px;
grid-template-columns: max-content 1fr;
margin: 0; margin: 0;
} }
.properties dt { .u-nav .properties dt {
color: var(--muted); color: var(--muted);
} }
.properties dd { .u-nav .properties dd {
margin: 0; margin: 0;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
@media (max-width: 720px) { @media (max-width: 720px) {
.topbar { .u-nav .topbar {
align-items: flex-start; align-items: flex-start;
flex-direction: column; flex-direction: column;
} }
.workspace { .u-nav .workspace {
overflow: auto; overflow: auto;
} }
.window, .u-nav .window,
.window.maximized { .u-nav .window.maximized {
border-left: 0; border-left: 0;
border-radius: 0; border-radius: 0;
border-right: 0; border-right: 0;
@@ -321,11 +305,11 @@ button.icon {
width: 100% !important; width: 100% !important;
} }
.window:not(.focused) { .u-nav .window:not(.focused) {
display: none; display: none;
} }
.resize-handle { .u-nav .resize-handle {
display: none; display: none;
} }
} }
+6 -12
View File
@@ -1,37 +1,32 @@
<!DOCTYPE PLUGIN [ <!DOCTYPE PLUGIN [
<!ENTITY name "u-navigator"> <!ENTITY name "u-navigator">
<!ENTITY author "michael"> <!ENTITY author "michael">
<!ENTITY version "0.1.0"> <!ENTITY version "0.2.0">
<!ENTITY package "&name;-&version;.tgz"> <!ENTITY package "&name;-&version;.tgz">
]> ]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg"> <PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
<CHANGES> <CHANGES>
### &version; ### &version;
- Initial U-Navigator plugin spike. - Native Dynamix-embedded U-Navigator page.
- Installs WebGUI page, Node.js prototype backend, in-app window manager and drag-and-drop file navigator. - Adds PHP API endpoints for listing, upload, move and copy without a separate web server.
</CHANGES> </CHANGES>
<FILE Name="/boot/config/plugins/&name;/&package;"> <FILE Name="/boot/config/plugins/&name;/&package;">
<URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL> <URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL>
<MD5>9d6e248cb70c803f04bf491b06520764</MD5> <MD5>47fea71317002e9ea131ca468a870c69</MD5>
</FILE> </FILE>
<FILE Run="/bin/bash"> <FILE Run="/bin/bash">
<INLINE> <INLINE>
mkdir -p /boot/config/plugins/&name; mkdir -p /boot/config/plugins/&name;
tar -xzf /boot/config/plugins/&name;/&package; -C / tar -xzf /boot/config/plugins/&name;/&package; -C /
chmod +x /usr/local/emhttp/plugins/&name;/scripts/rc.u-navigator find /boot/config/plugins/&name; -type f -name "&name;-*.tgz" ! -name "&package;" -delete
ln -sf /usr/local/emhttp/plugins/&name;/scripts/rc.u-navigator /usr/local/sbin/rc.u-navigator
echo "" echo ""
echo "-----------------------------------------------------------" echo "-----------------------------------------------------------"
echo " &name; &version; has been installed." echo " &name; &version; has been installed."
echo "" echo ""
echo " Start: rc.u-navigator start" echo " Open: Tools -> U-Navigator"
echo " Stop: rc.u-navigator stop"
echo " Status: rc.u-navigator status"
echo ""
echo " Note: This prototype requires Node.js to be available on Unraid."
echo "-----------------------------------------------------------" echo "-----------------------------------------------------------"
echo "" echo ""
</INLINE> </INLINE>
@@ -39,7 +34,6 @@ echo ""
<FILE Run="/bin/bash" Method="remove"> <FILE Run="/bin/bash" Method="remove">
<INLINE> <INLINE>
rc.u-navigator stop 2>/dev/null || true
rm -f /usr/local/sbin/rc.u-navigator rm -f /usr/local/sbin/rc.u-navigator
rm -rf /usr/local/emhttp/plugins/&name; rm -rf /usr/local/emhttp/plugins/&name;
rm -rf /boot/config/plugins/&name; rm -rf /boot/config/plugins/&name;
+4 -10
View File
@@ -8,8 +8,8 @@
<CHANGES> <CHANGES>
### &version; ### &version;
- Initial U-Navigator plugin spike. - Native Dynamix-embedded U-Navigator page.
- Installs WebGUI page, Node.js prototype backend, in-app window manager and drag-and-drop file navigator. - Adds PHP API endpoints for listing, upload, move and copy without a separate web server.
</CHANGES> </CHANGES>
<FILE Name="/boot/config/plugins/&name;/&package;"> <FILE Name="/boot/config/plugins/&name;/&package;">
@@ -21,17 +21,12 @@
<INLINE> <INLINE>
mkdir -p /boot/config/plugins/&name; mkdir -p /boot/config/plugins/&name;
tar -xzf /boot/config/plugins/&name;/&package; -C / tar -xzf /boot/config/plugins/&name;/&package; -C /
chmod +x /usr/local/emhttp/plugins/&name;/scripts/rc.u-navigator find /boot/config/plugins/&name; -type f -name "&name;-*.tgz" ! -name "&package;" -delete
ln -sf /usr/local/emhttp/plugins/&name;/scripts/rc.u-navigator /usr/local/sbin/rc.u-navigator
echo "" echo ""
echo "-----------------------------------------------------------" echo "-----------------------------------------------------------"
echo " &name; &version; has been installed." echo " &name; &version; has been installed."
echo "" echo ""
echo " Start: rc.u-navigator start" echo " Open: Tools -> U-Navigator"
echo " Stop: rc.u-navigator stop"
echo " Status: rc.u-navigator status"
echo ""
echo " Note: This prototype requires Node.js to be available on Unraid."
echo "-----------------------------------------------------------" echo "-----------------------------------------------------------"
echo "" echo ""
</INLINE> </INLINE>
@@ -39,7 +34,6 @@ echo ""
<FILE Run="/bin/bash" Method="remove"> <FILE Run="/bin/bash" Method="remove">
<INLINE> <INLINE>
rc.u-navigator stop 2>/dev/null || true
rm -f /usr/local/sbin/rc.u-navigator rm -f /usr/local/sbin/rc.u-navigator
rm -rf /usr/local/emhttp/plugins/&name; rm -rf /usr/local/emhttp/plugins/&name;
rm -rf /boot/config/plugins/&name; rm -rf /boot/config/plugins/&name;