Improve app performance and font rendering for Arabic language users

Implements Arabic font optimization, performance tracking, and server-side performance monitoring using performanceOptimization service.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: c5f0c281-8dd8-4846-b452-4a07bcd21062
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9777c70b-fc38-4831-8d6b-78dfffe041b0/aafbff93-ed78-4896-8b12-66a9ce417e74.jpg
This commit is contained in:
ghaddaditw
2025-06-08 07:58:21 +00:00
parent 51f0690ff9
commit 8f543623b5
4 changed files with 382 additions and 283 deletions
+25
View File
@@ -18,6 +18,7 @@ import {
} from "./middleware/security";
import { monitoringService } from "./services/monitoringService";
import { taskScheduler } from "./services/taskScheduler";
import { performanceOptimizationService } from "./services/performanceOptimization";
import { authController } from "./controllers/authController";
import { taskController } from "./controllers/taskController";
import { financialController } from "./controllers/financialController";
@@ -103,6 +104,30 @@ export async function registerRoutes(app: Express): Promise<Server> {
}
});
// Arabic performance analytics endpoint
app.post('/api/analytics/arabic-performance', (req: Request, res: Response) => {
try {
const { metrics, issues, userAgent, timestamp } = req.body;
// Log Arabic performance data for monitoring
console.log('[Arabic Performance]', {
rtlRenderTime: metrics.rtlRenderTime,
fontLoadTime: metrics.fontLoadTime,
layoutShiftScore: metrics.layoutShiftScore,
textDirectionSwitchTime: metrics.textDirectionSwitchTime,
arabicTextRenderScore: metrics.arabicTextRenderScore,
issues: issues.length,
userAgent: userAgent?.substring(0, 100),
timestamp
});
res.json({ status: 'recorded' });
} catch (error) {
console.warn('Failed to record Arabic performance data:', error);
res.status(500).json({ error: 'Failed to record performance data' });
}
});
// Configure session middleware
app.use(session({
secret: process.env.SESSION_SECRET || 'your-secret-key',