Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: 配置方式修改 #3

Closed
ieayoio opened this issue Sep 29, 2016 · 2 comments
Closed

chore: 配置方式修改 #3

ieayoio opened this issue Sep 29, 2016 · 2 comments
Labels

Comments

@ieayoio
Copy link

@ieayoio ieayoio commented Sep 29, 2016

如果用户可以有自己的关于加密配置的文件模板,最好是一个独立的文件,里面甚至有多个模板,甚至模板里包含密码,在写文章时,如果其他加密字段不设置,只需要设置一个“encrypt_template”的字段(“encrypt_template”的值最好可以选择Hexo-Blog-Encrypt默认的模板,或者让用户手动把默认的模板写入自己的配置文件),这样加密就变的十分快速简单,而且可以统一修改不同模板的密码

@MikeCoder

This comment has been minimized.

Copy link
Owner

@MikeCoder MikeCoder commented Sep 29, 2016

现在已经提供了自定义模板功能,不过有点复杂。而且需要遵循一定的命名规则。可以看这

现在是:

---
title: hello world
date: 2016-03-30 21:18:02
tags:
    - fdsfadsfa
    - fdsafsdaf
password: Mike
abstract: Welcome to my blog, enter password to read.
message: Welcome to my blog, enter password to read.
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">
            <h4>密码是 "mikemessi"</h4>
            <div>
                <div class="input-group">
                    <input type="text" class="form-control" aria-label="enter the password" 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>
---

不过,需要遵循:

  • 最后的 content 显示 div 的 id 必须 是 'encrypt-blog',同时为了好看,也希望进行隐藏。
  • 同时,必须要有一个 input 输入框,id 必须是"pass",用来供用户输入密码。
  • 输入密码之后,务必要有一个触发器,用来调用 'decryptAES' 函数。样例中以 button 来触发。
@ieayoio

This comment has been minimized.

Copy link
Author

@ieayoio ieayoio commented Sep 29, 2016

现有的template是样式模板,是定义样式的,我说的模板是包含password,abstract,message,和现有的template,主要解决如下问题:

  • 现有的template无论放到_config.yml还是文章里都显得累赘(因为样式的代码量可能会比较多)
  • 可能很多情况下每一篇文章的password,abstract,message都一样没必要为每篇文章总是复制粘贴。
  • 每篇文章都设置不同的密码,可能原文作者都会不记得密码(当然应该保留他这样做的能力)
  • 批量修改密码十分麻烦,当越来余越多的加密文章,修改密码需要修改每篇文章的password的值
@MikeCoder MikeCoder added the wontfix label Oct 8, 2016
@xiazeyu xiazeyu changed the title 如果将来的版本可以考虑加入,那样就更完美了 chore: 配置方式修改 Feb 22, 2018
@MikeCoder MikeCoder closed this Jan 15, 2019
@MikeCoder MikeCoder removed this from the v3.0 milestone Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.