瀏覽代碼

feat: 支持自定义gogs头像

zhangyuhan 1 年之前
父節點
當前提交
7c68d6fe53
共有 3 個文件被更改,包括 15 次插入2 次删除
  1. 6 1
      docs/.vitepress/config.mts
  2. 8 0
      docs/.vitepress/constant.ts
  3. 1 1
      docs/package.json

+ 6 - 1
docs/.vitepress/config.mts

@@ -1,4 +1,5 @@
 import { defineConfig } from 'vitepress'
+import { CustomAvatars } from './constant'
 import { getChangelogAndContributors } from 'vitepress-plugin-changelog'
 
 export default defineConfig({
@@ -102,9 +103,13 @@ export default defineConfig({
   },
   async transformPageData ({ relativePath }) {
     const { contributors, changelog } = await getChangelogAndContributors(relativePath)
+    const CustomContributors = contributors.map(contributor => {
+      contributor.avatar = `https://jygit.jydev.jianyu360.cn/avatars/${CustomAvatars[contributor.name]}`
+      return contributor
+    })
     return {
       CommitData: {
-        contributors,
+        contributors: CustomContributors,
         changelog,
         commitURL: 'https://jygit.jydev.jianyu360.cn/jianyu/web/commit/',
         title: '更新记录'

+ 8 - 0
docs/.vitepress/constant.ts

@@ -0,0 +1,8 @@
+export const CustomAvatars = {
+  zhangyuhan: '26',
+  yangfeng: '36',
+  cuiyalong: '58',
+  tangshizhe: '63',
+  zhangsiya: '121',
+  wenmenghao: '116'
+}

+ 1 - 1
docs/package.json

@@ -13,7 +13,7 @@
   "devDependencies": {
     "md5": "^2.3.0",
     "vitepress": "1.0.0-rc.30",
-    "vitepress-plugin-changelog": "^0.1.0"
+    "vitepress-plugin-changelog": "^0.1.1"
   },
   "engines": {
     "node": ">=16",