feat: pass GITEA_TOKEN to IDE containers + prewarm on project list load
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -126,8 +126,22 @@ export default function ProjectsPage() {
|
||||
throw new Error(err.error || "Failed to fetch projects");
|
||||
}
|
||||
const data = await res.json();
|
||||
setProjects(data.projects || []);
|
||||
const loaded: ProjectWithStats[] = data.projects || [];
|
||||
setProjects(loaded);
|
||||
setError(null);
|
||||
|
||||
// Fire-and-forget: prewarm all provisioned IDE workspaces so containers
|
||||
// are already running by the time the user clicks "Open IDE"
|
||||
const warmUrls = loaded
|
||||
.map((p) => p.theiaWorkspaceUrl)
|
||||
.filter((u): u is string => Boolean(u));
|
||||
if (warmUrls.length > 0) {
|
||||
fetch("/api/projects/prewarm", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ urls: warmUrls }),
|
||||
}).catch(() => {}); // ignore errors — this is best-effort
|
||||
}
|
||||
} catch (err: unknown) {
|
||||
setError(err instanceof Error ? err.message : "Unknown error");
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user