hexo admin注意事项

这是一个坑

安装方式我就不说了,就是按照网上说的那样,我主要说一下Deploy中的脚本怎么配置,网上都是类似这种

./xxxx.sh

完了我也傻不拉几的按照这种方式写,后来发现这就是一个脚本,你不用deploy就用命令行运行也是一样的,
admin只是一个写markdown的工具,部署只是提供给你一个快捷键罢了,问题是我是Windows,居然也用.sh真是尴尬,改成.bat路径前面也不需要.这也是linux下的写法。deployCommand: ‘hexo-generate.bat’ 就行了。

tips

每次hexo deploy的时候是不是都要输入github用户名密码?
可以这样做

先配置一个环境变量

接着在你的用户目录(C:\Users\username)下新建一个叫 _netrc的文件(没有拓展名)
编辑这个文件

  • machine github.com
  • login username
  • password password

设置好这些后,当你再次部署时,就不用输入用户名和密码了。

tips2

hexo admin可以配置用户名和密码,密码需要用bcrypt加密,方法如下。

import org.mindrot.jbcrypt.BCrypt;

public class BCryptDemo {
    public static void main(String[] args) {
        // Hash a password for the first time
        String password = "123456";
        String hashed = BCrypt.hashpw(password, BCrypt.gensalt());
        System.out.println(hashed);
// gensalt's log_rounds parameter determines the complexity
// the work factor is 2**log_rounds, and the default is 10
        String hashed2 = BCrypt.hashpw(password, BCrypt.gensalt(12));

// Check that an unencrypted password matches one that has
// previously been hashed
        String candidate = "testpassword";
//String candidate = "wrongtestpassword";
        if (BCrypt.checkpw(candidate, hashed))
            System.out.println("It matches");
        else
            System.out.println("It does not match");
    }
}

 

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值