Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from Binaryify/master
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
nondanee authored Oct 19, 2018
2 parents 92ef2dd + e2f991f commit 54d8129
Show file tree
Hide file tree
Showing 109 changed files with 1,626 additions and 2,339 deletions.
54 changes: 54 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,58 @@
# 更新日志
### 3.0.0 | 2018.10.14

## 整体
- 完善文档,增加之前没写进文档的接口说明

- 重写 createRequest 返回 Promise 对象

- 模块化路由

- 模块化, 剥离res,req, 方便导出调用

- 增加 cookie-parser


### 参数修改
- `/song/detail` 增加多id支持

- `/toplist/detail` 移除参数

- `/resource/like` 增加参数 `type`

- `/top/playlist/highquality` 增加分页参数 `before`

### 统一参数
- `/artist/sub``artist/unsub` 合并, 用`query.t`

- `/follow``query.type` 换成 `query.t`

- `/comment``query.action` 换成 `query.t`

### URL重命名
- `/video` 改为 `video/url`

- `/mv` 改为 `mv/detail`

- `/music/url` 改为 `/song/url`

### 转发逻辑修改
- `/toplist/artist` 换成 weapi

- `/mv/url` 去除了 pipe

### BUG修复
- `/playlist/create`, `/playlist/update` 被判欺骗,增加 cookie

### 路由增删
- 删除 `/recommend/dislike`

- 增加 `/video/sub` (收藏视频), `/mv/sub` (收藏MV)

- 增加 `/video/detail` (视频详情)

- 增加 `/related/allvideo` (相关视频)

### 2.20.5 | 2018.09.29
修复非法参数403 #335, 修复代理错误 #334

Expand Down
15 changes: 1 addition & 14 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,6 @@ const UnusualRouteFileMap = {
'personal_fm.js': '/personal_fm'
}

// 简化 路由 导出方式, 由这里统一对 router 目录中导出的路由做包装, 路由实际对应的文件只专注做它该做的事情, 不用重复写样板代码
const { createWebAPIRequest, request } = require('./util/util')
const Wrap = fn => (req, res) => fn(req, res, createWebAPIRequest, request)

// 同步读取 router 目录中的js文件, 根据命名规则, 自动注册路由
fs.readdirSync(path.join(__dirname, 'router'))
.reverse()
.forEach(file => {
if (!/\.js$/i.test(file)) return
let route = (file in UnusualRouteFileMap) ? UnusualRouteFileMap[file] : '/' + file.replace(/\.js$/i, '').replace(/_/g, '/')
app.use(route, Wrap(require(path.join(__dirname, 'router', file))))
})


// 改写router为module
const requestMod = require('./util/request')
Expand All @@ -116,7 +103,7 @@ fs.readdirSync(path.join(__dirname, 'module'))
})
})
})
app.use('/dev', dev)
app.use('/', dev)

const port = process.env.PORT || 3000

Expand Down
Loading

0 comments on commit 54d8129

Please sign in to comment.