style: auto format

This commit is contained in:
GitHub Action
2021-01-11 00:24:08 +00:00
parent ed57536a96
commit 611c7fb1e8
5 changed files with 82 additions and 65 deletions

View File

@@ -2032,6 +2032,19 @@ column 为 third 时可选的 category:
<Route author="nczitzk" example="/interesting-sky/recent-interesting" path="/interesting-sky/recent-interesting"/> <Route author="nczitzk" example="/interesting-sky/recent-interesting" path="/interesting-sky/recent-interesting"/>
## 游戏葡萄
无文章正文,仅有目录索引。
### 全部文章
<Route author="KotoriK" example="/gamegrape" path="/gamegrape/index"/>
### 分类
例子对应[深度分类](http://youxiputao.com/article/index/id/13)
<Route author="KotoriK" example="/gamegrape/13" path="/gamegrape/:id?"/>
## 鱼塘热榜 ## 鱼塘热榜
<Route author="TheresaQWQ" example="/mofish/2" path="/mofish/:id" :paramsDesc="['分类id可以在 https://api.tophub.fun/GetAllType 获取']" /> <Route author="TheresaQWQ" example="/mofish/2" path="/mofish/:id" :paramsDesc="['分类id可以在 https://api.tophub.fun/GetAllType 获取']" />
@@ -2128,13 +2141,3 @@ QueryString:
### 全文 ### 全文
<Route author="HenryQW" example="/zzz" path="/zzz/index"/> <Route author="HenryQW" example="/zzz" path="/zzz/index"/>
## 游戏葡萄
无文章正文,仅有目录索引。
### 全部文章
<Route author="KotoriK" example="/gamegrape" path="/gamegrape/index"/>
### 分类
例子对应[深度分类](http://youxiputao.com/article/index/id/13)
<Route author="KotoriK" example="/gamegrape/13" path="/gamegrape/:id?"/>

View File

@@ -3835,5 +3835,4 @@ router.get('/rfa/:language?/:channel?/:subChannel?', require('./routes/rfa/index
// booth.pm // booth.pm
router.get('/booth.pm/shop/:subdomain', require('./routes/booth-pm/shop')); router.get('/booth.pm/shop/:subdomain', require('./routes/booth-pm/shop'));
module.exports = router; module.exports = router;

View File

@@ -29,18 +29,18 @@ module.exports = async (ctx) => {
const $ = cheerio.load(data); const $ = cheerio.load(data);
const feed_title = $('title').text(); const feed_title = $('title').text();
const list = $('.news-info-box') const list = $('.news-info-box')
.map((_, item) => { .map((_, item) => {
item = $(item); item = $(item);
const txt_author_pubDate = $(item.find('div > p > span')[1]).text(); const txt_author_pubDate = $(item.find('div > p > span')[1]).text();
return { return {
title: item.parent().find('h4').text(), title: item.parent().find('h4').text(),
link: BASE_URL + item.find('a.cover').attr('href'), link: BASE_URL + item.find('a.cover').attr('href'),
author: `${txt_author_pubDate}`.replace(/ · \S*$/, ''), author: `${txt_author_pubDate}`.replace(/ · \S*$/, ''),
description: $(item.find('div > p')[0]).text(), description: $(item.find('div > p')[0]).text(),
pubDate: Date.now() - resolveRelativeTime(txt_author_pubDate), pubDate: Date.now() - resolveRelativeTime(txt_author_pubDate),
}; };
}) })
.get(); .get();
ctx.state.data = { ctx.state.data = {
title: feed_title, title: feed_title,
link: feed_url, link: feed_url,

View File

@@ -1,34 +1,41 @@
const noFound = 'Auto: Route No Found'; const noFound = 'Auto: Route No Found';
module.exports = ({ github, context, core }, body, number) => {
module.exports = ({github, context, core}, body, number) => {
core.debug(`body: ${body}`); core.debug(`body: ${body}`);
const m = body.match(/```routes\r\n((.|\r\n)*)```/); const m = body.match(/```routes\r\n((.|\r\n)*)```/);
core.debug(`match: ${m}`); core.debug(`match: ${m}`);
let res = null; let res = null;
const removeLabel = () => { const removeLabel = () => {
github.issues.removeLabel({ github.issues
issue_number: number, .removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: noFound
}).catch((e) => { core.warning(e); });
};
if (m && m[1]) {
res = m[1].trim().split("\r\n");
core.info(`routes detected: ${res}`);
if (res.length > 0 && res[0] === "NOROUTE") {
core.info("PR stated no route, passing");
removeLabel();
github.issues.addLabels({
issue_number: number, issue_number: number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
labels: ['Auto: No Route Needed'] name: noFound,
}).catch((e) => { core.warning(e); }); })
.catch((e) => {
core.warning(e);
});
};
if (m && m[1]) {
res = m[1].trim().split('\r\n');
core.info(`routes detected: ${res}`);
if (res.length > 0 && res[0] === 'NOROUTE') {
core.info('PR stated no route, passing');
removeLabel();
github.issues
.addLabels({
issue_number: number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Auto: No Route Needed'],
})
.catch((e) => {
core.warning(e);
});
return; return;
} else if (res.length > 0) { } else if (res.length > 0) {
@@ -38,14 +45,14 @@ module.exports = ({github, context, core}, body, number) => {
} }
} }
core.info("seems no route found, failing"); core.info('seems no route found, failing');
github.issues.addLabels({ github.issues.addLabels({
issue_number: number, issue_number: number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
labels: [noFound] labels: [noFound],
}); });
throw "Please follow the PR rules: failed to detect route"; throw 'Please follow the PR rules: failed to detect route';
}; };

View File

@@ -1,6 +1,6 @@
/* eslint-disable */ /* eslint-disable */
module.exports = async ({github, context}, baseUrl, routes, number) => { module.exports = async ({ github, context }, baseUrl, routes, number) => {
if (routes[0] === 'NOROUTE') { if (routes[0] === 'NOROUTE') {
return; return;
} }
@@ -13,10 +13,10 @@ module.exports = async ({github, context}, baseUrl, routes, number) => {
let com = 'Successfully generated as following:\n\n'; let com = 'Successfully generated as following:\n\n';
for (const lks of links) { for (const lks of links) {
console.log("testing route: ", lks) console.log('testing route: ', lks);
// Intended, one at a time // Intended, one at a time
const res = await github.request(`GET ${lks}`).catch(err => { const res = await github.request(`GET ${lks}`).catch((err) => {
com+= ` com += `
<details> <details>
<summary><a href="${lks}">${lks}</a> - **Failed**</summary> <summary><a href="${lks}">${lks}</a> - **Failed**</summary>
@@ -35,23 +35,31 @@ module.exports = async ({github, context}, baseUrl, routes, number) => {
<summary><a href="${lks}">${lks}</a> - Success</summary> <summary><a href="${lks}">${lks}</a> - Success</summary>
\`\`\` \`\`\`
${data.split("\n").slice(0, 30).join("\n")} ${data.split('\n').slice(0, 30).join('\n')}
\`\`\` \`\`\`
</details> </details>
`; `;
} }
} }
github.issues.addLabels({ github.issues
issue_number: number, .addLabels({
owner: context.repo.owner, issue_number: number,
repo: context.repo.repo, owner: context.repo.owner,
labels: ['Auto: Route Test Complete'] repo: context.repo.repo,
}).catch((e) => { core.warning(e) }) labels: ['Auto: Route Test Complete'],
github.issues.createComment({ })
issue_number: number, .catch((e) => {
owner: context.repo.owner, core.warning(e);
repo: context.repo.repo, });
body: com github.issues
}).catch((e) => { core.warning(e) }) .createComment({
} issue_number: number,
owner: context.repo.owner,
repo: context.repo.repo,
body: com,
})
.catch((e) => {
core.warning(e);
});
};