~/.m2/settings.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8"?>
<settings
xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<mirrors>
<mirror>
<id>aliyun</id>
<mirrorOf>*</mirrorOf>
<name>aliyun</name>
<url>https://maven.aliyun.com/repository/public/</url>
</mirror>
</mirrors>
</settings>

~/.gradle/init.gradle

1
2
3
4
5
6
7
8
9
10
11
12
13
allprojects {
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
mavenLocal()
}
}
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/spring/' }
mavenLocal()
}
}

build.gradle

1
2
3
4
5
6
7
8
9
10
11
12
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
mavenLocal()
}
}

repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/spring' }
mavenLocal()
}

在根目录创建文件夹 scripts,在文件夹中创建文件 gitalk-init.js,内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const axios = require("axios")
const md5 = require("md5")

const options = {
owner: "starudream",
repo: "blog-page",
accessToken: "<<placeholder>>",
labels: "Gitalk,",
}

const axiosGithub = axios.create({
baseURL: "https://api.github.com",
headers: {
"Accept": "application/json",
},
})

const getIssueByLabels = (id) => {
return axiosGithub.get(`/repos/${options.owner}/${options.repo}/issues`, {
headers: {
Authorization: `token ${options.accessToken}`,
},
params: {
labels: options.labels.concat(id),
t: Date.now(),
},
}).then(res => {
if (res && res.data && res.data.length) {
return res.data[0]
}
return null
})
}

const createIssue = (title, body, id) => {
return axiosGithub.post(`/repos/${options.owner}/${options.repo}/issues`, {
title,
labels: options.labels.concat(id).split(","),
body: body,
}, {
headers: {
Authorization: `token ${options.accessToken}`,
},
}).then(res => {
return res.data
})
}

hexo.extend.generator.register("gitalk-init", locals => {
locals.posts.each(post => {
if (post.layout !== "post" || !post.published || !post.comments) return
const title = post.title + " | " + hexo.config.title
const path = "/" + post.path
const hash = md5(path)
getIssueByLabels(hash).then(res => {
if (res) {
console.log(`【${title}】has existed`)
return
}
createIssue(title, post.permalink, hash).then(res => {
console.log(`【${title}】has created`)
})
})
})
})

然后运行 hexo generate --force 即会自动执行 scripts 内脚本文件。

  • 使用旧版
1
reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
  • 恢复新版
1
reg delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f

首先 Win+R 打开 运行

然后 regedit 打开注册表,按 计算机\HKEY_CLASSES_ROOT\CLSID\{52205fd8-5dfb-447d-801a-d0b52f2e83e1}\shell\OpenNewWindow\command 目录找到 command

右击依次选择 权限 -> 高级 -> 更改所有者 -> 授予权限

预览

然后删除 command 目录下的 DelegateExecute

(默认) 设置为 explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

之后重启电脑即可,Win+E 也能使用了。