Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

xvaline

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xvaline

comment system with spam checking and review, based on Valine.

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

XValine

简介

又一个基于 Valine 开发的支持先审核后显示、关键词屏蔽的评论系统。后端同时兼容默认的 leancloudValine-admin 部署。

项目链接

Why XValine

支持审核后显示、关键词屏蔽。对于中国大陆注册的网站,如果有评论、留言等功能,根据公安备案的相关要求,需要实现先审核后显示关键词屏蔽的功能

无后端实现。我的博客是 Hugo 搭建的静态网站,很适合与 Valine 这类只需要简单配置,而无需后端实现的评论系统搭配使用。

此外,参考了 NeoValine:一个基于 Valine 开发的支持人工审核的评论系统 这篇文章中对目前常见几款评论系统的对比。结合上述两点核心诉求,于是就有了 XValine

特点

  • 默认开启关键词屏蔽(昵称、评论内容)
  • 默认开启先审核后显示
  • 无后端实现,后端同时兼容默认的 leancloudValine-admin
  • 免费开源无广告(GPL-2.0 License)
  • 基于 Valine 二次开发,快速、简洁、高效

快速开始

为了便于 Valine 用户使用,安装方式尽量与其保持一致。

同时,默认开启先审核后显示关键词屏蔽功能,方便使用。Hugo 用户也无需修改 layoutconfig.toml 配置。

安装方法


// 使用 npm
npm install xvaline --save

// 使用 cdn 加载最新版本 XValine
<script src='https://cdn.jsdelivr.net/npm/xvaline@latest/dist/Valine.min.js'></script>

// Use import
import Valine from 'xvaline';

// or Use require
const Valine = require('xvaline');

new Valine({
    // 页面中 <div id="vcomments"></div>
    el:'#vcomments',
    // 配置 Leancloud or Valine-Admin 的 app 信息
    appId: 'Your appId',
    appKey: 'Your appKey',
    // other config
})

关键词屏蔽

设置关键词屏蔽后,用户提交评论时,如果包含屏蔽词,则会弹层告知内容中含有某某屏蔽词,可以一定程度上减少垃圾信息。

  • 支持自定义屏蔽词列表

image


/**
 * 关键词屏蔽配置
 * banKeywords: "default" | url | undefined
 * 默认开启,参数 "default"
 */
new Valine({
    el:'#vcomments',
    // 配置 Leancloud or Valine-Admin 的 app 信息
    appId: 'Your appId',
    appKey: 'Your appKey',
    // 默认开启,加载默认关键词配置
    banKeywords: "default",
    // 手动指定关键词地址,json 格式,{"code": 200, "data": ["关键词1","关键词2"]}
    // banKeywords: "https://yourconfigurl.json",
    // 或者不填该字段,不屏蔽关键词
    // other config
})


先审核后显示

同时兼容默认的 leancloudValine-admin 部署方式。

设置 requireReview:true 后,未审核通过的评论在前端展示时会显示为该评论需要审核后才可以显示哦~ ヾ(๑╹◡╹)ノ"

  • 使用默认 leancloud。在 LeanCloud 后台将评论 isSpam 属性改为 false,审核通过该评论。(感谢alwxkxk 的启发)
  • 使用 Valine-admin。常规操作即可。

image

/**
 * 先审核后显示,默认开启
 * requireReview: boolean 是否需要人工审核,默认为 true
 */
new Valine({
    // 页面中 <div id="vcomments"></div>
    el:'#vcomments',
    // 配置 Leancloud or Valine-Admin 的 app 信息
    appId: 'Your appId',
    appKey: 'Your appKey',
    // 设置为需要人工审核
    requireReview: true,
    // 推荐加上友情提示语,防止访客发完评价后看不见提bug……
    placeholder: "评论在后台人工审核后可见~"
})

更新日志

当前稳定版本 v 0.0.6, 查看更新日志

鸣谢

附:关于 Valine

介绍

Valine 文档 快速开始

version npm downloads build

Valine 诞生于2017年8月7日,是一款基于LeanCloud的快速、简洁且高效的无后端评论系统。

理论上支持但不限于静态博客,目前已有HexoJekyllTypechoHugoGhost 等博客程序在使用Valine。

特性

  • 快速
  • 安全
  • Emoji 😉
  • 无后端实现
  • MarkDown 全语法支持
  • 轻量易用
  • 文章阅读量统计 v1.2.0+

License

GPL-2.0

Keywords

simple

FAQs

Package last updated on 07 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts