Skip to content

Commit 4183546

Browse files
Copilot0xrinegade
andcommitted
Refactor middleware to remove redundant variable assignment
Co-authored-by: 0xrinegade <[email protected]>
1 parent 266ebac commit 4183546

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

frontend/middleware.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@ export function middleware(request: NextRequest) {
1111
const isPowershell = userAgent.toLowerCase().includes('powershell');
1212

1313
if (isCurl || isPowershell) {
14-
let scriptContent = '';
15-
1614
if (isPowershell) {
1715
// Windows PowerShell command
18-
scriptContent = `powershell -Command "Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/openSVM/aea/main/install.ps1' -OutFile 'install.ps1'; .\\install.ps1"`;
19-
return new Response(scriptContent, {
20-
status: 200,
21-
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
22-
});
16+
return new Response(
17+
`powershell -Command "Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/openSVM/aea/main/install.ps1' -OutFile 'install.ps1'; .\\install.ps1"`,
18+
{
19+
status: 200,
20+
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
21+
}
22+
);
2323
} else {
2424
// Linux, macOS, etc.
25-
scriptContent = `curl -sSf https://raw.githubusercontent.com/openSVM/aea/main/install.sh | sh`;
26-
return new Response(scriptContent, {
27-
status: 200,
28-
headers: { 'Content-Type': 'text/x-shellscript; charset=utf-8' },
29-
});
25+
return new Response(
26+
`curl -sSf https://raw.githubusercontent.com/openSVM/aea/main/install.sh | sh`,
27+
{
28+
status: 200,
29+
headers: { 'Content-Type': 'text/x-shellscript; charset=utf-8' },
30+
}
31+
);
3032
}
3133
}
3234
}

0 commit comments

Comments
 (0)