style(design): apply Minimal Dark Mode design system\n\n- Switched to complete Dark Mode (OLED-friendly)\n- Established standard color palette matching modern technical aesthetics\n- Changed font to Plus Jakarta Sans for increased legibility\n- Enforced dark mode as default in App.tsx\n- Fixed several React cascading render (setState in useEffect) warnings
This commit is contained in:
1 parent
b80531f8a8
commit
bac7b5591e
738 files changed
+138513
-138123
No files matched your search
+94
-94
@@ -1,94 +1,94 @@
|
||||
import 'reflect-metadata';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
||||
import { AppModule } from './app.module';
|
||||
import { logger } from '../utils/logger';
|
||||
import { TokenManagerService } from './modules/proxy/token-manager.service';
|
||||
|
||||
import { ProxyConfig } from '../types/config';
|
||||
import { setServerConfig } from './server-config';
|
||||
import { registerApiLogging } from './logging/api-logging.plugin';
|
||||
|
||||
let app: NestFastifyApplication | null = null;
|
||||
let currentPort: number = 0;
|
||||
|
||||
export async function bootstrapNestServer(config: ProxyConfig): Promise<boolean> {
|
||||
const port = config.port || 8045;
|
||||
if (app) {
|
||||
logger.info('NestJS server already running.');
|
||||
return true;
|
||||
}
|
||||
|
||||
setServerConfig(config);
|
||||
|
||||
try {
|
||||
app = await NestFactory.create<NestFastifyApplication>(
|
||||
AppModule,
|
||||
new FastifyAdapter({ bodyLimit: 10 * 1024 * 1024 }),
|
||||
{
|
||||
logger: ['error', 'warn', 'log'],
|
||||
},
|
||||
);
|
||||
|
||||
// Enable CORS
|
||||
app.enableCors();
|
||||
|
||||
// Register detailed API request/response logging
|
||||
const fastifyInstance = app.getHttpAdapter().getInstance();
|
||||
await registerApiLogging(fastifyInstance);
|
||||
|
||||
await app.listen(port, '0.0.0.0');
|
||||
currentPort = port;
|
||||
logger.info(`NestJS Proxy Server running on http://localhost:${port}`);
|
||||
return true;
|
||||
} catch (error) {
|
||||
logger.error('Failed to start NestJS server', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function stopNestServer(): Promise<boolean> {
|
||||
if (app) {
|
||||
try {
|
||||
await app.close();
|
||||
app = null;
|
||||
currentPort = 0;
|
||||
logger.info('NestJS server stopped.');
|
||||
return true;
|
||||
} catch (e) {
|
||||
logger.error('Failed to stop NestJS server', e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function isNestServerRunning(): boolean {
|
||||
return app !== null;
|
||||
}
|
||||
|
||||
export async function getNestServerStatus(): Promise<{
|
||||
running: boolean;
|
||||
port: number;
|
||||
base_url: string;
|
||||
active_accounts: number;
|
||||
}> {
|
||||
const running = isNestServerRunning();
|
||||
let activeAccounts = 0;
|
||||
|
||||
if (app) {
|
||||
try {
|
||||
const tokenManager = app.get(TokenManagerService);
|
||||
activeAccounts = tokenManager.getAccountCount();
|
||||
} catch (e) {
|
||||
// TokenManager might not be available
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
running,
|
||||
port: currentPort,
|
||||
base_url: running ? `http://localhost:${currentPort}` : '',
|
||||
active_accounts: activeAccounts,
|
||||
};
|
||||
}
|
||||
import 'reflect-metadata';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
||||
import { AppModule } from './app.module';
|
||||
import { logger } from '../utils/logger';
|
||||
import { TokenManagerService } from './modules/proxy/token-manager.service';
|
||||
|
||||
import { ProxyConfig } from '../types/config';
|
||||
import { setServerConfig } from './server-config';
|
||||
import { registerApiLogging } from './logging/api-logging.plugin';
|
||||
|
||||
let app: NestFastifyApplication | null = null;
|
||||
let currentPort: number = 0;
|
||||
|
||||
export async function bootstrapNestServer(config: ProxyConfig): Promise<boolean> {
|
||||
const port = config.port || 8045;
|
||||
if (app) {
|
||||
logger.info('NestJS server already running.');
|
||||
return true;
|
||||
}
|
||||
|
||||
setServerConfig(config);
|
||||
|
||||
try {
|
||||
app = await NestFactory.create<NestFastifyApplication>(
|
||||
AppModule,
|
||||
new FastifyAdapter({ bodyLimit: 10 * 1024 * 1024 }),
|
||||
{
|
||||
logger: ['error', 'warn', 'log'],
|
||||
},
|
||||
);
|
||||
|
||||
// Enable CORS
|
||||
app.enableCors();
|
||||
|
||||
// Register detailed API request/response logging
|
||||
const fastifyInstance = app.getHttpAdapter().getInstance();
|
||||
await registerApiLogging(fastifyInstance);
|
||||
|
||||
await app.listen(port, '0.0.0.0');
|
||||
currentPort = port;
|
||||
logger.info(`NestJS Proxy Server running on http://localhost:${port}`);
|
||||
return true;
|
||||
} catch (error) {
|
||||
logger.error('Failed to start NestJS server', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function stopNestServer(): Promise<boolean> {
|
||||
if (app) {
|
||||
try {
|
||||
await app.close();
|
||||
app = null;
|
||||
currentPort = 0;
|
||||
logger.info('NestJS server stopped.');
|
||||
return true;
|
||||
} catch (e) {
|
||||
logger.error('Failed to stop NestJS server', e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function isNestServerRunning(): boolean {
|
||||
return app !== null;
|
||||
}
|
||||
|
||||
export async function getNestServerStatus(): Promise<{
|
||||
running: boolean;
|
||||
port: number;
|
||||
base_url: string;
|
||||
active_accounts: number;
|
||||
}> {
|
||||
const running = isNestServerRunning();
|
||||
let activeAccounts = 0;
|
||||
|
||||
if (app) {
|
||||
try {
|
||||
const tokenManager = app.get(TokenManagerService);
|
||||
activeAccounts = tokenManager.getAccountCount();
|
||||
} catch (e) {
|
||||
// TokenManager might not be available
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
running,
|
||||
port: currentPort,
|
||||
base_url: running ? `http://localhost:${currentPort}` : '',
|
||||
active_accounts: activeAccounts,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user