KnowSphere 主题接入速查表

返回值

调用返回形状读取
getPluginInfo()同步对象直接读取 cssUrl/jsUrl/pro
checkAccess('post', name)Mono.block(),读取 hasAccess
listMembershipPlans()Flux.collectList().block()
listMyOrders(1, 10)Mono 分页.block().items,先判空
getColumnDetail(name)Mono.block(),读取 column/chapters

常用字段

  • 套餐:title、name、price、durationDays、allBenefits。
  • 会员:active、levelDisplayName、expireAt。
  • 章节:name、title、permalink、isFreePreview、dripStatus。
  • 访问检查:hasAccess、unlockMethods、purchaseTargetType、purchaseTargetName。

常用模板

<div class="post-content" th:utext="${post.content.content}"></div>
<ks-checkin-calendar title="每日签到"></ks-checkin-calendar>
<ks-comment-widget group="content.halo.run" kind="Post" version="v1alpha1"
  th:attr="name=${post.metadata.name}"></ks-comment-widget>

通常资源已自动注入;特殊场景读取 getPluginInfo().cssUrl/jsUrl。Pro 文件名不同,不拼接路径。

HTTP

  • 公共前缀:/apis/api.knowsphere.webjing.com/v1alpha1。
  • 当前用户前缀:/apis/uc.api.knowsphere.webjing.com/v1alpha1。
  • GET /access/-/check?type=post&name=<metadata.name>。
  • GET /paywall/-/target-preview?type=post&name=<metadata.name>。
  • 主题不使用后台管理权限、不保存支付密钥。

容易踩错

Boolean HTML 属性存在即为真;对象和数组通过 JS property 赋值,不把 [object Object] 当 JSON。ks-paywall 使用 unlock-methods;组件显示状态不构成授权。仅凭邮箱不能领取评论解锁凭证。基础专栏、评论区和支付订单导出属于 Base。

Finder 完整合同 · HTTP 合同 · 组件属性