fix: follow external server fetch ua

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2024-11-10 00:11:53 +08:00
parent c7fc039c42
commit 072dec02b7
4 changed files with 22 additions and 6 deletions
+1
View File
@@ -49,6 +49,7 @@
"@radix-ui/react-avatar": "1.1.1",
"chokidar": "4.0.1",
"daisyui": "4.12.14",
"dotenv-flow": "4.1.0",
"foxact": "0.2.41",
"glob": "11.0.0",
"lightningcss": "1.27.0",
+6
View File
@@ -35,6 +35,11 @@ export const createApiClient = () => {
retry: false,
onRequest(context) {
// console.debug(`request: ${context.request}`)
context.options.headers.set("User-Agent", `Follow External Server Api Client/${PKG.version}`)
},
onRequestError(context) {
if (context.error.name === "AbortError") {
return
@@ -48,6 +53,7 @@ export const createApiClient = () => {
return {
"X-App-Version": PKG.version,
"X-App-Dev": isDev ? "1" : "0",
"User-Agent": `Follow External Server Api Client/${PKG.version}`,
Cookie: authSessionToken ? `authjs.session-token=${authSessionToken}` : "",
}
},
+2 -4
View File
@@ -1,7 +1,5 @@
import { resolve } from "node:path"
import { config } from "dotenv"
import { config } from "dotenv-flow"
config({
path: resolve(__dirname, "../../.env"),
files: [".env.development.local", ".env"],
})
+13 -2
View File
@@ -794,6 +794,9 @@ importers:
daisyui:
specifier: 4.12.14
version: 4.12.14(patch_hash=igsntdatmoaxzwxof4bkkh35fy)(postcss@8.4.47)
dotenv-flow:
specifier: 4.1.0
version: 4.1.0
foxact:
specifier: 0.2.41
version: 0.2.41(react@18.3.1)
@@ -3412,8 +3415,8 @@ packages:
'@radix-ui/react-avatar@1.1.1':
resolution: {integrity: sha512-eoOtThOmxeoizxpX6RiEsQZ2wj5r4+zoeqAwO0cBaFQGjJwIH3dIX0OCxNrCyrrdxG+vBweMETh3VziQG7c1kw==}
peerDependencies:
'@types/react': npm:types-react@19.0.0-rc.1
'@types/react-dom': npm:types-react-dom@19.0.0-rc.1
'@types/react': '*'
'@types/react-dom': '*'
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
peerDependenciesMeta:
@@ -5895,6 +5898,10 @@ packages:
dotenv-expand@5.1.0:
resolution: {integrity: sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==}
dotenv-flow@4.1.0:
resolution: {integrity: sha512-0cwP9jpQBQfyHwvE0cRhraZMkdV45TQedA8AAUZMsFzvmLcQyc1HPv+oX0OOYwLFjIlvgVepQ+WuQHbqDaHJZg==}
engines: {node: '>= 12.0.0'}
dotenv@16.4.5:
resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==}
engines: {node: '>=12'}
@@ -16651,6 +16658,10 @@ snapshots:
dotenv-expand@5.1.0: {}
dotenv-flow@4.1.0:
dependencies:
dotenv: 16.4.5
dotenv@16.4.5: {}
dotenv@9.0.2: {}