feat: add openwrt releases
This commit is contained in:
parent
6a0d44348e
commit
303b91ffec
|
|
@ -289,6 +289,12 @@ Refer to [#minecraft](/en/game.html#minecraft)
|
|||
|
||||
<RouteEn author="nczitzk" example="/obsidian/announcements" path="/obsidian/announcements"/>
|
||||
|
||||
## OpenWrt
|
||||
|
||||
### Releases
|
||||
|
||||
<RouteEn author="DIYgod" example="/openwrt/releases/xiaomi/xiaomi_redmi_router_ac2100" path="/releases/:brand/:model" :paramsDesc="['Device Model, can be found in url of `Table of Hardware` -> `Device Page`', 'Same as above']"/>
|
||||
|
||||
## PlayStation
|
||||
|
||||
### PlayStation 4 System Update
|
||||
|
|
|
|||
|
|
@ -342,6 +342,12 @@ pageClass: routes
|
|||
|
||||
<Route author="nczitzk" example="/onenotegem/release" path="/onenotegem/release"/>
|
||||
|
||||
## OpenWrt
|
||||
|
||||
### Releases
|
||||
|
||||
<Route author="DIYgod" example="/openwrt/releases/xiaomi/xiaomi_redmi_router_ac2100" path="/releases/:brand/:model" :paramsDesc="['产品型号,可在 `Table of Hardware` -> `Device Page` 的 URL 中找到', '同上']"/>
|
||||
|
||||
## PlayStation
|
||||
|
||||
### PlayStation 4 系统更新纪录
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/releases/:model?': ['DIYgod'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'openwrt.org': {
|
||||
_name: 'Openwrt',
|
||||
'.': [
|
||||
{
|
||||
title: 'Model Releases',
|
||||
docs: 'https://docs.rsshub.app/program-update.html#openwrt',
|
||||
source: '/toh/:band/:model',
|
||||
target: '/openwrt/releases/:model',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const brand = ctx.params.brand;
|
||||
const model = ctx.params.model;
|
||||
const url = `https://openwrt.org/toh/${brand}/${model}`;
|
||||
const response = await got(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
const table = $('#installation').next();
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('h1').text() + ' - OpenWrt Releases',
|
||||
link: url,
|
||||
description: $('.dw-content div.level1').text(),
|
||||
language: 'en-US',
|
||||
item: [
|
||||
{
|
||||
title: table.find('.supported_current_rel').text(),
|
||||
link: url,
|
||||
description: `Firmware OpenWrt Install: ${table.find('.firmware_openwrt_install_url').html()}<br><br>Firmware OpenWrt Upgrade: ${$('.firmware_openwrt_upgrade_url').html()}'`,
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/releases/:brand/:model', require('./releases'));
|
||||
};
|
||||
Loading…
Reference in New Issue