feat: feed the beast(ftb) modpack update

This commit is contained in:
gucheen
2021-01-11 11:03:49 +08:00
parent f265b74bc6
commit d236caf5b9
4 changed files with 50 additions and 0 deletions
+8
View File
@@ -104,6 +104,14 @@ Sorting types, default to `date`:
<RouteEn author="Indexyz" example="/curseforge/files/jei" path="/curseforge/files/:project" :paramsDesc="['Progect shortname or `Project ID`. The short name of the project can be found in the address bar, for exmaple `https://minecraft.curseforge.com/projects/non-update` to `non-update`. `Project ID` can be found in `About This Project` in `Overview`']"/>
### Feed The Beast Modpack Updates
<RouteEn author="gucheen" example="/feed-the-beast/modpack/ftb_presents_direwolf20_1_16" path="/feed-the-beast/modpack/:modpackEntry" :paramsDesc="['entry name of modpack.']">
| param | description |
| ------| ------------ |
| modpackEntry | The entry name of modpack, can be found in modpack\'s page link, for `https://www.feed-the-beast.com/modpack/ftb_presents_direwolf20_1_16`, use `ftb_presents_direwolf20_1_16`. |
</RouteEn>
## Nintendo
### eShop New Game Releases
+8
View File
@@ -211,6 +211,14 @@ pageClass: routes
<Route author="Indexyz" example="/curseforge/files/jei" path="/curseforge/files/:project" :paramsDesc="['项目的短名或者 `Project ID`. 项目的短名可以在地址栏获取到, 例如地址为 `https://minecraft.curseforge.com/projects/non-update`, 短名就为 `non-update`. `Project ID` 可在 `Overview` 中的 `About This Project` 中找到']"/>
### Feed The Beast (FTB) 模组包更新
<Route author="gucheen" example="/feed-the-beast/modpack/ftb_presents_direwolf20_1_16" path="/feed-the-beast/modpack/:modpackEntry" :paramsDesc="['模组包的短名.']">
| 参数 | 说明 |
| ------| ------------ |
| modpackEntry | 模组包的短名从模组包的页面链接中找到,例如 `https://www.feed-the-beast.com/modpack/ftb_presents_direwolf20_1_16`,短名就是 `ftb_presents_direwolf20_1_16`。 |
</Route>
## Nintendo
### eShop 新发售游戏
+3
View File
@@ -3855,4 +3855,7 @@ router.get('/rfa/:language?/:channel?/:subChannel?', require('./routes/rfa/index
// booth.pm
router.get('/booth.pm/shop/:subdomain', require('./routes/booth-pm/shop'));
// Minecraft feed the beast
router.get('/feed-the-beast/modpack/:modpackEntry', require('./routes/feed-the-beast/modpack'));
module.exports = router;
+31
View File
@@ -0,0 +1,31 @@
const got = require('got');
module.exports = async (ctx) => {
const modpackEntry = ctx.params.modpackEntry;
const ftbLink = `https://www.feed-the-beast.com/modpack/${modpackEntry}/`;
const { id } = await got({
url: `https://api.sunekaer.com/modpack/${modpackEntry}`,
headers: {
Referer: ftbLink,
},
}).json();
const data = await got({
url: `https://api.modpacks.ch/public/modpack/${id}`,
headers: {
Referer: ftbLink,
},
}).json();
ctx.state.data = {
title: `${data.name} 模组包更新`,
link: ftbLink,
description: data.description,
item: data.versions.map((item) => ({
title: item.name,
description: item.name,
pubDate: new Date(item.updated * 1000).toUTCString(),
link: ftbLink,
guid: `${id}-${item.id}`,
})),
};
};