Skip to content

Commit

Permalink
docs: 完成部分文档
Browse files Browse the repository at this point in the history
  • Loading branch information
likun7981 committed May 24, 2022
1 parent ddda51a commit 543c961
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ destDir*
sourceDir1

/docs/.vitepress/dist
.DS_Store
10 changes: 5 additions & 5 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export default defineConfig({
text: '安装',
children: [
{
text: '所需环境',
link: '/install/env'
text: 'nodejs',
link: '/install/nodejs'
},
{
text: '安装hlink',
text: 'hlink',
link: '/install/hlink'
}
]
Expand All @@ -56,11 +56,11 @@ export default defineConfig({
text: '使用介绍',
children: [
{
text: 'hlink',
text: '主命令',
link: '/command/'
},
{
text: 'hlink prune',
text: 'prune命令',
link: '/command/prune'
}
]
Expand Down
5 changes: 1 addition & 4 deletions docs/command/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
title: 主命令
---

# hlink

待补充

20 changes: 20 additions & 0 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 快速开始

## 介绍

hlink 是一个批量快速硬链工具,全称为`hard link`,能够帮你快速的建立你的硬链接,在保种的同时,能够刮削电影相关的资料等

## 如何使用

首先你需要安装`nodejs`,目前最新版本的`hlink`需要`12.20`以上或者`14.14`以上的`nodejs`版本[如何安装nodejs](../install/nodejs.md)
安装nodejs完成后,使用以下命令
```bash
$ npm i -g hlink
```
完成hlink的安装,最简单的使用

```bash
$ hlink /path/to/download /path/to/movie
```

更多使用技巧见 [hlink使用介绍](../command/index.md)
26 changes: 26 additions & 0 deletions docs/guide/why.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# 为什么是hlink

## 什么是硬链接

直接翻看百度百科 [什么是硬链接?](https://baike.baidu.com/item/%E7%A1%AC%E9%93%BE%E6%8E%A5/2088758)

## 系统命令`cp -lr`的缺陷

大家都知道系统自带的命令`cp -lr`可以快速批量建立硬链接,但是它有以下几个问题

- 硬链建立后,如果硬链接改名,则又会被重复硬链
- 没有黑名单、白名单、缓存机制,只能一把梭
- 建立后,很难维护源文件和硬链接的关系,比如源文件删除后,很难找到硬链接的位置

## hlink的优势

- **重复检测**`hlink` 重复检测是通过文件的`inode`号来进行检测,大家可以通过 `ls -i` 查看文件的`inode`。只要文件内容没有改变,则`inode`不会改变,刚好对应各种电影、动漫、电视剧视频文件的内容肯定是不会变更的,所以硬链接后则内容不会改变,那么`inode`不会改变,便可用于重复检测

![inode](/inode.png)

- **黑白名单机制**:如何过滤非视频文件,则可用黑白名单来进行管控需要硬链的文件,这样保证`PT种子`内部的文本文件不会被硬链过去,持续保种
- **缓存机制**:部分视频文件观看后,需要删除。但是不希望下次继续硬链过来,则可以打开缓存,再下次硬链时自动排除这些缓存的文件
- **更友好的提示**:硬链过程中,会有`进度提示`,失败后会有`错误提示`

![prompt](/prompt.png)

- **同步机制**:硬链创建后,可以通过`hlink prune`来同步源文件和硬链文件,更简单的管理它们,更详细的使用见[hlink prune介绍](../command/prune.md)
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ home: true
actionText: 快速开始
actionLink: /guide/

altActionText: 为什么不是cp -lr?
altActionText: 为什么是hlink?
altActionLink: /guide/why

features:
Expand Down
3 changes: 0 additions & 3 deletions docs/install/env.md

This file was deleted.

18 changes: 18 additions & 0 deletions docs/install/hlink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 如何安装hlink
> 安装完nodejs后
## 首次安装
执行以下命令即可完成安装

```bash
$ npm i -g hlink
```


## 更新

`[email protected]`以后,只要有版本更新则会有更新提示

![image](/updateNotify.png)

更新命令同 安装命令 一样
13 changes: 13 additions & 0 deletions docs/install/nodejs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 如何安装nodejs

## 威联通
待补充

## 群晖
待补充

## unraid
待补充

## Windows
待补充
36 changes: 14 additions & 22 deletions docs/other/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,69 +7,61 @@

## 1. fork官方仓库

![image](https://user-images.githubusercontent.com/13427467/169976969-ee19ba29-77ab-4872-b8f5-4ae94a4ec854.png)
![image](/fork.png)

如图点击右上角的fork按钮,进行fork仓库到你自己账号下面,选择归属的组织或者可以直接归属到你个人名下

![image](https://user-images.githubusercontent.com/13427467/169977425-e456fa93-70b0-4f5a-855a-35f084803b31.png)


## 2. 添加文件

打开你fork的仓库地址,找到`docs/other`目录,点击 `addFile` > `add new file`

![image](https://user-images.githubusercontent.com/13427467/170038192-17b9827b-0941-489a-9575-71a4ffa98738.png)
![image](/createNewFile.png)

给教程文档取个`英文`名称必须以`.md` 为后缀

![image](https://user-images.githubusercontent.com/13427467/170038302-89ff3889-eb64-4acb-ad5d-5538b0e03e43.png)
![image](/fileName.png)

`docs/other/index.ts`里面加上文件名称和标题

![image](https://user-images.githubusercontent.com/13427467/170037963-39c21667-5823-49de-8ab8-2adf38fc6ace.png)
![image](/setSideBar.png)


## 3. 开始编辑你的文档

接下来你就可以编写教程文档了,具体 markdown的语法可以见 [github markdown语法文档](https://docs.github.com/cn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)
编辑过程中你可以使用`Preview`进行预览
![image](https://user-images.githubusercontent.com/13427467/170038496-73741589-6c74-4866-b295-5d29ee478039.png)
![image](/previewMd.png)


## 4. 编辑完成提交

在下面可以提交你编辑你编辑的文档标题和描述。点击`Commit new file`
![image](https://user-images.githubusercontent.com/13427467/169979131-0ade3414-b4dd-49b3-802d-cf0376bc994e.png)
![image](/commit.png)

## 5. 提交pr到官方仓库

你提交完成后,到下面的界面,点击`open pull request`
![image](https://user-images.githubusercontent.com/13427467/169980843-edba3830-e29d-429c-9ccf-94c4d88cd44d.png)
![image](/openPullRequest.png)

然后你会看到pull request的界面,点击`create pull request`
![image](https://user-images.githubusercontent.com/13427467/169981178-82027db6-7d06-40d6-af1e-8b4e4b9de79d.png)
![image](/createPullRequest.png)

来到pr的创建界面,输入标题和描述,就可以提交了
![image](https://user-images.githubusercontent.com/13427467/169982051-7d9dff05-a3a1-457f-b63b-960331e98f14.png)

## 6. 等待审核

提交完成后,就等待作者审核就可以了,到此结束!~
![image](/submitPullRequest.png)

![image](https://user-images.githubusercontent.com/13427467/169982738-5c351347-6e1e-42b3-abaa-f497ecc6cdd7.png)
## 6. 等待审核及合并

## 7. 合并
看到一下merged说明你的文档就合并完成了
![image](https://user-images.githubusercontent.com/13427467/169983037-853989e7-e958-4750-8bc8-b0571ed97e6f.png)
提交完成后,就等待作者审核就可以了,到此结束!看到一下merged说明你的文档就合并完成了

等待部署完成,部署完成后,你就可以通过下面的按钮访问,能找到你的文档
![image](https://user-images.githubusercontent.com/13427467/170038926-ce0f7e61-870d-4659-99ab-05cefc7d7f86.png)
![image](/complete.png)



## 8. 更新自己的仓库
## 7. 更新自己的仓库

![image](https://user-images.githubusercontent.com/13427467/169983610-babb8406-2950-4527-b0de-6120a249d6d3.png)
![image](/update.png)

如果你前面已经提交过一个了,后面希望再提交,你只需要到你的仓库,点击更新拉取hlink主仓库的最新代码,然后从`第2步`开始执行即可

Expand Down
12 changes: 6 additions & 6 deletions docs/other/qnap.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
# 威联通自动关联环境变量
> 由于威联通重启后会重置部分配置,而且威联通安装node后默认没有设置环境变量,所以需要配置开机启动脚本来进行自动配置 hlink 到环境变量中,不然很麻烦
1. ssh 登录你的威联通机器
## 1. `ssh`登录你的威联通机器
执行以下命令

```bash
$ mount $(/sbin/hal_app --get_boot_pd port_id=0)6 /tmp/config
```

2. 编辑autorun.sh脚本
## 2. 编辑`autorun.sh`脚本

```bash
$ vim /tmp/config/autorun.sh
```

添加以下脚本到autorun.sh
添加以下脚本到`autorun.sh`
```
ln -s /share/CACHEDEV1_DATA/.qpkg/NodeJS/bin/hlink /usr/local/bin/hlink
```


其中`/share/CACHEDEV1_DATA/.qpkg/NodeJS/bin/hlink` 为你npm安装后的hlink 路径,根据各自的路径进行更换

3. 给autorun.sh添加执行权限
## 3. `autorun.sh`添加执行权限
```
$ chmod +x /tmp/config/autorun.sh
```

4. 开启用户自定义脚本
## 4. 开启用户自定义脚本

`控制台` > `硬盘` > `启动时运行用户定义的进程` 打上勾,最后别忘记点击`应用`

![删除文件](/autorun.png)

1. 卸载`/tmp/config`
## 5. 卸载`/tmp/config`

```bash
$ umount /tmp/config
Expand Down
3 changes: 3 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
Binary file added docs/public/commit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/complete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/createNewFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/createPullRequest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/fileName.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/fork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/inode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/openPullRequest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/previewMd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/prompt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/setSideBar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/submitPullRequest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/update.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/updateNotify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"bin": {
"hlink": "./lib/cli.js"
},
"type": "module",
"engines": {
"node": ">=12"
},
Expand Down

0 comments on commit 543c961

Please sign in to comment.