forked from DIYgod/RSSHub
-
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.
* feat(route): 华硕 固件 * fix(route): change radar url and modify the date format
- Loading branch information
Fatpandac
authored
Mar 28, 2022
1 parent
501dff5
commit 21dbeba
Showing
6 changed files
with
69 additions
and
0 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
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,38 @@ | ||
const got = require('@/utils/got'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
const { art } = require('@/utils/render'); | ||
const path = require('path'); | ||
|
||
const getProductID = async (model) => { | ||
const searchAPI = `https://odinapi.asus.com.cn/recent-data/apiv2/SearchSuggestion?SystemCode=asus&WebsiteCode=cn&SearchKey=${model}&SearchType=ProductsAll&RowLimit=4&sitelang=cn`; | ||
const response = await got(searchAPI); | ||
|
||
return { | ||
productID: response.data.Result[0].Content[0].DataId, | ||
url: response.data.Result[0].Content[0].Url, | ||
}; | ||
}; | ||
|
||
module.exports = async (ctx) => { | ||
const model = ctx.params.model; | ||
const { productID, url } = await getProductID(model); | ||
const biosAPI = `https://www.asus.com.cn/support/api/product.asmx/GetPDBIOS?website=cn&model=${model}&pdid=${productID}&sitelang=cn`; | ||
|
||
const response = await got(biosAPI); | ||
const biosList = response.data.Result.Obj[0].Files; | ||
|
||
const items = biosList.map((item) => ({ | ||
title: item.Title, | ||
description: art(path.join(__dirname, 'templates/bios.art'), { | ||
item, | ||
}), | ||
pubDate: parseDate(item.ReleaseDate, 'YYYY/MM/DD'), | ||
link: url, | ||
})); | ||
|
||
ctx.state.data = { | ||
title: `${model} BIOS`, | ||
link: url, | ||
item: items, | ||
}; | ||
}; |
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,3 @@ | ||
module.exports = { | ||
'/bios/:model': ['Fatpandac'], | ||
}; |
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,13 @@ | ||
module.exports = { | ||
'asus.com.cn': { | ||
_name: 'Asus 华硕', | ||
'.': [ | ||
{ | ||
title: '固件', | ||
docs: 'https://docs.rsshub.app/program-update.html#hua-shuo', | ||
source: ['/'], | ||
target: '/bios/:model', | ||
}, | ||
], | ||
}, | ||
}; |
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,3 @@ | ||
module.exports = function (router) { | ||
router.get('/bios/:model', require('./bios')); | ||
}; |
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,6 @@ | ||
<p>更新信息:</p> | ||
{{@ item.Description}} | ||
<p>版本: {{item.Version}}</p> | ||
<p>大小: {{item.FileSize}}</p> | ||
<p>更新日期: {{item.ReleaseDate}}</p> | ||
<p>下载链接: <a href="{{item.DownloadUrl.China}}">中国下载</a> | <a href="{{item.DownloadUrl.Global}}">全球下载</a></p> |