Self-hosted, plugin-based server management.
TypeScript dockerhomelabpluginsrdpremote-desktopself-hostedserver-managementsftpsshterminaltermixvnc
Fix database old config editor paths
LukeGuscf945e366522
diff --git a/src/backend/database/db/schema.ts b/src/backend/database/db/schema.tsindex 2672c1409..8d3589935 100644--- a/src/backend/database/db/schema.ts+++ b/src/backend/database/db/schema.ts@@ -42,13 +42,13 @@ export const sshData = sqliteTable('ssh_data', {enableTerminal: integer('enable_terminal', {mode: 'boolean'}).notNull().default(true),enableTunnel: integer('enable_tunnel', {mode: 'boolean'}).notNull().default(true),tunnelConnections: text('tunnel_connections'),- enableConfigEditor: integer('enable_file_manager', {mode: 'boolean'}).notNull().default(true),+ enableFileManager: integer('enable_file_manager', {mode: 'boolean'}).notNull().default(true),defaultPath: text('default_path'),createdAt: text('created_at').notNull().default(sql`CURRENT_TIMESTAMP`),updatedAt: text('updated_at').notNull().default(sql`CURRENT_TIMESTAMP`),});-export const configEditorRecent = sqliteTable('file_manager_recent', {+export const fileManagerRecent = sqliteTable('file_manager_recent', {id: integer('id').primaryKey({autoIncrement: true}),userId: text('user_id').notNull().references(() => users.id),hostId: integer('host_id').notNull().references(() => sshData.id),@@ -57,7 +57,7 @@ export const configEditorRecent = sqliteTable('file_manager_recent', {lastOpened: text('last_opened').notNull().default(sql`CURRENT_TIMESTAMP`),});-export const configEditorPinned = sqliteTable('file_manager_pinned', {+export const fileManagerPinned = sqliteTable('file_manager_pinned', {id: integer('id').primaryKey({autoIncrement: true}),userId: text('user_id').notNull().references(() => users.id),hostId: integer('host_id').notNull().references(() => sshData.id),@@ -66,7 +66,7 @@ export const configEditorPinned = sqliteTable('file_manager_pinned', {pinnedAt: text('pinned_at').notNull().default(sql`CURRENT_TIMESTAMP`),});-export const configEditorShortcuts = sqliteTable('file_manager_shortcuts', {+export const fileManagerShortcuts = sqliteTable('file_manager_shortcuts', {id: integer('id').primaryKey({autoIncrement: true}),userId: text('user_id').notNull().references(() => users.id),hostId: integer('host_id').notNull().references(() => sshData.id),diff --git a/src/backend/database/routes/ssh.ts b/src/backend/database/routes/ssh.tsindex b8b66e187..0ec3b4b19 100644--- a/src/backend/database/routes/ssh.ts+++ b/src/backend/database/routes/ssh.ts@@ -1,6 +1,6 @@import express from 'express';import {db} from '../db/index.js';-import {sshData, configEditorRecent, configEditorPinned, configEditorShortcuts} from '../db/schema.js';+import {sshData, fileManagerRecent, fileManagerPinned, fileManagerShortcuts} from '../db/schema.js';import {eq, and, desc} from 'drizzle-orm';import chalk from 'chalk';import jwt from 'jsonwebtoken';@@ -101,7 +101,7 @@ router.get('/db/host/internal', async (req: Request, res: Response) => {enableTerminal: !!row.enableTerminal,enableTunnel: !!row.enableTunnel,tunnelConnections: row.tunnelConnections ? JSON.parse(row.tunnelConnections) : [],- enableConfigEditor: !!row.enableConfigEditor,+ enableFileManager: !!row.enableFileManager,}));res.json(result);} catch (err) {@@ -150,7 +150,7 @@ router.post('/db/host', authenticateJWT, upload.single('key'), async (req: Requepin,enableTerminal,enableTunnel,- enableConfigEditor,+ enableFileManager,defaultPath,tunnelConnections} = hostData;@@ -173,7 +173,7 @@ router.post('/db/host', authenticateJWT, upload.single('key'), async (req: RequeenableTerminal: !!enableTerminal ? 1 : 0,enableTunnel: !!enableTunnel ? 1 : 0,tunnelConnections: Array.isArray(tunnelConnections) ? JSON.stringify(tunnelConnections) : null,- enableConfigEditor: !!enableConfigEditor ? 1 : 0,+ enableFileManager: !!enableFileManager ? 1 : 0,defaultPath: defaultPath || null,};@@ -238,7 +238,7 @@ router.put('/db/host/:id', authenticateJWT, upload.single('key'), async (req: Repin,enableTerminal,enableTunnel,- enableConfigEditor,+ enableFileManager,defaultPath,tunnelConnections} = hostData;@@ -261,7 +261,7 @@ router.put('/db/host/:id', authenticateJWT, upload.single('key'), async (req: ReenableTerminal: !!enableTerminal ? 1 : 0,enableTunnel: !!enableTunnel ? 1 : 0,tunnelConnections: Array.isArray(tunnelConnections) ? JSON.stringify(tunnelConnections) : null,- enableConfigEditor: !!enableConfigEditor ? 1 : 0,+ enableFileManager: !!enableFileManager ? 1 : 0,defaultPath: defaultPath || null,};@@ -308,7 +308,7 @@ router.get('/db/host', authenticateJWT, async (req: Request, res: Response) => {enableTerminal: !!row.enableTerminal,enableTunnel: !!row.enableTunnel,tunnelConnections: row.tunnelConnections ? JSON.parse(row.tunnelConnections) : [],- enableConfigEditor: !!row.enableConfigEditor,+ enableFileManager: !!row.enableFileManager,}));res.json(result);} catch (err) {@@ -346,7 +346,7 @@ router.get('/db/host/:id', authenticateJWT, async (req: Request, res: Response)enableTerminal: !!host.enableTerminal,enableTunnel: !!host.enableTunnel,tunnelConnections: host.tunnelConnections ? JSON.parse(host.tunnelConnections) : [],- enableConfigEditor: !!host.enableConfigEditor,+ enableFileManager: !!host.enableFileManager,};res.json(result);@@ -424,12 +424,12 @@ router.get('/file_manager/recent', authenticateJWT, async (req: Request, res: Retry {const recentFiles = await db.select()- .from(configEditorRecent)+ .from(fileManagerRecent).where(and(- eq(configEditorRecent.userId, userId),- eq(configEditorRecent.hostId, hostId)+ eq(fileManagerRecent.userId, userId),+ eq(fileManagerRecent.hostId, hostId)))- .orderBy(desc(configEditorRecent.lastOpened));+ .orderBy(desc(fileManagerRecent.lastOpened));res.json(recentFiles);} catch (err) {logger.error('Failed to fetch recent files', err);@@ -448,23 +448,23 @@ router.post('/file_manager/recent', authenticateJWT, async (req: Request, res: R}try {const conditions = [- eq(configEditorRecent.userId, userId),- eq(configEditorRecent.path, path),- eq(configEditorRecent.hostId, hostId)+ eq(fileManagerRecent.userId, userId),+ eq(fileManagerRecent.path, path),+ eq(fileManagerRecent.hostId, hostId)];const existing = await db.select()- .from(configEditorRecent)+ .from(fileManagerRecent).where(and(...conditions));if (existing.length > 0) {await db- .update(configEditorRecent)+ .update(fileManagerRecent).set({lastOpened: new Date().toISOString()}).where(and(...conditions));} else {- await db.insert(configEditorRecent).values({+ await db.insert(fileManagerRecent).values({userId,hostId,name,@@ -490,13 +490,13 @@ router.delete('/file_manager/recent', authenticateJWT, async (req: Request, res:}try {const conditions = [- eq(configEditorRecent.userId, userId),- eq(configEditorRecent.path, path),- eq(configEditorRecent.hostId, hostId)+ eq(fileManagerRecent.userId, userId),+ eq(fileManagerRecent.path, path),+ eq(fileManagerRecent.hostId, hostId)];const result = await db- .delete(configEditorRecent)+ .delete(fileManagerRecent).where(and(...conditions));res.json({message: 'File removed from recent'});} catch (err) {@@ -524,12 +524,12 @@ router.get('/file_manager/pinned', authenticateJWT, async (req: Request, res: Retry {const pinnedFiles = await db.select()- .from(configEditorPinned)+ .from(fileManagerPinned).where(and(- eq(configEditorPinned.userId, userId),- eq(configEditorPinned.hostId, hostId)+ eq(fileManagerPinned.userId, userId),+ eq(fileManagerPinned.hostId, hostId)))- .orderBy(configEditorPinned.pinnedAt);+ .orderBy(fileManagerPinned.pinnedAt);res.json(pinnedFiles);} catch (err) {logger.error('Failed to fetch pinned files', err);@@ -548,18 +548,18 @@ router.post('/file_manager/pinned', authenticateJWT, async (req: Request, res: R}try {const conditions = [- eq(configEditorPinned.userId, userId),- eq(configEditorPinned.path, path),- eq(configEditorPinned.hostId, hostId)+ eq(fileManagerPinned.userId, userId),+ eq(fileManagerPinned.path, path),+ eq(fileManagerPinned.hostId, hostId)];const existing = await db.select()- .from(configEditorPinned)+ .from(fileManagerPinned).where(and(...conditions));if (existing.length === 0) {- await db.insert(configEditorPinned).values({+ await db.insert(fileManagerPinned).values({userId,hostId,name,@@ -585,13 +585,13 @@ router.delete('/file_manager/pinned', authenticateJWT, async (req: Request, res:}try {const conditions = [- eq(configEditorPinned.userId, userId),- eq(configEditorPinned.path, path),- eq(configEditorPinned.hostId, hostId)+ eq(fileManagerPinned.userId, userId),+ eq(fileManagerPinned.path, path),+ eq(fileManagerPinned.hostId, hostId)];const result = await db- .delete(configEditorPinned)+ .delete(fileManagerPinned).where(and(...conditions));res.json({message: 'File unpinned successfully'});} catch (err) {@@ -617,12 +617,12 @@ router.get('/file_manager/shortcuts', authenticateJWT, async (req: Request, res:try {const shortcuts = await db.select()- .from(configEditorShortcuts)+ .from(fileManagerShortcuts).where(and(- eq(configEditorShortcuts.userId, userId),- eq(configEditorShortcuts.hostId, hostId)+ eq(fileManagerShortcuts.userId, userId),+ eq(fileManagerShortcuts.hostId, hostId)))- .orderBy(configEditorShortcuts.createdAt);+ .orderBy(fileManagerShortcuts.createdAt);res.json(shortcuts);} catch (err) {logger.error('Failed to fetch shortcuts', err);@@ -640,18 +640,18 @@ router.post('/file_manager/shortcuts', authenticateJWT, async (req: Request, res}try {const conditions = [- eq(configEditorShortcuts.userId, userId),- eq(configEditorShortcuts.path, path),- eq(configEditorShortcuts.hostId, hostId)+ eq(fileManagerShortcuts.userId, userId),+ eq(fileManagerShortcuts.path, path),+ eq(fileManagerShortcuts.hostId, hostId)];const existing = await db.select()- .from(configEditorShortcuts)+ .from(fileManagerShortcuts).where(and(...conditions));if (existing.length === 0) {- await db.insert(configEditorShortcuts).values({+ await db.insert(fileManagerShortcuts).values({userId,hostId,name,@@ -676,13 +676,13 @@ router.delete('/file_manager/shortcuts', authenticateJWT, async (req: Request, r}try {const conditions = [- eq(configEditorShortcuts.userId, userId),- eq(configEditorShortcuts.path, path),- eq(configEditorShortcuts.hostId, hostId)+ eq(fileManagerShortcuts.userId, userId),+ eq(fileManagerShortcuts.path, path),+ eq(fileManagerShortcuts.hostId, hostId)];const result = await db- .delete(configEditorShortcuts)+ .delete(fileManagerShortcuts).where(and(...conditions));res.json({message: 'Shortcut removed successfully'});} catch (err) {@@ -765,7 +765,7 @@ router.post('/bulk-import', authenticateJWT, async (req: Request, res: Response)enableTerminal: !!hostData.enableTerminal ? 1 : 0,enableTunnel: !!hostData.enableTunnel ? 1 : 0,tunnelConnections: Array.isArray(hostData.tunnelConnections) ? JSON.stringify(hostData.tunnelConnections) : null,- enableConfigEditor: !!hostData.enableConfigEditor ? 1 : 0,+ enableFileManager: !!hostData.enableFileManager ? 1 : 0,defaultPath: hostData.defaultPath || null,};diff --git a/src/backend/starter.ts b/src/backend/starter.tsindex 8da9b1d80..fcfe1dd97 100644--- a/src/backend/starter.ts+++ b/src/backend/starter.ts@@ -4,7 +4,7 @@import './database/database.js'import './ssh/terminal.js';import './ssh/tunnel.js';-import './ssh/file-manager.ts';+import './ssh/file-manager.js';import './ssh/server-stats.js';import chalk from 'chalk';