forked from ganlvtech/down_52pojie_cn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
php full refactor. php add description feature.
- Loading branch information
Showing
25 changed files
with
961 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/usr/bin/env bash | ||
export BUILD_GITHUB_PAGES=true | ||
|
||
php php/github_pages_crawl.php | ||
|
||
npm install | ||
npm run build | ||
|
||
sed -i "s/new Down52PojieCn({/& jsonUrl: '\/down_52pojie_cn\/list.json' /g" dist/index.html | ||
|
||
php php/github_pages_crawl.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
config/config.php | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# php 文件扫描程序 | ||
|
||
## 目录结构 | ||
|
||
```plain | ||
* config/ 配置文件目录(需要自行修改) | ||
* config.php 扫描本地文件使用的设置 | ||
* data/ 数据文件目录(程序会储存一些数据,有些需要手动修改) | ||
* description.yml 文件夹/文件的描述信息,会混合到生成的 list.json 中 | ||
* src/ 主要代码目录(4 种获取文件列表的扫描器、3 输出格式的编解码器) | ||
* vendor/ | ||
* .gitignore | ||
* composer.json | ||
* composer.lock | ||
* github_pages_crawl.php 用于构建 GitHub Pages | ||
* README.md | ||
* scan.php 用于扫描本地文件 | ||
``` | ||
|
||
## 使用方法 | ||
|
||
首先,复制一份配置文件 | ||
|
||
```bash | ||
cp config/config.php.example config/config.php | ||
``` | ||
|
||
然后,修改 `config/config.php` 中的配置参数 | ||
|
||
最后,执行扫描指令 | ||
|
||
```bash | ||
php scan.php | ||
``` | ||
|
||
如果 `data/description.yml` 不存在的话,首次执行 `php scan.php` 会自动生成一个 `data/description.yml` 的模板,这里面没有 `description` 字段,如果想给文件添加备注的话,需要手动在对应文件的文件名下添加一个 `description` 字段,并填写备注信息。 | ||
|
||
然后,再次执行 `php scan.php` 则会将描述信息合并到 `list.json` 中。 | ||
|
||
## 备注文件格式 | ||
|
||
`php scan.php` 自动生成的格式如下。 | ||
|
||
```yaml | ||
name: / | ||
children: | ||
- | ||
name: Challenge | ||
children: | ||
- | ||
name: 2012CM | ||
- | ||
name: 2016_Security_Challenge | ||
``` | ||
你需要手动添加几个 `description` 字段,然后填入相关描述。 | ||
|
||
```yaml | ||
name: / | ||
children: | ||
- | ||
name: Challenge | ||
description: 收录论坛往年比赛题目 | ||
children: | ||
- | ||
name: 2012CM | ||
description: 2012 年论坛举行 CrackMe 大赛的作品和对应的分析文章,难度有易、中、难,大家任选学习 | ||
- | ||
name: 2016_Security_Challenge | ||
description: 2016 年论坛举行安全挑战赛,容纳了更多与实际应用息息相关的 Windows、移动安全相关考题,欢迎大家学习 | ||
``` | ||
|
||
## 配置文件内容 | ||
|
||
```php | ||
<?php | ||
return [ | ||
// 扫描的根目录(绝对路径) | ||
'BASE_PATH' => '/home/ganlv/Downloads', | ||
// 排除的文件(相对于 BASE_PATH) | ||
'EXCLUDE_FILES' => [ | ||
'/list.json', | ||
'/list.js', | ||
], | ||
// 描述文件(绝对路径) | ||
'DESCRIPTION_FILE' => dirname(__DIR__) . '/data/description.yml', | ||
// 输出的文件类型(json 或者 jsonp) | ||
'OUTPUT_TYPE' => 'jsonp', | ||
// 输出的文件路径(绝对路径) | ||
'OUTPUT_FILE' => '/home/ganlv/Downloads/public/.list.js', | ||
// jsonp 回调函数名(需要与 index.html 中的设置相同) | ||
'JSONP_CALLBACK' => '__jsonpCallbackDown52PojieCn', | ||
]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "ganlv/down_52pojie_cn", | ||
"description": "down.52pojie.cn file scan script", | ||
"type": "project", | ||
"require": { | ||
"php": ">=7.0", | ||
"ext-json": "*", | ||
"ext-curl": "*", | ||
"symfony/yaml": "^4.1" | ||
}, | ||
"license": "MIT", | ||
"autoload": { | ||
"psr-4": { | ||
"Ganlv\\Down52PojieCn\\": "src" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Ganlv", | ||
"email": "[email protected]" | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
return [ | ||
// 扫描的根目录(绝对路径) | ||
'BASE_PATH' => "C:\Users\Ganlv\Downloads", | ||
// 'BASE_PATH' => '/home/ganlv/Downloads', | ||
// 排除的文件(相对于 BASE_PATH) | ||
'EXCLUDE_FILES' => [ | ||
'/list.json', | ||
'/list.js', | ||
], | ||
// 描述文件(绝对路径) | ||
'DESCRIPTION_FILE' => dirname(__DIR__) . '/data/description.yml', | ||
// 输出的文件类型(json 或者 jsonp) | ||
// 'OUTPUT_TYPE' => 'jsonp', | ||
'OUTPUT_TYPE' => 'json', | ||
// 输出的文件路径(绝对路径) | ||
'OUTPUT_FILE' => 'D:\www\PhpstormProjects\down_52pojie_cn\dist\list.json', | ||
// 'OUTPUT_FILE' => 'C:\Users\Ganlv\Downloads\.list.js', | ||
// jsonp 回调函数名(需要与 index.html 中的设置相同) | ||
'JSONP_CALLBACK' => '__jsonpCallbackDown52PojieCn', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
return [ | ||
// 扫描的根目录(绝对路径) | ||
'BASE_PATH' => '/home/ganlv/Downloads', | ||
// 排除的文件(相对于 BASE_PATH) | ||
'EXCLUDE_FILES' => [ | ||
'/list.json', | ||
'/list.js', | ||
], | ||
// 描述文件(绝对路径) | ||
'DESCRIPTION_FILE' => dirname(__DIR__) . '/data/description.yml', | ||
// 输出的文件类型(json 或者 jsonp) | ||
'OUTPUT_TYPE' => 'jsonp', | ||
// 输出的文件路径(绝对路径) | ||
'OUTPUT_FILE' => '/home/ganlv/Downloads/public/.list.js', | ||
// jsonp 回调函数名(需要与 index.html 中的设置相同) | ||
'JSONP_CALLBACK' => '__jsonpCallbackDown52PojieCn', | ||
]; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.