ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
feat(files): per-target quick-access rail for remote agents
Juan Denis9dfed262d6b1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7d4d8bce..31f57954 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -287,7 +287,11 @@ awaiting a stable release:`SERVERKIT_DIR`), prefers the running tree over a stale `/opt/serverkit`, andthe Docker image now ships the `VERSION` file (containers previously showedthe `1.0.0` fallback). The File Manager's "Stack" quick link follows the same- resolved install directory instead of assuming `/opt/serverkit`.+ resolved install directory instead of assuming `/opt/serverkit`, and when+ browsing a remote agent the quick-access rail now matches that box: Linux+ agents get their agent config dir alongside the generic paths, Windows agents+ get `ProgramData\ServerKit\Agent` + `C:\Users` instead of Unix paths that+ don't exist there.- **Scripts reliability (round 2)** — swept the whole install/update/uninstall/CLIshell surface for the "benign non-zero under `set -e`/`pipefail`" failure classbehind the July 2 update outage:diff --git a/backend/app/services/remote_docker_service.py b/backend/app/services/remote_docker_service.pyindex fc9e4469..25fa5e1a 100644--- a/backend/app/services/remote_docker_service.py+++ b/backend/app/services/remote_docker_service.py@@ -511,6 +511,9 @@ class RemoteDockerService:'group_name': server.group.name if server.group else None,'capabilities': caps or {},'allowed_paths': allowed_paths,+ # linux/windows/darwin — lets target-aware UIs (File Manager+ # quick links) offer paths that exist on that box.+ 'os_type': server.os_type,})return serversdiff --git a/backend/tests/test_available_servers.py b/backend/tests/test_available_servers.pynew file mode 100644index 00000000..c7486523--- /dev/null+++ b/backend/tests/test_available_servers.py@@ -0,0 +1,43 @@+"""/servers/available feeds the target pickers (File Manager, Cron, …) — it+must carry os_type so target-aware UIs can offer paths that actually exist on+the selected box (a Windows agent has no /var/www)."""+from app import db+from app.models.server import Server+from app.services.remote_docker_service import RemoteDockerService+++def _make_server(**overrides):+ data = dict(+ name='Test Agent',+ hostname='agent.example.com',+ ip_address='203.0.113.20',+ status='online',+ )+ data.update(overrides)+ server = Server(**data)+ db.session.add(server)+ db.session.commit()+ return server+++def test_available_servers_include_os_type(app):+ with app.app_context():+ _make_server(name='Win Agent', os_type='windows')++ servers = RemoteDockerService.get_available_servers()+ remote = [s for s in servers if not s['is_local']]+ assert remote, 'online server missing from the available list'+ assert remote[0]['os_type'] == 'windows'+++def test_available_servers_os_type_null_for_legacy_agents(app):+ """Agents enrolled before sysinfo reporting have no os_type — the field+ must still be present (null), not absent, so consumers can key off it."""+ with app.app_context():+ _make_server(name='Old Agent', os_type=None)++ servers = RemoteDockerService.get_available_servers()+ remote = [s for s in servers if not s['is_local']]+ assert remote+ assert 'os_type' in remote[0]+ assert remote[0]['os_type'] is Nonediff --git a/frontend/src/components/TargetPicker.jsx b/frontend/src/components/TargetPicker.jsxindex 38f7025f..7b3bdbe1 100644--- a/frontend/src/components/TargetPicker.jsx+++ b/frontend/src/components/TargetPicker.jsx@@ -11,9 +11,11 @@ import { api } from '../services/api';// reported capabilities yet (older builds) are filtered out — same// pattern as the cron picker.//-// onChange receives `{ kind: 'local' } | { kind: 'agent', server_id, name, allowedPaths }`,-// or `{ kind: <extra.value> }` for any caller-supplied `extraOptions` (e.g. an-// "S3 bucket" target in the File Manager).+// onChange receives `{ kind: 'local' } | { kind: 'agent', server_id, name,+// allowedPaths, os_type }` (os_type: linux/windows/darwin or null for agents+// that predate sysinfo reporting), or `{ kind: <extra.value> }` for any+// caller-supplied `extraOptions` (e.g. an "S3 bucket" target in the File+// Manager).export default function TargetPicker({ feature, value, onChange, includeLocal = true, extraOptions = [] }) {const [servers, setServers] = useState([]);@@ -51,6 +53,7 @@ export default function TargetPicker({ feature, value, onChange, includeLocal =server_id: s.id,name: s.name || s.hostname || s.id,allowedPaths: s.allowed_paths || [],+ os_type: s.os_type || null,});}diff --git a/frontend/src/pages/FileManager.jsx b/frontend/src/pages/FileManager.jsxindex 45b939db..ac42527b 100644--- a/frontend/src/pages/FileManager.jsx+++ b/frontend/src/pages/FileManager.jsx@@ -37,6 +37,29 @@ const QUICK_ACCESS = [{ label: 'Logs', path: '/var/log', icon: FileText },];+// Remote-agent rails: the panel stack doesn't exist on an agent box, so link+// the agent's own footprint instead. These paths are fixed by the agent+// installers the panel serves (scripts/install.sh: /etc/serverkit-agent;+// scripts/install.ps1: ProgramData\ServerKit\Agent) — agents run on the wire+// with forward-slash paths, Windows included.+const QUICK_ACCESS_AGENT = {+ linux: [+ { label: 'Sites', path: '/var/www', icon: Globe },+ { label: 'Agent', path: '/etc/serverkit-agent', icon: Boxes },+ { label: 'Web config', path: '/etc/nginx', icon: SlidersHorizontal },+ { label: 'Logs', path: '/var/log', icon: FileText },+ ],+ windows: [+ { label: 'Agent', path: 'C:/ProgramData/ServerKit/Agent', icon: Boxes },+ { label: 'Agent logs', path: 'C:/ProgramData/ServerKit/Agent/logs', icon: FileText },+ { label: 'Users', path: 'C:/Users', icon: Home },+ ],+ darwin: [+ { label: 'Home', path: '/Users', icon: Home },+ { label: 'Logs', path: '/var/log', icon: FileText },+ ],+};+// File manager operations that the agent can serve over file:* commands.// Anything else (mkdir, delete, rename, copy, chmod, search, disk usage,// upload/download) is panel-host-only until the matching agent verbs land.@@ -124,20 +147,30 @@ function FileManager() {// The "Stack" quick link tracks the panel's real install dir (custom// SERVERKIT_DIR installs aren't at /opt/serverkit).- const [quickAccess, setQuickAccess] = useState(QUICK_ACCESS);+ const [panelInstallDir, setPanelInstallDir] = useState('/opt/serverkit');useEffect(() => {let cancelled = false;api.getVersion().then((v) => {- if (cancelled || !v?.install_dir) return;- setQuickAccess((links) => links.map((q) =>- q.label === 'Stack' ? { ...q, path: v.install_dir } : q- ));+ if (!cancelled && v?.install_dir) setPanelInstallDir(v.install_dir);}).catch(() => {});return () => { cancelled = true; };}, []);+ // Per-target rail: agents get their OS's set (unknown os_type — an agent+ // predating sysinfo reporting — is treated as linux, the historical+ // behavior); the local host gets the panel set with the resolved Stack dir.+ const quickAccess = useMemo(() => {+ if (isRemote) {+ const os = (target.os_type || 'linux').toLowerCase();+ return QUICK_ACCESS_AGENT[os] || QUICK_ACCESS_AGENT.linux;+ }+ return QUICK_ACCESS.map((q) =>+ q.label === 'Stack' ? { ...q, path: panelInstallDir } : q+ );+ }, [isRemote, target.os_type, panelInstallDir]);+// ─── core ────────────────────────────────────────────const [currentPath, setCurrentPath] = useState(() => searchParams.get('path') || '/home');const [entries, setEntries] = useState([]);