diff --git a/components/nav/NavFooter.vue b/components/nav/NavFooter.vue
index a20eaac3..328b9069 100644
--- a/components/nav/NavFooter.vue
+++ b/components/nav/NavFooter.vue
@@ -1,6 +1,5 @@
diff --git a/composables/about.ts b/composables/about.ts
index 9bda5f35..b40608ad 100644
--- a/composables/about.ts
+++ b/composables/about.ts
@@ -1,3 +1,5 @@
+import type { BuildInfo } from '~~/types'
+
export interface Team {
github: string
display: string
@@ -31,3 +33,7 @@ export const teams: Team[] = [
mastodon: 'sxzz@webtoo.ls',
},
].sort(() => Math.random() - 0.5)
+
+export function useBuildInfo() {
+ return useRuntimeConfig().public.buildInfo as BuildInfo
+}
diff --git a/composables/setups.ts b/composables/setups.ts
index 4e1c09c2..4d422e0e 100644
--- a/composables/setups.ts
+++ b/composables/setups.ts
@@ -1,9 +1,9 @@
import type { Directions } from 'vue-i18n-routing'
-import { buildInfo } from 'virtual:build-info'
import type { LocaleObject } from '#i18n'
export function setupPageHeader() {
const { locale, locales, t } = useI18n()
+ const buildInfo = useBuildInfo()
const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
acc[l.code!] = l.dir ?? 'auto'
diff --git a/modules/build-env.ts b/modules/build-env.ts
new file mode 100644
index 00000000..408b2052
--- /dev/null
+++ b/modules/build-env.ts
@@ -0,0 +1,30 @@
+import { createResolver, defineNuxtModule } from '@nuxt/kit'
+import { getEnv, version } from '../config/env'
+import type { BuildInfo } from '~/types'
+
+const { resolve } = createResolver(import.meta.url)
+
+export default defineNuxtModule({
+ meta: {
+ name: 'elk:build-env',
+ },
+ async setup(_options, nuxt) {
+ const { env, commit, branch } = await getEnv()
+ const buildInfo: BuildInfo = {
+ version,
+ time: +Date.now(),
+ commit,
+ branch,
+ env,
+ }
+
+ nuxt.options.runtimeConfig.public.env = env
+ nuxt.options.runtimeConfig.public.buildInfo = buildInfo
+
+ nuxt.options.nitro.publicAssets ||= nuxt.options.nitro.publicAssets || []
+ if (env === 'canary' || env === 'preview')
+ nuxt.options.nitro.publicAssets.push({ dir: resolve('../public-staging') })
+ else if (env === 'dev')
+ nuxt.options.nitro.publicAssets.push({ dir: resolve('../public-dev') })
+ },
+})
diff --git a/modules/build-info.ts b/modules/build-info.ts
deleted file mode 100644
index ac93d96c..00000000
--- a/modules/build-info.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { addVitePlugin, defineNuxtModule } from '@nuxt/kit'
-import { getEnv, version } from '../config/env'
-import type { BuildInfo } from '~/types'
-
-export default defineNuxtModule({
- meta: {
- name: 'elk:build-info',
- },
- async setup(_options, nuxt) {
- const { env, commit, branch } = await getEnv()
- nuxt.options.runtimeConfig.public.env = env
-
- const buildInfo: BuildInfo = {
- version,
- time: +Date.now(),
- commit,
- branch,
- env,
- }
-
- addVitePlugin({
- name: 'elk:build-info',
- resolveId(id) {
- if (id === 'virtual:build-info')
- return id
- },
- load(id) {
- if (id === 'virtual:build-info')
- return `export const buildInfo = ${JSON.stringify(buildInfo, null, 2)}`
- },
- })
- },
-})
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 542df56e..6e6c87fb 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -1,11 +1,9 @@
-import { createResolver } from '@nuxt/kit'
import Inspect from 'vite-plugin-inspect'
import { isCI, isDevelopment } from 'std-env'
+import { isPreview } from './config/env'
import { i18n } from './config/i18n'
import { pwa } from './config/pwa'
-import { isPreview } from './config/env'
-
-const { resolve } = createResolver(import.meta.url)
+import type { BuildInfo } from './types'
export default defineNuxtConfig({
typescript: {
@@ -93,7 +91,8 @@ export default defineNuxtConfig({
inviteToken: '',
},
public: {
- env: '', // set in build-info module
+ env: '', // set in build-env module
+ buildInfo: {} as BuildInfo, // set in build-env module
pwaEnabled: !isDevelopment || process.env.VITE_DEV_PWA === 'true',
translateApi: '',
defaultServer: 'mas.to',
@@ -112,9 +111,6 @@ export default defineNuxtConfig({
},
},
nitro: {
- publicAssets: [
- ...(!isCI || isPreview ? [{ dir: resolve('./public-dev') }] : []),
- ],
prerender: {
crawlLinks: false,
routes: ['/'],
diff --git a/pages/settings/about/index.vue b/pages/settings/about/index.vue
index 52ac796b..fc276d74 100644
--- a/pages/settings/about/index.vue
+++ b/pages/settings/about/index.vue
@@ -1,6 +1,5 @@