hexo-blog-encrypt 3.1.7 → 3.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -1
- package/LICENSE +1 -1
- package/ReadMe.md +10 -1
- package/ReadMe.zh.md +10 -1
- package/lib/hbe.js +4 -0
- package/lib/hbe.style.css +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
package/ReadMe.md
CHANGED
|
@@ -143,7 +143,16 @@ It will be called after the blog is decrypted.
|
|
|
143
143
|
</script>
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
Demo: [Callback Example](https://mhexo.github.io/
|
|
146
|
+
Demo: [Callback Example](https://mhexo.github.io/2020/12/06/Callback-Test/).
|
|
147
|
+
|
|
148
|
+
### After Decrypt Event
|
|
149
|
+
Thanks to @[f-dong](https://github.com/f-dong), we now will trigger a event named `hexo-blog-decrypt`, so you can add a call back to listen to that event.
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
// trigger event
|
|
153
|
+
var event = new Event('hexo-blog-decrypt');
|
|
154
|
+
window.dispatchEvent(event);
|
|
155
|
+
```
|
|
147
156
|
|
|
148
157
|
### Encrypt TOC
|
|
149
158
|
|
package/ReadMe.zh.md
CHANGED
|
@@ -149,7 +149,16 @@ It will be called after the blog decrypted.
|
|
|
149
149
|
</script>
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
例子在: [Callback 例子](https://mhexo.github.io/
|
|
152
|
+
例子在: [Callback 例子](https://mhexo.github.io/2020/12/06/Callback-Test/).
|
|
153
|
+
|
|
154
|
+
### 解密后的触发事件
|
|
155
|
+
感谢 @[f-dong](https://github.com/f-dong), 我们现在会在解密完成后触发一个 `hexo-blog-decrypt` 事件, 你们可以编写 callback 来监听该事件.
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
// trigger event
|
|
159
|
+
var event = new Event('hexo-blog-decrypt');
|
|
160
|
+
window.dispatchEvent(event);
|
|
161
|
+
```
|
|
153
162
|
|
|
154
163
|
### 对 TOC 进行加密
|
|
155
164
|
|
package/lib/hbe.js
CHANGED
|
@@ -216,6 +216,10 @@ const knownPrefix = "<hbe-prefix></hbe-prefix>";
|
|
|
216
216
|
tocDivs[idx].style.display = 'inline';
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
+
|
|
220
|
+
// trigger event
|
|
221
|
+
var event = new Event('hexo-blog-decrypt');
|
|
222
|
+
window.dispatchEvent(event);
|
|
219
223
|
|
|
220
224
|
return await verifyContent(hmacKey, decoded);
|
|
221
225
|
}).catch((e) => {
|
package/lib/hbe.style.css
CHANGED