diff --git a/app/components/BaseFooter.vue b/app/components/BaseFooter.vue
index 5c354b4..f5b553b 100644
--- a/app/components/BaseFooter.vue
+++ b/app/components/BaseFooter.vue
@@ -22,13 +22,6 @@ onBeforeMount(() => {
B 站
-
©️
Cook
diff --git a/app/components/footer/CdnSupport.vue b/app/components/footer/CdnSupport.vue
new file mode 100644
index 0000000..b15efe3
--- /dev/null
+++ b/app/components/footer/CdnSupport.vue
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/app/components/layout/CurrentVersion.vue b/app/components/layout/CurrentVersion.vue
index 39d09aa..613db97 100644
--- a/app/components/layout/CurrentVersion.vue
+++ b/app/components/layout/CurrentVersion.vue
@@ -2,8 +2,8 @@
import pkg from '~/../package.json'
const commitSha = (import.meta.env.VITE_COMMIT_REF || '').slice(0, 7)
-const now = import.meta.env.VITE_APP_BUILD_TIME
-const buildDate = (new Date(Number.parseInt(now))).toLocaleDateString()
+const date = import.meta.env.VITE_APP_BUILD_DATE
+const buildDate = (new Date(date)).toLocaleDateString()
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 1333078..0a87cfe 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -2,14 +2,22 @@ import process from 'node:process'
import { pwa } from './app/config/pwa'
import { appDescription } from './app/constants/index'
-Object.assign(process.env, {
- VITE_COMMIT_REF: process.env.CF_PAGES_COMMIT_SHA || '',
-})
+// for cloudflare
+// Object.assign(process.env, {
+// VITE_COMMIT_REF: process.env.CF_PAGES_COMMIT_SHA || '',
+// })
+
+import { getLatestCommit } from './scripts/git'
+
+const latestCommit = await getLatestCommit()
+/**
+ * CF_PAGES_COMMIT_SHA is Cloudflare Pages env
+ */
+import.meta.env.VITE_COMMIT_REF = process.env.CF_PAGES_COMMIT_SHA || latestCommit?.hash || ''
+// add build date string to env
+import.meta.env.VITE_APP_BUILD_DATE = latestCommit?.date || new Date().toString()
-// add build time to env
-import.meta.env.VITE_APP_BUILD_TIME = new Date().getTime().toString()
export default defineNuxtConfig({
-
modules: [
'@vueuse/nuxt',
'@unocss/nuxt',
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2ad6e7c..2d71200 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -146,7 +146,11 @@ importers:
specifier: ^3.0.5
version: 3.0.5(typescript@5.9.2)
- scripts: {}
+ scripts:
+ devDependencies:
+ simple-git:
+ specifier: ^3.28.0
+ version: 3.28.0
packages:
@@ -8484,7 +8488,7 @@ snapshots:
'@kwsites/file-exists@1.1.1':
dependencies:
- debug: 4.4.0
+ debug: 4.4.1
transitivePeerDependencies:
- supports-color
@@ -14375,7 +14379,7 @@ snapshots:
dependencies:
'@kwsites/file-exists': 1.1.1
'@kwsites/promise-deferred': 1.1.1
- debug: 4.4.0
+ debug: 4.4.1
transitivePeerDependencies:
- supports-color
diff --git a/scripts/git.ts b/scripts/git.ts
new file mode 100644
index 0000000..236e2de
--- /dev/null
+++ b/scripts/git.ts
@@ -0,0 +1,17 @@
+import { simpleGit } from 'simple-git'
+
+const git = simpleGit()
+
+/**
+ * get git repo latest commit
+ */
+export async function getLatestCommit() {
+ try {
+ const log = await git.log({ maxCount: 1 })
+ return log.latest
+ }
+ catch (error) {
+ console.error('Error fetching latest commit:', error)
+ return null
+ }
+}
diff --git a/scripts/package.json b/scripts/package.json
index 7a6197b..5086d56 100644
--- a/scripts/package.json
+++ b/scripts/package.json
@@ -3,5 +3,8 @@
"version": "0.0.1",
"scripts": {
"convert": "tsx convert.ts"
+ },
+ "devDependencies": {
+ "simple-git": "^3.28.0"
}
}