feat: Require UUID token authorization for /shutdown endpoint
This commit is contained in:
1 parent
53dce890ec
commit
ce17ffcf42
3 files changed
+69
-32
No files matched your search
@@ -20,7 +20,12 @@ if (Test-Path $serverExe) {
|
||||
& $serverExe --exit 2>$null
|
||||
}
|
||||
try {
|
||||
Invoke-RestMethod -Uri "https://127.0.0.1:3000/shutdown" -Method Post -SkipCertificateCheck -ErrorAction Stop | Out-Null
|
||||
$tokenPath = "C:\Users\reazul.ashraf\.gemini\mcp_memory\admin.token"
|
||||
$headers = @{}
|
||||
if (Test-Path $tokenPath) {
|
||||
$headers["Authorization"] = "Bearer $(Get-Content -Path $tokenPath -Raw)".Trim()
|
||||
}
|
||||
Invoke-RestMethod -Uri "https://127.0.0.1:3000/shutdown" -Method Post -Headers $headers -SkipCertificateCheck -ErrorAction Stop | Out-Null
|
||||
} catch {
|
||||
# The response often ends prematurely because the server abruptly kills its own process during shutdown. This is expected.
|
||||
}
|
||||
@@ -63,7 +68,7 @@ function Deploy-If-Needed {
|
||||
if ($EnvName -eq 'WSL') {
|
||||
# Translate source path to WSL path
|
||||
$wslSource = wsl.exe -d Ubuntu -e wslpath -u $Source
|
||||
wsl.exe -d Ubuntu -e bash -c "mv $Dest ${Dest}.`date +%s`.old 2>/dev/null || true; cp $wslSource $Dest && chmod +x $Dest"
|
||||
wsl.exe -d Ubuntu -e bash -c "mv $Dest ${Dest}.\$(date +%s).old 2>/dev/null || true; cp $wslSource $Dest && chmod +x $Dest"
|
||||
} else {
|
||||
if (Test-Path $Dest) {
|
||||
$rand = Get-Random
|
||||
|
||||
Reference in new issue
Block a user