7

LeanCloud国内版迁移至国际版

 3 years ago
source link: https://felixxiong.github.io/2020/09/25/LeanCloud%E8%BF%81%E7%A7%BB%E8%87%B3%E5%9B%BD%E9%99%85%E7%89%88/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

LeanCloud国内版迁移至国际版

2020-09-25

| 博客探索

Hexo

功能组件

|

|

| 89

596

|

2

自从9月15日收到第一条LeanCloud的“实名认证”的短信之后,发现自己之前的错误选择。

对于自己信奉的“自由信条”,所以在自己做产品的时候,一定要让评论更“自由”。博客产品也是如此。

首先从华北节点的LeanCloud数据进行导出,开发版不支持转让应用,否则可能更便捷。

之后,查看邮件,会得到带有.tar.gz的压缩文件格式,解压缩之后是多个json文件。

国际版开始配置

国际版Leancloud入口:https://console.leancloud.app/login.html#/signin,选择国际版

创建Class

如果你使用的是Valine的评论(下文也会提到),那么需要根据国内版的节点创建Class,如图所示:

根据你的使用场景来创建,我创建的是Comment+Counter:评论与未读计数

未命名.001.jpeg

改版后的控制台创建Class需要权限,也可以在国内版的权限中进行设置:

未命名.002.jpeg

存储-导入导出-输入创建的两个Class的名称,我这里是Comment与Counter,输入两次,选择文件即可。

若未出现绿色导入成功的提示,刷新一下页面,查看结构化数据即可。

我这里还有_User字段,应该是用来存储用户评论的用户(名)的,也进行导入。

未命名.003.jpeg

Key的设置

这里根据你创建的Class进行修改,我需要修改两处:

先是评论(Comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
# Valine.
# You can get your appid and appkey from https://leancloud.cn
# more info please open https://valine.js.org
valine:
enable: true
appid: # your leancloud application appid
appkey: # your leancloud application appkey
notify: true # mail notifier , https://github.com/xCss/Valine/wiki
verify: false # Verification code
placeholder: Just go go # comment box placeholder
avatar: mm # gravatar style
guest_info: nick,mail,link # custom comment header
pageSize: 10 # pagination size

之后为访问量(Counter):

1
2
3
4
5
6
# Show number of visitors to each article.
# You can visit https://leancloud.cn get AppID and AppKey.
leancloud_visitors:
enable: true
app_id: #<app_id>
app_key: #<app_key>

最后hexo g -d上去,随便找一条最新的博文输入测试数据,之后在控制台进行查看即可。

删除国内版LeanCloud账号,需事先删除应用。

设置-风险监测,可查看当前应用的情况,可结合相应权限进行更改操作。

博客评论系统选用之路

Hexo博客Next主题添加统计文章阅读量功能

FelixXiong wechat
产品北里,讲述产品和人性、涉及设计、技术和运营的公众号。
你们的赞赏是我更新的动力~

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK