mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-09-03 04:02:40 +00:00
⚡ Perf: optimize fixit-encryptor shortcode and add documentations for it (#123)
This commit is contained in:
@@ -95,9 +95,39 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
{{< /script >}}
|
||||
|
||||
## Partial encryption
|
||||
## Partial Encryption
|
||||
|
||||
- [ ] fixit-encryptor shortcode
|
||||
{{< version 0.2.15 >}}
|
||||
|
||||
You can use `fixit-encryptor` shortcode to encrypt partial content.
|
||||
|
||||
The `fixit-encryptor` shortcode has the following named parameters:
|
||||
|
||||
* **password** *[required]* (**first** positional parameter)
|
||||
|
||||
Password of the partial encrypted content.
|
||||
|
||||
* **message** *[optional]* (**second** positional parameter)
|
||||
|
||||
Placeholder of the decryptor input.
|
||||
|
||||
Example `fixit-encryptor` input:
|
||||
|
||||
```go-html-template
|
||||
{{%/* fixit-encryptor "1212" "Password is 1212" */%}}
|
||||
The `fixit-encryptor` shortcode was supported in version {{</* version 0.2.15 */>}}.
|
||||
{{%/* /fixit-encryptor */%}}
|
||||
Or
|
||||
{{%/* fixit-encryptor password="1212" message="Password is 1212" */%}}
|
||||
The `fixit-encryptor` shortcode was supported in version {{</* version 0.2.15 */>}}.
|
||||
{{%/* /fixit-encryptor */%}}
|
||||
```
|
||||
|
||||
The rendered output looks like this:
|
||||
|
||||
{{% fixit-encryptor "1212" "Password is 1212" %}}
|
||||
The `fixit-encryptor` shortcode was supported in version {{< version 0.2.15 >}}.
|
||||
{{% /fixit-encryptor %}}
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -106,6 +136,10 @@ Compared with encrypting content through script batch processing such as golang/
|
||||
* **Advantages**: High usability, out of the box, without further batch processing
|
||||
* **Disadvantages**: Low security, the encryption algorithm is limited by the `go-html-template` syntax
|
||||
|
||||
> "The simplest password is enough to prevent 90% of people!"
|
||||
>
|
||||
> There is no trivial matter about privacy. Please do not upload important and private contents, and keep them properly!
|
||||
|
||||
## Class FixItDecryptor API {#fixit-decryptor-api}
|
||||
|
||||
FixIt decryptor for encrypted pages
|
||||
@@ -132,6 +166,10 @@ FixIt decryptor for encrypted pages
|
||||
|
||||
initialize FixIt decryptor
|
||||
|
||||
#### initShortcodes()
|
||||
|
||||
initialize fixit-encryptor shortcodes
|
||||
|
||||
#### validateCache()
|
||||
|
||||
validate the cached decryption statistics in localStorage
|
||||
|
||||
@@ -94,7 +94,37 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
## 部分加密
|
||||
|
||||
- [ ] fixit-encryptor shortcode
|
||||
{{< version 0.2.15 >}}
|
||||
|
||||
您可以使用 `fixit-encryptor` shortcode 来加密部分内容。
|
||||
|
||||
`fixit-encryptor` shortcode 具有以下命名参数:
|
||||
|
||||
* **password** *[必选]*(**第一个**位置参数)
|
||||
|
||||
部分加密内容的密码。
|
||||
|
||||
* **message** *[可选]*(**第二个**位置参数)
|
||||
|
||||
解密输入框的提示信息。
|
||||
|
||||
一个 `fixit-encryptor` 示例:
|
||||
|
||||
```go-html-template
|
||||
{{%/* fixit-encryptor "1212" "密码是 1212" */%}}
|
||||
`fixit-encryptor` shortcode 在版本 {{</* version 0.2.15 */>}} 得到支持。
|
||||
{{%/* /fixit-encryptor */%}}
|
||||
Or
|
||||
{{%/* fixit-encryptor password="1212" message="密码是 1212" */%}}
|
||||
`fixit-encryptor` shortcode 在版本 {{</* version 0.2.15 */>}} 得到支持。
|
||||
{{%/* /fixit-encryptor */%}}
|
||||
```
|
||||
|
||||
呈现的输出效果如下:
|
||||
|
||||
{{% fixit-encryptor "1212" "密码是 1212" %}}
|
||||
`fixit-encryptor` shortcode 在版本 {{< version 0.2.15 >}} 得到支持。
|
||||
{{% /fixit-encryptor %}}
|
||||
|
||||
## 结语
|
||||
|
||||
|
||||
Reference in New Issue
Block a user