duoshuo / airpub

a pure front-end blog engine powered by duoshuo API
http://airpub.io
MIT License
361 stars 41 forks source link

请问airpub是如何做到验证管理员权限的? #18

Closed RingoTC closed 10 years ago

RingoTC commented 10 years ago

airpub是一个纯前端应用,那是如何来验证管理员权限?

YCF commented 10 years ago

其实文章数据是保存在多说的,所以验证也就是多说提供的啦。

RingoTC commented 10 years ago

但是据我所知,多说的同步文章不需要登录

YCF commented 10 years ago

不可能不需要登录。 也许是你登录了不知道而已,不然谁知道你是谁。

BTW: airpub有个40行的版本,部署起来非常简单,为什么不部署一个自己体验一下呢?

RingoTC commented 10 years ago

http://dev.duoshuo.com/docs/513fbb8ea1e7a29b3300007d

YCF commented 10 years ago

您贴出地址文档中的方式用到了 _shortname* 和 站点密钥 secret**,文档中说到的不需要登录是指不需要普通登录的那个 session,这是只在响应请求时直接通过请求参数进行验证,响应完成后 session 也就没了,只是与我们传统意义上登录看起来不同而已。

YCF commented 10 years ago

我刚在我部署的 demo站点看了一下,发布时用到的是 http://xxx.duoshuo.com/api/threads/create.json ,需要用到我多说的 cookie。并不是您前面提到的请求参数的方法。

RingoTC commented 10 years ago

谢谢,不部署实验的原因是我是一个高中狗-.-

guo-yu commented 10 years ago

@YCF 感谢细心解释

如有对多说或者 Airpub 任何疑问,或希望能增设某些需要使用到的 API,欢迎发信给 @shen2 或我