feat: add miui global update (#1303)

This commit is contained in:
Richard Yu
2018-12-20 11:42:03 +08:00
committed by DIYgod
parent 963420504f
commit 61e2aa59f2
3 changed files with 15 additions and 8 deletions
+10 -4
View File
@@ -1106,11 +1106,17 @@ GitHub 官方也提供了一些 RSS:
### MIUI
<route name="MIUI 新版本发布" author="Indexyz" example="/miui/aries" path="/miui/:device/:type?" :paramsDesc="['设备的 `codename` 例如 小米 2s 为 `aries`', '类型, 可选参数']">
<route name="MIUI 新版本发布" author="Indexyz" example="/miui/aries" path="/miui/:device/:type?/:region?" :paramsDesc="['设备的 `codename` 例如 小米 2s 为 `aries`. 国际版的 `codename` 一般以 `_global` 结尾. 可查阅 MIUI 线刷包下载页面', '类型, 可选参数', '地区, 默认为 `cn`']">
| 稳定版 | 开发版 |
| ------- | ------ |
| release | dev |
| 类型 | type |
| ------ | ------- |
| 稳定版 | release |
| 开发版 | dev |
| 地区 | region |
| ------ | ------ |
| 国内版 | cn |
| 国际版 | global |
</route>
+1 -1
View File
@@ -360,7 +360,7 @@ router.get('/tingshuitz/guangzhou', require('./routes/tingshuitz/guangzhou'));
router.get('/tingshuitz/dongguan', require('./routes/tingshuitz/dongguan'));
// MIUI 更新
router.get('/miui/:device/:type?', require('./routes/miui/index'));
router.get('/miui/:device/:type?/:region?', require('./routes/miui/index'));
// 米哈游
router.get('/mihoyo/bh3/:type', require('./routes/mihoyo/bh3'));
+4 -3
View File
@@ -4,10 +4,11 @@ const cacheLength = 5;
const cacheDays = 30;
module.exports = async (ctx) => {
const { type = 'release', device } = ctx.params;
const { type = 'release', device, region = 'cn' } = ctx.params;
const releaseType = type === 'release' ? 'F' : 'X';
const localeTypeName = type === 'release' ? '稳定版' : '开发版';
const cacheName = `RSSHubMIUIUpdate|${device}|${releaseType}`;
const regionName = region === 'global' ? 'global' : 'cn';
const cacheName = `RSSHubMIUIUpdate|${device}|${releaseType}|${regionName}`;
const response = await axios({
method: 'get',
@@ -16,7 +17,7 @@ module.exports = async (ctx) => {
params: {
d: device,
b: releaseType,
r: 'cn',
r: regionName,
l: 'zh_CN',
n: '',
},