mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-25 13:10:13 +00:00
optimized bootstrapper script download
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
const BOOTSTRAPPER_URL =
|
||||
"https://autopilotmonitor.blob.core.windows.net/agent/Install-AutopilotMonitor.ps1";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const upstream = await fetch(BOOTSTRAPPER_URL, { cache: "no-store" });
|
||||
if (!upstream.ok || !upstream.body) {
|
||||
return Response.redirect(BOOTSTRAPPER_URL, 302);
|
||||
}
|
||||
|
||||
const headers = new Headers();
|
||||
headers.set("Content-Type", "application/octet-stream");
|
||||
headers.set(
|
||||
"Content-Disposition",
|
||||
'attachment; filename="Install-AutopilotMonitor.ps1"',
|
||||
);
|
||||
headers.set("Cache-Control", "public, max-age=300");
|
||||
|
||||
return new Response(upstream.body, {
|
||||
status: 200,
|
||||
headers,
|
||||
});
|
||||
} catch {
|
||||
return Response.redirect(BOOTSTRAPPER_URL, 302);
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ function SectionAgentSetup() {
|
||||
Download the PowerShell script that installs and configures the Autopilot Monitor agent:
|
||||
</p>
|
||||
<a
|
||||
href="https://autopilotmonitor.blob.core.windows.net/agent/Install-AutopilotMonitor.ps1"
|
||||
href="/api/download/bootstrapper"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-lg transition-colors"
|
||||
|
||||
Reference in New Issue
Block a user