add cool git commit thing

This commit is contained in:
C committed 2025-10-26 14:59:40 -07:00
1 parent cddb7e6aff
commit b34d3a5854
2 files changed
+17 -2

No files matched your search

+3 -1
View File
@@ -4,7 +4,7 @@
height="40" height="40"
> >
<div class="text-caption"> <div class="text-caption">
StudSpider 0.2 (<small>5288d</small>) StudSpider 0.2 <small>(<a href="http://git.traps.moe/ph0sgene/studspider-status/commits/branch/master">{{ gitHash }}</a>)</small>
</div> </div>
<a <a
v-for="item in items" v-for="item in items"
@@ -43,6 +43,8 @@
<script setup> <script setup>
import { computed } from 'vue' import { computed } from 'vue'
const gitHash = __GIT_COMMIT_HASH__
const copyrightYear = computed(() => { const copyrightYear = computed(() => {
const currentYear = new Date().getFullYear() const currentYear = new Date().getFullYear()
const startYear = 2025 const startYear = 2025
+14 -1
View File
@@ -11,9 +11,23 @@ import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
// Utilities // Utilities
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
import { execSync } from 'child_process'
// Get git commit hash
const getGitHash = () => {
try {
return execSync('git rev-parse --short HEAD').toString().trim()
} catch (e) {
return 'unknown'
}
}
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
define: {
'__GIT_COMMIT_HASH__': JSON.stringify(getGitHash()),
'process.env': {}
},
plugins: [ plugins: [
VueRouter(), VueRouter(),
Layouts(), Layouts(),
@@ -59,7 +73,6 @@ export default defineConfig({
'unplugin-vue-router/data-loaders/basic', 'unplugin-vue-router/data-loaders/basic',
], ],
}, },
define: { 'process.env': {} },
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('src', import.meta.url)), '@': fileURLToPath(new URL('src', import.meta.url)),