diff --git a/components/FriendsCommentInput.vue b/components/FriendsCommentInput.vue
index 178073d7..4ebaeb4d 100644
--- a/components/FriendsCommentInput.vue
+++ b/components/FriendsCommentInput.vue
@@ -69,7 +69,7 @@ const saveComment = async () => {
toast.warning('先填写评论')
return
}
- if (content.value.length > parseInt(config.public.commentMaxLength)) {
+ if (content.value.length > parseInt(config.public.momentsCommentMaxLength)) {
toast.warning('评论超长')
return
}
@@ -86,11 +86,11 @@ const saveComment = async () => {
return
}
- if (config.public.recaptchaV3SiteKey) {
+ if (config.public.googleRecaptchaSiteKey) {
//@ts-ignore
grecaptcha.ready(function () {
//@ts-ignore
- grecaptcha.execute(config.public.recaptchaV3SiteKey, { action: 'submit' }).then(async function (token) {
+ grecaptcha.execute(config.public.googleRecaptchaSiteKey, { action: 'submit' }).then(async function (token) {
submitComment(token)
});
});
diff --git a/components/FriendsMemo.vue b/components/FriendsMemo.vue
index ac5f4eeb..412489f7 100644
--- a/components/FriendsMemo.vue
+++ b/components/FriendsMemo.vue
@@ -93,8 +93,8 @@
{{ likeList.findIndex((id) => id === props.memo.id) >= 0 ? '取消' : '赞' }}
-
+
@@ -106,13 +106,13 @@
{{ props.memo.favCount }}位访客赞过
-
-
+
+
+ @comment-started="momentsShowCommentInput = false" />
查看更多...
@@ -155,13 +155,13 @@ const props = withDefaults(
const config = useRuntimeConfig()
const emit = defineEmits(['memo-update'])
-const maxLine = config.public.maxLine
+const maxLine = config.public.momentsMaxLine
const maxHeight = ref(24 * parseInt(maxLine))
const showAll = ref(false)
const showToolbar = ref(false)
-const showCommentInput = ref(false)
+const momentsShowCommentInput = ref(false)
const toolbarRef = ref(null)
const showUserCommentArray = useState
>('showUserCommentArray_' + props.memo.id, () => [])
const el = ref(null)
@@ -234,7 +234,7 @@ const editMemo = async () => {
const refreshComment = async () => {
emit('memo-update', props.memo)
showUserCommentArray.value = []
- showCommentInput.value = false
+ momentsShowCommentInput.value = false
}
diff --git a/components/MemoInput.vue b/components/MemoInput.vue
index 067b3b23..40c99cdc 100644
--- a/components/MemoInput.vue
+++ b/components/MemoInput.vue
@@ -47,7 +47,7 @@
-
+
@@ -75,7 +75,7 @@
-
+
@@ -117,7 +117,7 @@
-
+
diff --git a/index.d.ts b/index.d.ts
index bf2026ed..94302b45 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -2,13 +2,14 @@ declare module 'nuxt/schema' {
interface RuntimeConfig {
}
interface PublicRuntimeConfig {
- showComment:string
- commentEnable:string
- commentOrderBy:string
- commentMaxLength:string
- toolbarEnableDouban:string
- toolbarEnableMusic163:string
- toolbarEnableVideo:string
+ momentsShowComment:string
+ momentsCommentEnable:string
+ momentsCommentOrderBy:string
+ momentsCommentMaxLength:string
+ momentsToolbarEnableDouban:string
+ momentsToolbarEnableMusic163:string
+ momentsToolbarEnableVideo:string
+ momentsMaxLine:string
}
}
// It is always important to ensure you import/export something when augmenting a type
diff --git a/layouts/default.vue b/layouts/default.vue
index a6b07a14..49fde739 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -51,7 +51,7 @@ useHead({
]
})
-if (config.public.recaptchaV3SiteKey) {
+if (config.public.googleRecaptchaSiteKey) {
useHead({
script: [
{
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 2c736733..aaa3aaf9 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -2,17 +2,17 @@
export default defineNuxtConfig({
devtools: { enabled: false },
runtimeConfig: {
- recaptchaV3secretKey: process.env.NUXT_GOOGLE_RECAPTCHA_SECRET_KEY || "",
+ googleRecaptchaSecretKey: process.env.NUXT_GOOGLE_RECAPTCHA_SECRET_KEY || "",
public: {
- commentEnable:process.env.NUXT_MOMENTS_COMMENT_ENABLE || "true",
- showComment:process.env.NUXT_MOMENTS_SHOW_COMMENT || "true",
- commentMaxLength: process.env.NUXT_MOMENTS_COMMENT_MAX_LENGTH || "120",
- commentOrderBy: process.env.NUXT_MOMENTS_COMMENT_ORDER_BY || "desc",
- toolbarEnableDouban: process.env.NUXT_MOMENTS_TOOLBAR_ENABLE_DOUBAN || "true",
- toolbarEnableMusic163: process.env.NUXT_MOMENTS_TOOLBAR_ENABLE_MUSIC163 || "true",
- toolbarEnableVideo: process.env.NUXT_MOMENTS_TOOLBAR_ENABLE_VIDEO || "true",
- maxLine: process.env.NUXT_MOMENTS_MAX_LINE || "4",
- recaptchaV3SiteKey: process.env.NUXT_GOOGLE_RECAPTCHA_SITE_KEY || "",
+ momentsCommentEnable: "true",
+ momentsShowComment:"true",
+ momentsCommentMaxLength: "120",
+ momentsCommentOrderBy: "desc",
+ momentsToolbarEnableDouban: "true",
+ momentsToolbarEnableMusic163: "true",
+ momentsToolbarEnableVideo: "true",
+ momentsMaxLine: "4",
+ googleRecaptchaSiteKey: "",
},
},
modules: ["@nuxtjs/tailwindcss", "shadcn-nuxt", "@nuxtjs/color-mode"],
diff --git a/server/api/comment/save.post.ts b/server/api/comment/save.post.ts
index 411c66db..40d31e26 100644
--- a/server/api/comment/save.post.ts
+++ b/server/api/comment/save.post.ts
@@ -39,10 +39,10 @@ export default defineEventHandler(async (event) => {
const { content, email, username, website, token } = request;
const userId = event.context.userId;
- if (config.recaptchaV3secretKey && !token) {
+ if (config.googleRecaptchaSecretKey && !token) {
return { success: false, message: "小样儿,你是不是人机?" };
}
- if (content.length > parseInt(config.public.commentMaxLength)) {
+ if (content.length > parseInt(config.public.momentsCommentMaxLength)) {
return { success: false, message: "评论超长了,老板" };
}
if (username.length > 10) {
@@ -55,9 +55,9 @@ export default defineEventHandler(async (event) => {
return { success: false, message: "网站地址也没这么长的啊" };
}
- if (config.recaptchaV3secretKey) {
+ if (config.googleRecaptchaSecretKey) {
const response = (await $fetch(
- `https://recaptcha.net/recaptcha/api/siteverify?secret=${config.recaptchaV3secretKey}&response=${token}`
+ `https://recaptcha.net/recaptcha/api/siteverify?secret=${config.googleRecaptchaSecretKey}&response=${token}`
)) as any as recaptchaResponse;
if (response.score > 0.5) {
await insertComment(userId, request);
diff --git a/server/api/memo/list.post.ts b/server/api/memo/list.post.ts
index 72402716..92de308c 100644
--- a/server/api/memo/list.post.ts
+++ b/server/api/memo/list.post.ts
@@ -24,7 +24,7 @@ export default defineEventHandler(async (event) => {
comments: {
//@ts-ignore
orderBy: {
- createdAt: config.public.commentOrderBy,
+ createdAt: config.public.momentsCommentOrderBy,
},
take: 5,
},