feat(auth): implement API key authentication and enhance request handling

- Add AuthGuard to validate API key for public access.
- Create AuthModule to provide the AuthGuard globally.
- Update API request interceptor to automatically include API key for non-localhost requests.
- Modify .env and .env.example to include API_KEY configuration.
- Enhance API request handling with improved error logging and client IP detection.
This commit is contained in:
dmy
2026-01-16 11:26:02 +08:00
parent 9257c78e72
commit 300e930c64
7 changed files with 144 additions and 19 deletions

5
.env
View File

@@ -42,4 +42,7 @@ LOG_LEVEL=debug
# OpenAI API Key (用于 AI 推荐)
ARK_API_KEY=a63d58b6-cf56-434b-8a42-5c781ba0822a
SSH_PASSPHRASE=x
SSH_PASSPHRASE=x
API_KEY=22c64b60-6e60-433c-991d-f6d658024b9e