mirror of
https://github.com/elk-zone/elk.git
synced 2024-12-04 15:55:56 +03:00
refactor: try fetching images (for netlify cache)
This commit is contained in:
parent
e18443ab6f
commit
705ce6ada4
2 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
import { fileURLToPath } from 'node:url'
|
||||
import Inspect from 'vite-plugin-inspect'
|
||||
import { isCI } from 'std-env'
|
||||
import { isCI, isDevelopment } from 'std-env'
|
||||
import { i18n } from './config/i18n'
|
||||
|
||||
const isPreview = process.env.PULL_REQUEST === 'true'
|
||||
|
@ -90,7 +90,7 @@ export default defineNuxtConfig({
|
|||
routeRules: {
|
||||
'/api/og-image/**': {
|
||||
static: isCI,
|
||||
cache: !isCI
|
||||
cache: !isCI && !isDevelopment
|
||||
? { maxAge: 86400 } // 1 day
|
||||
: {},
|
||||
},
|
||||
|
|
|
@ -108,7 +108,9 @@ export default defineEventHandler(async (event) => {
|
|||
return
|
||||
}
|
||||
|
||||
await sendRedirect(event, ogImageUrl)
|
||||
return $fetch(ogImageUrl, {
|
||||
responseType: 'stream',
|
||||
})
|
||||
}
|
||||
catch (error) {
|
||||
throw createError({
|
||||
|
|
Loading…
Reference in a new issue