Coder Social home page Coder Social logo

xcss / valine Goto Github PK

View Code? Open in Web Editor NEW
2.2K 18.0 250.0 3.73 MB

A fast, simple & powerful comment system.

Home Page: https://valine.js.org

License: GNU General Public License v2.0

JavaScript 77.33% HTML 6.64% SCSS 16.02%
simple easy-to-use fast-and-safe comment-system

valine's Issues

TypeError

TypeError: Cannot read property 'slice' of undefined
Valine:1.1.6

是否可以添加 Firebase 数据存储支持

(。・∀・)ノ゙嗨,这个项目很棒。
理念上 Leancloud 和 Firebase 的后端是一致的,我想是否可以添加 Firebase 后端支持,现在 Firebase 在大陆访问速度也是可以的。

Valine.pure 打包输出问题

前一阵子我提交了一个分离 CSS 后的 pure 版本打包的 PR,以便于自定义主题。一直没来得及实际运用,刚才加到博客试了一下,发现打包的输出有问题。

image

因为 webpack 中配置的 output.library'[name]',所以直接以文件名作为包名输出了。

image

有两个修改建议,想征求下作者的意见:

  1. library 写成固定值 Valine,引用两个文件的调用一致,都是 new Valine
  2. pure 版本名称变为 Valine_pureValinePure,以便于可以直接访问(目前因为名称包含 .,必须 window['Valine.pure'] 调用)

异步加载

目前 unpkg 在国内的速度实在太慢了。而且官方网站提供的加载方式是阻塞模式的,遇到网络不好的时候会阻塞页面里其他脚本的加载,这个体验是非常不好的。(disqus使用了iframe方式避免了这个问题)。下面我的一个小建议:

  1. 将av-min依赖合并到Valine中,或者在valine里面动态加载。
  2. 将配置使用url参数的形式写在script的src链接后面: 例如:
window.VALINECONFIG = {
    el: '#comment',
    notify: false,
    verify: false
  }
<script src=".../Valine.min.js?config=VALINECONFIG" async></script>

附上一个我目前使用的解决方案:

function loadValine() {
  const config = window["VALINECONFIG"];
  if (!config) return;
  const urls = [`//cdn1.lncld.net/static/js/3.0.4/av-min.js`,`//unpkg.com/valine/dist/Valine.min.js`];
  const asyncloader = url =>
    new Promise((resolve, reject) => {
      const script = document.createElement("script");
      script.src = url;
      script.addEventListener("load", _ => resolve(), false);
      script.addEventListener("error", _ => reject(), false);
      document.body.appendChild(script);
    });
  Promise.all(urls.map(asyncloader))
    .then(() => new window["Valine"](config))
    .catch(e => U.log("load Valine Failed,", e));
}

评论统计接口只在文章页有效,在index页面无效

<!-- 
    会自动查找网页中class值为valine-comment-count的元素并自动填充查询结果
    pathname = /2017/add-valine-comments-to-your-blog/
-->
<span class="valine-comment-count" data-xid="pathname"></span>

pathname已经成功获取了,但是在index页依然无效。

不同用户头像是怎么显示的?

我想了解下头像是怎么实现的,有的人在给文章评论时候,他的头像是特殊的,和默认的不一致,这个是怎么实现的呢?是根据邮箱匹配头像的吗?

HEXO-next的Valine评论与自定义页面API访问冲突

If you want to report a bug, please provide the following information:

  • "ua": "Chrome/63.0.3239.132",

为了快速预览留言,根据hexo的阅读排行榜做了个留言板。通过REST API访问
这个我也不懂,求助

  • 关闭Valine评论,页面正常。应该是评论系统访问API中间有冲突。


已修改了二级服务器还是没有用


<p align="justfly" id="heheda"><br></font></p>

<script src="/static/js/av-core-mini-0.6.4.js"></script>

<script>AV.initialize("uIrzS1i60S024CvU6ATzr4y7-gzGzoHsz", "9o0rnB856nyqXPURwBBncFkR");</script>

<script type="text/javascript">
  var num=50
  var comment=""
  var url=""
  var nick=""
  var query = new AV.Query('Comment');
  query.notEqualTo('id',0); 
  query.descending('createdAt') 
  query.limit(num); 
  query.find().then(function (todo) {
    for (var i=0;i<num;i++){ 
      var result=todo[i].attributes;
      comment=result.comment; 
      url=result.url;  
	  nick=result.nick;  
	  var updatedAt = todo[i].updatedAt;
      var content="<blockquote>"+"<font size=2>"+"<a href='"+"https://sli1989.github.io"+url+"#comments"+"'>"+"<font color='#9932CC'>"+nick+"</font>"+"</a>"+" commented on "+updatedAt+":"+"<br>"+comment+"</font>"+"<blockquote>";
      document.getElementById("heheda").innerHTML+=content
    }
  }, function (error) {
    console.log("error");
  });
</script>

valine 评论不能显示

电脑系统:win7;浏览器:chrome(其他浏览器可以);valine评论无法显示,如下图所示:

增加 guest info 的必输项

当前 Valine 没有配置项导致 nick,mail,website 三者全为空也可以提交,希望增加对必输项的检测配置。

针对邮件提醒的一些意见与建议

版本信息: hexo-theme-next | Merged v1.1.7-rc3

因为邮箱提醒还在内测中,并没有将此功能加入我的博客系统,但自己用了一下之后,有几点体验问题想跟作者提一下醒。
在邮件提醒中就是 leancloud 那边的邮件模板设置中能够提供几个变量来获取相应的内容。

  1. 获取文章的 title。
  2. 点击马上查看的 URL ,是指向 url#rid
    (PS:在我看来,评论人接受到邮件是希望能够直观地看到哪篇文章的哪条评论被回复了)

无法正确发送邮件提醒

Valine版本v1.1.8-rc4

我使用的是 hexo-theme-material,有关配置如下
comment:
use: valine
valine_leancloud_appId: ***********
valine_leancloud_appKey: ***********
valine_notify: true # valine mail notify (true/false) https://github.com/xCss/Valine/wiki
valine_verify: true # valine verify code (true/false)
valine_pageSize: 10 # comment list page size
valine_avatar: identicon # gravatar style https://valine.js.org/#/avatar
valine_lang: zh-cn # i18n
valine_placeholder: 评论啊,快活啊! # valine comment input placeholder(like: Please leave your footprints )
valine_guest_info: nick,mail,link #valine comment header info

目前评论可以正常工作,但是无法收到邮件提醒(评论已有评论)
https://jakting.com

邮件提醒功能并未正常工作

Hi,我在 _config.yml 里使用了下面的配置,发现当 blog 里有新的 comment 时并未收到邮件提醒。

valine:
  enable: true ## if you want to use Valine comment system, please set the value to true
  appid: myappid ## your leancloud application appid
  appkey: myappkey ## your leancloud application appkey
  notify: true ## mail notifier , https://github.com/xCss/Valine/wiki
  verify: true ## Verification code
  placeholder: Just go go ## comment input placeholder text 
  avatar: 'wavatar' ## header image https://github.com/xCss/Valine/wiki
  pageSize: 10 ## 
  guest_info: nick,mail

Thanks!

底部多了一个框

不知道为什么多了一块灰色的框,我去群里反馈群主跟我说是报错了,那我应该如何修改?
版本是v1.1.8-rc4
qq 20171127191216

关于验证码

特别喜欢,如果验证码正常点就好了,两位数相乘就过分了,因为既然只是过滤垃圾,那么复杂性恰是不必要的,换成十以内两个数之间计算也好啊。还有如果可以过滤整合akismet,验证码也能省去了,还有gravator头像的支持?

自定义无评论的字段

“暂时没有评论,快来抢沙发”有时与博客的氛围很不搭啊23333,希望可以自定义这个字段

使用pjax时,报错:TypeError: Cannot read property 'Query' of undefined

问题描述

主题使用pjax,切换页面时不刷新整个页面。会出现下面的问题:
第一次加载页面,评论框可以正常使用,但是切换其他页面后(没有刷新整个页面),评论框下就显示TypeError: Cannot read property 'Query' of undefined ,需要刷新整个页面才能使用。

报错位置:new _root.v.Query('Comment');

这个 _root 中没有 v 这个属性。
刷新整个页面时,第一次执行到这句话是有 v 这个属性。
但是异步加载第二个页面后,第二次执行到这句话是没有 v 这个属性的。

报错效果

第一次访问加载成功,并且可以评论。
image

切换到其他文章就会出现问题。
image

博客系统:hexo
主题:hexo-theme-3-hexo
valine版本:v1.1.9-beta4

配置信息:

<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='//unpkg.com/valine/dist/Valine.min.js'></script>
<div id="comments"></div>
<script>
    var notify = '<%= theme.valine.notify %>' == true ? true : false;
    var verify = '<%= theme.valine.verify %>' == true ? true : false;
    new Valine({
        el: '#comments',
        notify: notify,
        verify: verify,
        app_id: "<%= theme.valine.appid %>",
        app_key: "<%= theme.valine.appkey %>",
        placeholder: "<%= theme.valine.placeholder %>",
        avatar:"<%= theme.valine.avatar %>",
        path: '<%=url%>'
    });
</script>

提个反人类的问题

_config.yml

valine:
  notify: true
  verify: false

我的配置如上,只开启了邮箱提醒不开启验证码验证,然后会默认开启验证码,嗯~ o( ̄▽ ̄)o,对于算术验证这种反人类的验证我是不喜欢的,楼主可以添加其他验证方法,比如滑块的验证,字母数字组合验证

建议添加最近评论接口,以及一些小意见。

需求和 #53 类似, 建议添加获取最近 x 条评论的接口 (可以做限制)。 以便实现和 WordPress 最近回复的类似功能。
小意见:

  • 支持识别 IP位置 (如: 江苏,南京)
  • 可以给浏览器信息,系统信息添加上 icon
  • 支持异步加载 <script async="async" or <script defer="defer"
  • 支持 emoji 😃 (可以尝试集成 owo 表情)
  • 建议发布到 cdnjs, 这意味这将同步到国内大部分开放CDN。如:
  • 增加喜欢功能. ❤️

使用npm模块方式无法导入

{
  "name": "valine",
  "version": "1.1.8",
  "description": "A simple comment system based on Leancloud.",
  "main": "/src/Valine.js",
  "author": "xCss <[email protected]> (https://github.com/xCss)",
  "scripts": {
    "test": "webpack",
    "build": "webpack",
    "dev": "webpack-dev-server --env.dev",
    "clear": "rm -rf dist/* "
}
...
}

上述package.json里面把main指向了src/Valine.js,然而整个安装目录里面并没有src这个文件夹.

查看了 hexo 的 valine.swing 后提的建议

{% if page.comments and theme.valine.enable and theme.valine.appid and theme.valine.appkey %}

  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/xcss/[email protected]/dist/Valine.min.js"></script>
  <script type="text/javascript">
    new Valine({
        av: AV,
        el: '#comments' ,
        verify: {{ theme.valine.verify }},
        notify: {{ theme.valine.notify }},
        app_id: '{{ theme.valine.appid }}',
        app_key: '{{ theme.valine.appkey }}',
        placeholder: '{{ theme.valine.placeholder }}'
    });
  </script>
{% endif %}

这边的配置项少了几个,比如 avatar, path

[Question] Could you please adapt this to hexo-material-theme?

Thanks for your excellent work and I love it so much. However I can't apply this to my hexo-site.
I am using hexo-material-theme and I had tried to ported it by myself but I failed.
Thought I do konw nothing about WebDev, I tried to followed your guide and hexo-material-theme comment adaptation guide but get some worng:

ERROR Script load failed: themes/Material/scripts/lib/Valine.min.js
ReferenceError: window is not defined
    at /mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:19484
    at /mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:19439
    at n.exports (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:19939)
    at Object.<anonymous> (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:2732)
    at e (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:390)
    at Object.<anonymous> (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:3204)
    at e (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:390)
    at Object.defineProperty.value (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:773)
    at /mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:782
    at t (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:146)
    at /mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:267
    at /mnt/d/Documents/Blog/node_modules/hexo/lib/hexo/index.js:232:12
    at tryCatcher (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:524:17)
    at Promise._settlePromise (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:614:10)

Here is my environment Info:

hexo: 3.3.8
hexo-cli: 1.0.3
os: Linux 4.4.0-43-Microsoft linux x64
http_parser: 2.7.0
node: 8.1.4
v8: 5.8.283.41
uv: 1.12.0
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
openssl: 1.0.2l
icu: 59.1
unicode: 9.0
cldr: 31.0.1
tz: 2017b

├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

May be you can give me some suggestion or do it by yourself out of kindness.
My English is poor and I can provide Chinese version if you want.
Thanks again.

Jekyll怎么装呢

无意中看到了一个这么好的评论系统:heart_eyes:,可是到官网看教程只有Hexo的安装教程,Jekyll怎么装呢?也是类似的吗?:bowtie:

顺便反馈一个小Bug,就是评论框IE11内核无法输入中文:see_no_evil:

后台一条莫名奇妙的错误提示

Uncaught TypeError: Cannot redefine property: applicationId
    at Function.defineProperty (<anonymous>)
    at av-min.js:1
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (av-min.js:1)
    at e (av-min.js:1)
    at Object.t.exports (av-min.js:8)
    at e (av-min.js:1)
    at u (av-min.js:1)
    at av-min.js:1
    at av-min.js:1

正常访问和评论没有问题,但刷新页面评论区就显示undefined。

初始化失败,请检查你的appid或者appkey.

Valine:1.1.7-rc3

部署后,打开主页,评论框下面出现这个问题,appid和appkey均检查了几遍无误。另外,在评论框输入内容,点击回复时,无反应,也无法评论。请教一下,谢谢。

添加评论数据库

看到野火评论系统

使用免费的实时数据库(Firebase野狗)来储存你的评论数据,并带给你实时的交流体验。

希望Valine也集成进去,给大家的评论存储多一个选择。

#41 是否可以添加 Firebase 数据存储支持

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.