From 7f1c43094e8a82e4d8f036ff7d42568fed00699d Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 25 Jan 2021 18:43:47 +0800 Subject: [PATCH] feat: remove some routes for security reasons, !!! no-eval no-new-func !!! --- .eslintrc | 3 +- docs/game.md | 16 -------- docs/live.md | 6 --- docs/new-media.md | 4 -- docs/program-update.md | 6 --- docs/programming.md | 5 --- lib/router.js | 14 ------- lib/routes/frontend/index.js | 27 -------------- lib/routes/gouhuo/cache.js | 44 ---------------------- lib/routes/gouhuo/index.js | 62 ------------------------------- lib/routes/gouhuo/strategy.js | 35 ----------------- lib/routes/heibaizhibo/room.js | 31 ---------------- lib/routes/huxiu/utils.js | 20 +++++----- lib/routes/netease/news/data.js | 39 ------------------- lib/routes/tencent/lemon/index.js | 29 --------------- 15 files changed, 12 insertions(+), 329 deletions(-) delete mode 100644 lib/routes/frontend/index.js delete mode 100644 lib/routes/gouhuo/cache.js delete mode 100644 lib/routes/gouhuo/index.js delete mode 100644 lib/routes/gouhuo/strategy.js delete mode 100644 lib/routes/heibaizhibo/room.js delete mode 100644 lib/routes/netease/news/data.js delete mode 100644 lib/routes/tencent/lemon/index.js diff --git a/.eslintrc b/.eslintrc index b1dac234df..3b874a7176 100644 --- a/.eslintrc +++ b/.eslintrc @@ -53,6 +53,7 @@ "prettier/prettier": 0, "no-await-in-loop": 2, "require-atomic-updates": 0, - "no-prototype-builtins": 0 + "no-prototype-builtins": 0, + "no-new-func": 2 } } diff --git a/docs/game.md b/docs/game.md index 001a2ea32e..d113ee6f4d 100644 --- a/docs/game.md +++ b/docs/game.md @@ -432,22 +432,6 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的 -## 篝火营地 - -### 游戏资讯 - - - -| 精选 | 海外 | 原创 | PS4 | Xboxone | PC | Switch | 掌机 | 手游 | 新闻 | 评测 | 文化 | 视频 | 音频 | 折扣 | -| ---------- | -------- | ------- | --- | ------- | -- | ------ | -------- | ---------- | ---- | ------ | ------- | ----- | ----- | -------- | -| choiceness | overseas | orignal | ps4 | xboxone | pc | switch | handheld | mobilegame | news | review | culture | video | audio | discount | - - - -### 游戏攻略 - - - ## 怪物猎人世界 ### 更新情报 diff --git a/docs/live.md b/docs/live.md index 84f153c57d..e92c8c05fb 100644 --- a/docs/live.md +++ b/docs/live.md @@ -38,12 +38,6 @@ pageClass: routes -## 黑白直播 - -### 直播间开播 - - - ## 虎牙直播 ### 直播间开播 diff --git a/docs/new-media.md b/docs/new-media.md index 23d50eb13c..708e7f6569 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -1936,10 +1936,6 @@ column 为 third 时可选的 category: -### 数读 - - - ## 维基百科 ### 中国大陆新闻动态 diff --git a/docs/program-update.md b/docs/program-update.md index 649ab76f1c..37eb486334 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -418,12 +418,6 @@ pageClass: routes -## 腾讯柠檬 Lab - -### 柠檬精选 Mac Apps - - - ## 腾讯云移动直播 SDK ### 更新日志 diff --git a/docs/programming.md b/docs/programming.md index 855b992574..493aa2bfb8 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -678,11 +678,6 @@ GitHub 官方也提供了一些 RSS: -## 前端技术文章 - - - - ## 前端艺术家 && 飞冰早报 ### 列表 diff --git a/lib/router.js b/lib/router.js index 41506a7ccf..d9ee291821 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2072,10 +2072,6 @@ router.get('/pingwest/user/:uid/:type?', require('./routes/pingwest/user')); // Hanime router.get('/hanime/video', require('./routes/hanime/video')); -// 篝火营地 -router.get('/gouhuo/news/:category', require('./routes/gouhuo')); -router.get('/gouhuo/strategy', require('./routes/gouhuo/strategy')); - // Soul router.get('/soul/:id', require('./routes/soul')); router.get('/soul/posts/hot', require('./routes/soul/hot')); @@ -2141,9 +2137,6 @@ router.get('/szse/rule', require('./routes/szse/rule')); // 前端艺术家每日整理&&飞冰早报 router.get('/jskou/:type?', require('./routes/jskou/index')); -// 前端 -router.get('/front-end-rss', require('./routes/frontend/index')); - // 国家应急广播 router.get('/cneb/yjxx', require('./routes/cneb/yjxx')); router.get('/cneb/guoneinews', require('./routes/cneb/guoneinews')); @@ -2178,9 +2171,6 @@ router.get('/sohu/mp/:id', require('./routes/sohu/mp')); // 腾讯企鹅号 router.get('/tencent/news/author/:mid', require('./routes/tencent/news/author')); -// 腾讯柠檬精选 -router.get('/tencent/lemon', require('./routes/tencent/lemon/index')); - // 奈菲影视 router.get('/nfmovies/:id?', require('./routes/nfmovies/index')); @@ -3056,7 +3046,6 @@ router.get('/jike/user/:id', require('./routes/jike/user')); // 网易新闻 router.get('/netease/news/rank/:category?/:type?/:time?', require('./routes/netease/news/rank')); router.get('/netease/news/special/:type?', require('./routes/netease/news/special')); -router.get('/netease/news/data', require('./routes/netease/news/data')); // 网易 - 网易号 router.get('/netease/dy/:id', require('./routes/netease/dy')); @@ -3169,9 +3158,6 @@ router.get('/touhougarakuta/:language/:type', require('./routes/touhougarakuta') // 猎趣TV router.get('/liequtv/room/:id', require('./routes/liequtv/room')); -// 黑白直播 -router.get('/heibaizhibo/room/:id', require('./routes/heibaizhibo/room')); - // Behance router.get('/behance/:user/:type?', require('./routes/behance/index')); diff --git a/lib/routes/frontend/index.js b/lib/routes/frontend/index.js deleted file mode 100644 index 02e1dac2d9..0000000000 --- a/lib/routes/frontend/index.js +++ /dev/null @@ -1,27 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); - -module.exports = async (ctx) => { - const response = await got.get(`https://front-end-rss.now.sh/`); - const $ = cheerio.load(response.data); - const fn = Function($($('script')[1]).html() + 'return Array.isArray(LINKS_DATA) ? LINKS_DATA : []'); - const items = fn().reduce( - (acc, category) => [ - ...acc, - ...category.items.map((item) => ({ - link: item.link, - pubDate: item.date, - title: item.title, - author: category.title, - description: category.title, - })), - ], - [] - ); - - ctx.state.data = { - title: '前端技术文章', - link: 'https://front-end-rss.now.sh/', - item: items, - }; -}; diff --git a/lib/routes/gouhuo/cache.js b/lib/routes/gouhuo/cache.js deleted file mode 100644 index 7f765aa408..0000000000 --- a/lib/routes/gouhuo/cache.js +++ /dev/null @@ -1,44 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); - -const self = { - _getProfile: async (ctx) => { - const key = 'gouhuo-profile'; - let profile = await ctx.cache.get(key); - if (!profile) { - const response = await got({ - method: 'get', - url: `https://gouhuo.qq.com/`, - headers: { - Referer: `https://gouhuo.qq.com/`, - }, - }); - const body = response.data; - const $ = cheerio.load(body); - - // eslint-disable-next-line no-eval - const obj = eval(body.match(/(?<=