Implement API key validation middleware and add force shutdown endpoint

This commit is contained in:
Din
2025-04-28 15:16:44 +08:00
parent caa7436d51
commit a0b9f05ae3
3 changed files with 122 additions and 3 deletions
+13 -1
View File
@@ -104,4 +104,16 @@ dotnet run
git add .
git commit -m "Add steam running games"
git push origin master
dotnet publish -c Release -o ./publish
dotnet publish -c Release -o ./publish
# devtest
Invoke-WebRequest -Uri "http://localhost:5000/api/kill-process" -Method POST -Body "1234" -Headers @{ "X-API-KEY" = "b7f3e8a1-4c2d-4d9f-9a6e-2a1c5d7f8e9a" }
Invoke-WebRequest -Uri "http://192.168.50.52:5000/api/resource-usage" -Method GET -Headers @{ "X-API-KEY" = "b7f3e8a1-4c2d-4d9f-9a6e-2a1c5d7f8e9a" }
Use 'shutdown', 'restart', or 'cancel'.
Invoke-WebRequest -Uri "http://192.168.50.52:5000/api/force-shutdown" `
-Method POST `
-Headers @{ "X-API-KEY" = "b7f3e8a1-4c2d-4d9f-9a6e-2a1c5d7f8e9a" } `
-Body '{"Action": "shutdown", "DelaySeconds": 120}' `
-ContentType "application/json"