Skip to content

Commit

Permalink
update the readme file, prepared for the upgrade to version v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
D0n9X1n committed Feb 4, 2017
1 parent dae4012 commit a017147
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 129 deletions.
64 changes: 2 additions & 62 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message: Welcome to my blog, enter password to read.

+ Then use *hexo clean && hexo g && hexo s* to see your blog.

#Detail Usage
#Advanced Usage

###First you should enable the plugin in your _config.yml like below.
```
Expand All @@ -67,9 +67,8 @@ encrypt:
enable: true
```

###Then, there are two ways to add password to the blogs.
###Then, add password to the blogs.

#### The recomanded one: add password to the source blog file.
```
---
title: Hello World
Expand All @@ -84,30 +83,6 @@ As we can see above, we add 'password, abstract, message' the new 3 items in the
+ abstract is the content which will be showed in the blog list page.
+ message is the content which will be showed in the blog detail page.


#### The original one: add config to the _config.yml file.
```
# Security
##
encrypt:
enable: true
blogs:
- title: hello world
password: mikemessi
- title: fff
password: fff
```

+ It means the blog named **hello world** has been encrypted with the password 'mikemessi'.
+ **Blog's title, it should be the same.**

```
---
title: hello world
date: 2016-03-30 21:18:02
---
```

### Encrypt TOC

If you has a post with TOC, you should change the code of template. Use the default theme 'landscape' as an example:
Expand Down Expand Up @@ -200,41 +175,6 @@ template:

The plugin will use the template content instead of the default one.

Or you can use these feature in the old way, but not recomand any more.

```
# Security
##
encrypt:
enable: true
blogs:
- title: hello world
password: mikemessi
abstract: 文章已经被加密,请在文章页输入密码查看</br>
template:
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<div id="security">
<span>密码是 "mikemessi"</span>
<div>
<div class="input-group">
<input type="text" class="form-control" aria-label="请输入密码" id="pass"/>
<div class="input-group-btn">
<button type="button" class="btn btn-default" onclick="decryptAES()">解密</button>
</div>
</div>
</div>
</div>
<div id="encrypt-blog" style="display:none">
{{content}}
</div>
```

This method is not recomanded because if we use the plugin for a long time, the _config.yml will be too long and hard to fix.

##TODO
See [TODO](./TODO.md) file.

Expand Down
65 changes: 1 addition & 64 deletions ReadMe.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ encrypt:
enable: true
```

###有两种方法给文章添加密码:

####比较推荐的一种方法, 在文章文件中添加:

###给文章添加密码:
```
---
title: hello world
Expand All @@ -94,34 +91,6 @@ message: Welcome to my blog, enter password to read.
+ abstract: 是该博客的摘要,会显示在博客的列表页
+ message: 这个是博客查看时,密码输入框上面的描述性文字

+ 在 hexo 根木录的 **_config.yml** 中添加配置信息:


####之前的老版本的配置方法依旧是可行的,不过将会废除。
```
# Security
##
encrypt:
enable: true
blogs:
- title: hello world
password: mikemessi
abstract: Hello
- title: fff
password: fff
abstract: Hello
```

+ 对于标题为 hello world 的博客,设置密码为 mikemessi,对于标题为 fff 的博客,密码设置为 fff

```
---
title: hello world
date: 2016-03-30 21:18:02
tags:
---
```
+ 这边要注意,标题一定要一致(前后空格无所谓)


### 对 TOC 进行加密
Expand Down Expand Up @@ -218,38 +187,6 @@ template:
---
```

+ 原有的添加方式依旧有效,不过已经不再推荐。

```
# Security
##
encrypt:
enable: true
blogs:
- title: hello world
password: mikemessi
abstract: 文章已经被加密,请在文章页输入密码查看</br>
template:
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<div id="security">
<span>密码是 "mikemessi"</span>
<div>
<div class="input-group">
<input type="text" class="form-control" aria-label="请输入密码" id="pass"/>
<div class="input-group-btn">
<button type="button" class="btn btn-default" onclick="decryptAES()">解密</button>
</div>
</div>
</div>
</div>
<div id="encrypt-blog" style="display:none">
{{content}}
</div>
```

##TODO
See [TODO](./TODO.md) File

Expand Down
2 changes: 2 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
2.~~Complete the password checking.~~
3.~~Add config to the blog source instead of the total config file.~~
4.~~Encrypt the TOC of the blog.~~
5. upgrade to version v1.2.0.
+ remove the origin password config method.


##BUG
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ hexo.extend.filter.register("after_post_render", function (data) {
data.content = CryptoJS.enc.Base64.stringify(data.content);
data.content = CryptoJS.AES.encrypt(data.content, String(data.password)).toString();
data.content = data.template.replace('{{content}}', data.content);
data.content = '<span id="encrypt-message">' + data.message + '</span>' + data.content;
data.content = '<h3 id="encrypt-message">' + data.message + '</h3>' + data.content;
data.content = '<script src="' + hexo.config.root + 'mcommon.js"></script>' + data.content;
data.content = '<script src="' + hexo.config.root + 'crypto-js.js"></script>' + data.content;

Expand Down Expand Up @@ -95,7 +95,7 @@ hexo.extend.filter.register("after_post_render", function (data) {
data.content = CryptoJS.enc.Base64.stringify(data.content);
data.content = CryptoJS.AES.encrypt(data.content, hexo.config.encrypt.blogs[i].password).toString();
data.content = hexo.config.encrypt.blogs[i].template.replace('{{content}}', data.content);
data.content = '<span id="encrypt-message">' + hexo.config.encrypt.blogs[i].message + '</span>' + data.content;
data.content = '<h3 id="encrypt-message">' + hexo.config.encrypt.blogs[i].message + '</h3>' + data.content;
data.content = '<script src="' + hexo.config.root + 'mcommon.js"></script>' + data.content;
data.content = '<script src="' + hexo.config.root + 'crypto-js.js"></script>' + data.content;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.1.10"
"version": "1.1.11"
}

0 comments on commit a017147

Please sign in to comment.