Improve website loading speed by optimizing image data retrieval

Fetch limited sets of gallery images for the homepage and widgets to reduce initial load times and bandwidth usage.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 1f7e7e89-a520-4970-9645-37daadc466dc
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: de3b3f76-575a-4b3d-8981-d81d7b9356ee
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/1f7e7e89-a520-4970-9645-37daadc466dc/NJvOVoB
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sebastjanartic
2026-03-05 12:46:28 +00:00
parent 9ceb2526a3
commit 935f307fa4
4 changed files with 535 additions and 532 deletions
+528 -528
View File
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -362,7 +362,7 @@ export async function registerRoutes(
"6": "Folx Stadl",
};
app.get("/api/gallery", async (_req, res) => {
app.get("/api/gallery", async (req, res) => {
try {
let data: any[] = [];
@@ -387,7 +387,8 @@ export async function registerRoutes(
const j = Math.floor(Math.random() * (i + 1));
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
}
res.json(shuffled);
const limit = parseInt(req.query.limit as string) || 0;
res.json(limit > 0 ? shuffled.slice(0, limit) : shuffled);
} catch (err: any) {
res.json([]);
}