remove redundant code (#288)

This commit is contained in:
Rilomilo
2025-08-24 11:40:33 +08:00
committed by GitHub
parent 4547ae526a
commit 9952927a13
2 changed files with 0 additions and 32 deletions

View File

@@ -2,7 +2,6 @@ import express, { Request, Response, NextFunction } from 'express';
import { auth } from './auth.js'; import { auth } from './auth.js';
import { userContextMiddleware } from './userContext.js'; import { userContextMiddleware } from './userContext.js';
import { i18nMiddleware } from './i18n.js'; import { i18nMiddleware } from './i18n.js';
import { initializeDefaultUser } from '../models/User.js';
import config from '../config/index.js'; import config from '../config/index.js';
export const errorHandler = ( export const errorHandler = (
@@ -46,11 +45,6 @@ export const initMiddlewares = (app: express.Application): void => {
} }
}); });
// Initialize default admin user if no users exist
initializeDefaultUser().catch((err) => {
console.error('Error initializing default user:', err);
});
// Protect API routes with authentication middleware, but exclude auth endpoints // Protect API routes with authentication middleware, but exclude auth endpoints
app.use(`${config.basePath}/api`, (req, res, next) => { app.use(`${config.basePath}/api`, (req, res, next) => {
// Skip authentication for login endpoint // Skip authentication for login endpoint

View File

@@ -685,32 +685,6 @@ export const removeServer = (name: string): { success: boolean; message?: string
} }
}; };
// Update existing server
export const updateMcpServer = async (
name: string,
config: ServerConfig,
): Promise<{ success: boolean; message?: string }> => {
try {
const settings = loadSettings();
if (!settings.mcpServers[name]) {
return { success: false, message: 'Server not found' };
}
settings.mcpServers[name] = config;
if (!saveSettings(settings)) {
return { success: false, message: 'Failed to save settings' };
}
closeServer(name);
serverInfos = serverInfos.filter((serverInfo) => serverInfo.name !== name);
return { success: true, message: 'Server updated successfully' };
} catch (error) {
console.error(`Failed to update server: ${name}`, error);
return { success: false, message: 'Failed to update server' };
}
};
// Add or update server (supports overriding existing servers for DXT) // Add or update server (supports overriding existing servers for DXT)
export const addOrUpdateServer = async ( export const addOrUpdateServer = async (
name: string, name: string,