mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-17 22:27:19 +00:00
Add public API endpoints for the operating system page
Introduces new public GET endpoints (/api/os/projects, /api/os/architects, /api/os/achievements, /api/os/notifications) to the server, enabling the client-side OS page to fetch real-time data. Updates the OS page to utilize these endpoints for displaying projects, architects, achievements, and notifications. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 279f1558-c0e3-40e4-8217-be7e9f4c6eca Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 258050df-3080-49f3-b0e1-4d1b677f529f Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/b984cb14-1d19-4944-922b-bc79e821ed35/279f1558-c0e3-40e4-8217-be7e9f4c6eca/0DVaTy4 Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
7f03ac1bb9
commit
b7a4014d17
2 changed files with 869 additions and 323 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -303,6 +303,66 @@ export async function registerRoutes(
|
|||
}
|
||||
});
|
||||
|
||||
// ========== PUBLIC OS API ROUTES ==========
|
||||
|
||||
// Get public project summaries for OS (limited data, no auth required)
|
||||
app.get("/api/os/projects", async (req, res) => {
|
||||
try {
|
||||
const projects = await storage.getProjects();
|
||||
const summaries = projects.slice(0, 10).map(p => ({
|
||||
id: p.id,
|
||||
title: p.title,
|
||||
status: p.status,
|
||||
engine: p.engine,
|
||||
}));
|
||||
res.json(summaries);
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Get public architect summaries for OS (limited data, no auth required)
|
||||
app.get("/api/os/architects", async (req, res) => {
|
||||
try {
|
||||
const profiles = await storage.getProfiles();
|
||||
const summaries = profiles.slice(0, 10).map(p => ({
|
||||
id: p.id,
|
||||
username: p.username,
|
||||
level: p.level || 1,
|
||||
xp: p.total_xp || 0,
|
||||
verified: p.is_verified || false,
|
||||
}));
|
||||
res.json(summaries);
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Get achievements list for OS (public)
|
||||
app.get("/api/os/achievements", async (req, res) => {
|
||||
try {
|
||||
const achievements = await storage.getAchievements();
|
||||
res.json(achievements.slice(0, 20));
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Get recent activity/notifications for OS (public summary)
|
||||
app.get("/api/os/notifications", async (req, res) => {
|
||||
try {
|
||||
const metrics = await storage.getMetrics();
|
||||
const notifications = [
|
||||
{ id: 1, message: `${metrics.totalProfiles} architects in network`, type: 'info' },
|
||||
{ id: 2, message: `${metrics.totalProjects} active projects`, type: 'info' },
|
||||
{ id: 3, message: 'Aegis security active', type: 'success' },
|
||||
];
|
||||
res.json(notifications);
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// ========== CHATBOT API (Rate limited) ==========
|
||||
|
||||
const chatRateLimits = new Map<string, { count: number; resetTime: number }>();
|
||||
|
|
|
|||
Loading…
Reference in a new issue