1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-09-02 17:30:44 +08:00

feat: 新增评论验证码功能和修复瞬间无法显示问题 #45 #46

1. 新增评论支持验证码功能
2. 修复瞬间功能无法正常显示内容
This commit is contained in:
小莫唐尼
2026-08-28 23:41:22 +08:00
parent 1407b58024
commit 3cdb9f4ef8
11 changed files with 631 additions and 362 deletions
+36 -19
View File
@@ -3,12 +3,14 @@ import {
} from '@/utils/token.js'
import HttpHandler from '@/common/http/request.js'
import qs from 'qs'
import { getCache } from "@/utils/storage";
import { getAppConfigs } from '@/config/index.js'
import {
getAppConfigs
} from '@/config/index.js'
import { getNologinEmail, getOpenid } from "@/utils/auth";
getNologinEmail,
getOpenid
} from "@/utils/auth";
import { CommentWidgetCaptchaCookies } from '@/common/constant/cookies.js'
export default {
getPostList: (params) => {
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts`, params)
@@ -52,11 +54,27 @@ export default {
},
addPostComment: (data) => {
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments`, data)
const captchaCode = data.captchaCode;
delete data.captchaCode;
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments`, data, {
header: {
"Accept": "application/json",
"X-Captcha-Code": captchaCode,
"Cookie": getCache(CommentWidgetCaptchaCookies) ?? undefined
}
})
},
addPostCommentReply: (commentName, data) => {
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, data)
const captchaCode = data.captchaCode;
delete data.captchaCode;
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, data, {
header: {
"Accept": "application/json",
"X-Captcha-Code": captchaCode,
"Cookie": getCache(CommentWidgetCaptchaCookies) ?? undefined
}
})
},
getTagList: (params) => {
@@ -68,19 +86,11 @@ export default {
},
getMomentList: (params) => {
return HttpHandler.Get(`/apis/api.moment.halo.run/v1alpha1/moments`, params, {
custom: {
personalToken: getPersonalToken()
}
})
return HttpHandler.Get(`/apis/api.moment.halo.run/v1alpha1/moments`, params)
},
getMomentByName: (name) => {
return HttpHandler.Get(`/apis/api.moment.halo.run/v1alpha1/moments/${name}`, {}, {
custom: {
personalToken: getPersonalToken()
}
})
return HttpHandler.Get(`/apis/api.moment.halo.run/v1alpha1/moments/${name}`, {})
},
getBlogStatistics: () => {
@@ -176,10 +186,17 @@ export default {
},
getDoubanDetail: (url) => {
return HttpHandler.Get(`/apis/api.douban.moony.la/v1alpha1/doubanmovies/-/getDoubanDetail`, { url })
return HttpHandler.Get(`/apis/api.douban.moony.la/v1alpha1/doubanmovies/-/getDoubanDetail`, {
url
})
},
postTrackersCounter: (data) => {
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/trackers/counter`, data)
},
/** 获取评论验证码 */
getCommentWidgetCaptcha: () => {
return HttpHandler.Get(`/apis/api.commentwidget.halo.run/v1alpha1/captcha/-/generate`, {})
}
}
+10
View File
@@ -7,4 +7,14 @@ export default {
getAppConfigs: () => {
return HttpHandler.Get(`/apis/api.uni.uhalo.pro/v1alpha1/plugins/plugin-uni-halo/getConfigs`, {})
},
/** 获取全局配置信息 */
getHaloGlobalInfo: () => {
return HttpHandler.Get(`/actuator/globalinfo`, {})
},
/** 获取评论组件配置 */
getCommentWidgetConfig: () => {
return HttpHandler.Get(`/apis/api.commentwidget.halo.run/v1alpha1/config`, {})
},
}