plugin-comment-widget
plugin-comment-widget copied to clipboard
前端无法获取对应的配置参数
我需要依靠官方插件自定义样式一个瞬间模板的评论样式
已经通过官方的公共api 评论回复 样式 都已经实现,
但是在写验证码这边遇到了一个问题,我没有找到公共访问插件配置的api,目前插件配置的api都需要管理员登录后才能调用
/apis/api.console.halo.run/v1alpha1/plugins/PluginCommentWidget/json-config
获取到的是
{
"basic": {
"withReplies": false,
"size": 20,
"withReplySize": 5,
"replySize": 10
},
"security": {
"captcha": {
"enable": false,
"type": "ALPHANUMERIC",
"anonymousCommentCaptcha": true
}
},
"avatar": {
"provider": "gravatar",
"enable": true,
"providerMirror": "",
"policy": "anonymousUser"
}
}
而前端需要传递对应的参数到js中渲染html,这对应的几个参数无法通过标签亦或者api获取,是否 有办法,或后续增加api的方式来解决自定义评论的这个问题,name group kind 匿名 可以通过全局变量等方式获取,但头像服务器,分页,以及验证码是否开启无法获取
<script defer th:inline="javascript">
PyqComment.init(
"#comment-moment-halo-run-Moment-" + /*[[${moment.metadata.name}]]*/,
{
group: "moment.halo.run",
kind: "Moment",
name: /*[[${moment.metadata.name}]]*/, // 动态传递 momentName
size: 20,
replySize: 10,
withReplies: true,
withReplySize: 5,
useAvatarProvider: true,
avatarProvider: "gravatar",
avatarProviderMirror: "https://cravatar.cn",
avatarPolicy: "noAvatarUser",
captchaEnabled: false,
}
);
</script>
/ping @halo-dev/sig-halo
现在已经提供了一个新的公开 API 获取配置数据。
https://github.com/halo-dev/plugin-comment-widget/pull/185
/close
@ruibaby: Closing this issue.
In response to this:
现在已经提供了一个新的公开 API 获取配置数据。
https://github.com/halo-dev/plugin-comment-widget/pull/185
/close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.