-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnuxt.config.ts
110 lines (98 loc) · 2.37 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import process from 'node:process'
import i18next from 'i18next'
import { z } from 'zod'
import { zodI18nMap } from 'zod-i18n-map'
import translation from 'zod-i18n-map/locales/zh-CN/zod.json'
import { ConfigSchema } from './shared/config'
import { FORM_ATTACHMENT_MAX_SIZE } from './shared/consts'
import { version } from './package.json'
i18next.init({
lng: 'zh-CN',
resources: {
'zh-CN': { zod: translation },
},
})
z.setErrorMap(zodI18nMap)
export default defineNuxtConfig({
app: {
head: {
htmlAttrs: { lang: 'zh-CN' },
meta: [{
name: 'generator',
content: `Fanbook Recruit Helper v${version}`,
}],
title: 'Fanbook Recruit Helper',
},
},
compatibilityDate: '2024-04-03',
devServer: {
port: 8214,
},
devtools: { enabled: true },
future: {
compatibilityVersion: 4,
},
modules: [
'@vueuse/nuxt',
'nuxt-codemirror',
'nuxt-security',
],
nitro: {
experimental: {
tasks: true,
},
scheduledTasks: {
'0 0 * * *': ['refresh-statistic'],
},
},
routeRules: {
'/api': {
security: {
rateLimiter: {
tokensPerInterval: 30,
interval: 10 * 1000, // 10s
},
requestSizeLimiter: {
maxUploadFileRequestInBytes: FORM_ATTACHMENT_MAX_SIZE,
},
},
},
'/api/auth/super-key': {
security: {
rateLimiter: {
tokensPerInterval: 1,
interval: 5000,
},
},
},
},
runtimeConfig: ConfigSchema.parse({
fanbookAppClientSecret: process.env.FBRH_FANBOOK_APP_CLIENT_SECRET,
fanbookBotToken: process.env.FBRH_FANBOOK_BOT_TOKEN,
larkAppSecret: process.env.FBRH_LARK_APP_SECRET,
superKey: process.env.FBRH_SUPER_KEY,
public: {
fanbookAppClientId: process.env.FBRH_FANBOOK_APP_CLIENT_ID,
fanbookGuildId: process.env.FBRH_FANBOOK_GUILD_ID,
fanbookOauth2RedirectUrl: process.env.FBRH_FANBOOK_OAUTH2_REDIRECT_URL,
host: process.env.FBRH_HOST,
larkAppId: process.env.FBRH_LARK_APP_ID,
},
}),
security: {
headers: {
contentSecurityPolicy: {
// 允许 unsafe-eval 用于 vform
'script-src': [
'\'self\'',
'\'unsafe-eval\'',
'https:',
'\'unsafe-inline\'',
'\'strict-dynamic\'',
'\'nonce-{{nonce}}\'',
],
},
},
},
ssr: false,
})