Sink/nuxt.config.ts
ccbikai 71654dcbc8 feat: add bot traffic filtering for access logs
Adds configuration option NUXT_DISABLE_BOT_ACCESS_LOG to exclude bot/crawler traffic from access statistics

- Updates ua-parser-js to stable v2.0.3
- Detects bots via CloudFlare bot management and user agent analysis
- Documents new config option in configuration.md and FAQs
2025-03-16 12:57:05 +08:00

93 lines
2 KiB
TypeScript

import { currentLocales } from './i18n/i18n'
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: [
'@nuxthub/core',
'shadcn-nuxt',
'@nuxt/eslint',
'@nuxtjs/tailwindcss',
'@nuxtjs/color-mode',
'@nuxtjs/i18n',
],
devtools: { enabled: true },
colorMode: {
classSuffix: '',
},
runtimeConfig: {
siteToken: 'SinkCool',
redirectStatusCode: '301',
linkCacheTtl: 60,
redirectWithQuery: false,
homeURL: '',
cfAccountId: '',
cfApiToken: '',
dataset: 'sink',
aiModel: '@cf/meta/llama-3.1-8b-instruct',
aiPrompt: `You are a URL shortening assistant, please shorten the URL provided by the user into a SLUG. The SLUG information must come from the URL itself, do not make any assumptions. A SLUG is human-readable and should not exceed three words and can be validated using regular expressions {slugRegex} . Only the best one is returned, the format must be JSON reference {"slug": "example-slug"}`,
caseSensitive: false,
listQueryLimit: 500,
disableBotAccessLog: false,
public: {
previewMode: '',
slugDefaultLength: '6',
},
},
routeRules: {
'/': {
prerender: true,
},
'/dashboard/**': {
ssr: false,
},
'/dashboard': {
redirect: '/dashboard/links',
},
},
compatibilityDate: '2024-07-08',
nitro: {
experimental: {
// Enable Server API documentation within NuxtHub
openAPI: true,
},
},
hub: {
ai: true,
analytics: true,
blob: false,
cache: false,
database: false,
kv: true,
},
eslint: {
config: {
stylistic: true,
standalone: false,
},
},
i18n: {
locales: currentLocales,
compilation: {
strictMessage: false,
escapeHtml: true,
},
lazy: true,
strategy: 'no_prefix',
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'sink_i18n_redirected',
redirectOn: 'root',
},
baseUrl: '/',
defaultLocale: 'en-US',
},
})