feat: add aptonic Dropzone action (#2545)

* feat: add aptonic Dropzone action

* doc: aptonic Dropzone action
This commit is contained in:
Henry Wang
2019-07-04 09:21:29 +01:00
committed by DIYgod
parent 6be1fac0c3
commit f9f8406ba1
4 changed files with 49 additions and 0 deletions

View File

@@ -651,3 +651,9 @@ Supported sub-sites
#### Poems #### Poems
<RouteEn author="HenryQW" example="/allpoetry/newest" path="/allpoetry/:order?" :paramsDesc="['order by type, `best` or `newest`, default to `best`']"/> <RouteEn author="HenryQW" example="/allpoetry/newest" path="/allpoetry/:order?" :paramsDesc="['order by type, `best` or `newest`, default to `best`']"/>
## aptonic
### New Dropzone Actions
<RouteEn author="HenryQW" example="/aptonic/action" path="/aptonic/action"/>

View File

@@ -32,6 +32,12 @@ pageClass: routes
<Route author="HenryQW" example="/appstore/gofans" path="/appstore/gofans"/> <Route author="HenryQW" example="/appstore/gofans" path="/appstore/gofans"/>
## aptonic
### 新的 Dropzone 动作
<Route author="HenryQW" example="/aptonic/action" path="/aptonic/action"/>
## Bugly SDK ## Bugly SDK
### 更新日志 ### 更新日志

View File

@@ -1467,4 +1467,7 @@ router.get('/tprtc/news', require('./routes/tprtc/news'));
// ArchDaily // ArchDaily
router.get('/archdaily', require('./routes/archdaily/home')); router.get('/archdaily', require('./routes/archdaily/home'));
// aptonic Dropzone actions
router.get('/aptonic/action', require('./routes/aptonic/action'));
module.exports = router; module.exports = router;

View File

@@ -0,0 +1,34 @@
const got = require('@/utils/got');
const url = require('url');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const link = `https://aptonic.com/actions/`;
const res = await got.get(link);
const $ = cheerio.load(res.body);
ctx.state.data = {
title: 'Dropzone Actions',
link,
item: $('table.actions >> tr')
.get()
.map((item) => {
item = $(item);
return {
title: item.find('h2').text(),
description: `
<img referrerpolicy="no-referrer" src="${url.resolve(link, item.find('img').attr('src'))}"/>
<br/>
${$(item.find('td')[1])
.children()
.remove()
.end()
.text()}
`,
pubDate: new Date().toUTCString(),
link: url.resolve(link, item.find('td.icon a').attr('href')),
};
}),
};
};