From 8f4c50e22e4d9874795484f58fb7b95c72c69dd1 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 9 Mar 2024 20:30:59 +0800 Subject: [PATCH] chore: update outdated chore files --- .github/FUNDING.yml | 4 +- .github/PULL_REQUEST_TEMPLATE.md | 3 - .github/labeler.yml | 2 +- .github/workflows/build-assets.yml | 4 +- .github/workflows/docker-release.yml | 2 - .github/workflows/docker-test.yml | 2 - .github/workflows/npm-publish.yml | 2 - .github/workflows/test.yml | 2 - CONTRIBUTING.md | 2 - Procfile | 1 - SECURITY.md | 2 +- app.json | 2 +- assets/404.html | 4 - assets/CNAME | 1 - assets/index.html | 4 - assets/radar-rules.js | 387 --------- package.json | 3 +- scripts/workflow/radar-rules.js | 815 ------------------ website/docs/.format/file.mjs | 11 - website/docs/.format/format.mjs | 133 --- website/docs/.format/handle/heading.mjs | 81 -- website/docs/.format/removeHeadingId.mjs | 26 - website/docs/.format/routeFormat.mjs | 49 -- website/docs/.format/rsshub-heading-id.mjs | 83 -- website/docs/.format/rsshub-no-dupe-attrs.mjs | 22 - website/docs/.format/rsshub-route-level.mjs | 23 - website/docs/.format/slugId.mjs | 46 - website/docs/.format/sortByHeading.mjs | 56 -- website/docs/.format/tojson.js | 132 --- 29 files changed, 7 insertions(+), 1897 deletions(-) delete mode 100644 Procfile delete mode 100644 assets/404.html delete mode 100644 assets/CNAME delete mode 100644 assets/index.html delete mode 100644 assets/radar-rules.js delete mode 100644 scripts/workflow/radar-rules.js delete mode 100644 website/docs/.format/file.mjs delete mode 100644 website/docs/.format/format.mjs delete mode 100644 website/docs/.format/handle/heading.mjs delete mode 100644 website/docs/.format/removeHeadingId.mjs delete mode 100644 website/docs/.format/routeFormat.mjs delete mode 100644 website/docs/.format/rsshub-heading-id.mjs delete mode 100644 website/docs/.format/rsshub-no-dupe-attrs.mjs delete mode 100644 website/docs/.format/rsshub-route-level.mjs delete mode 100644 website/docs/.format/slugId.mjs delete mode 100644 website/docs/.format/sortByHeading.mjs delete mode 100644 website/docs/.format/tojson.js diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1642f7a25db3f7..3e06b6773a331b 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,5 +1,5 @@ # These are supported funding model platforms github: DIYgod -open_collective: RSSHub patreon: DIYgod -custom: ['https://afdian.net/@diygod', 'https://archive.diygod.me/images/zfb.jpg', 'https://archive.diygod.me/images/wx.jpg'] +open_collective: RSSHub +custom: ['https://afdian.net/a/diygod', 'https://docs.rsshub.app/support'] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ed2b0274696fdd..e6ae2dd496121c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -33,9 +33,6 @@ If your changes are not related to route, please fill in `routes` section with ` - [ ] New Route / 新的路由 - [ ] Follows [Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard) -- [ ] Documentation / 文档说明 -- [ ] Full text / 全文获取 - - [ ] Use cache / 使用缓存 - [ ] Anti-bot or rate limit / 反爬/频率限制 - [ ] If yes, do your code reflect this sign? / 如果有, 是否有对应的措施? - [ ] [Date and time](https://docs.rsshub.app/joinus/advanced/pub-date) / [日期和时间](https://docs.rsshub.app/zh/joinus/advanced/pub-date) diff --git a/.github/labeler.yml b/.github/labeler.yml index 5838333146c094..c12c71d072330d 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -10,7 +10,7 @@ core enhancement: - changed-files: - any-glob-to-any-file: ['lib/routes/index.ts'] - - all-globs-to-any-file: ['lib/**', '!lib/config.ts', '!lib/router.js', '!lib/routes/**', '!lib/routes-deprecated/**'] + - all-globs-to-any-file: ['lib/**', '!lib/config.ts', '!lib/routes/**', '!lib/routes-deprecated/**'] dependencies: - changed-files: diff --git a/.github/workflows/build-assets.yml b/.github/workflows/build-assets.yml index d99b311320f4c0..af1be600432dc3 100644 --- a/.github/workflows/build-assets.yml +++ b/.github/workflows/build-assets.yml @@ -5,9 +5,7 @@ on: branches: - master paths: - - 'assets/radar-rules.js' - - 'lib/**/maintainer.js' - - 'lib/**/radar.js' + - 'lib/**/*.ts' permissions: contents: read diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 88dedc026ce026..c22edaa347b7c0 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -7,8 +7,6 @@ on: paths: - '.github/workflows/docker-release.yml' - 'lib/**' - - '!**/maintainer.js' - - '!**/radar.js' - '!lib/**/*.test.ts' - 'Dockerfile' workflow_dispatch: {} diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 590333cc41ce7b..99ac4699266f45 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -7,8 +7,6 @@ on: paths: - '.github/workflows/docker-test.yml' - 'lib/**' - - '!**/maintainer.js' - - '!**/radar.js' - 'Dockerfile' - 'package.json' - 'pnpm-lock.yaml' diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 5bff70f58a72e6..d37f85eb592c72 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -7,8 +7,6 @@ on: paths: - '.github/workflows/npm-publish.yml' - 'lib/**' - - '!**/maintainer.js' - - '!**/radar.js' permissions: contents: read diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a970538417fc29..b24ace28f2ad6e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,8 +7,6 @@ on: paths: - 'test/**' - 'lib/**' - - '!**/maintainer.js' - - '!**/radar.js' - 'package.json' - 'pnpm-lock.yaml' - '.github/workflows/test.yml' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 963776c93615e5..12d5111208bd9d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1 @@ -## 请参见[参与我们](https://docs.rsshub.app/zh/joinus/quick-start) - ## Please refer to [Join Us](https://docs.rsshub.app/joinus/quick-start) diff --git a/Procfile b/Procfile deleted file mode 100644 index 50704083eaefb3..00000000000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: node lib/index.ts diff --git a/SECURITY.md b/SECURITY.md index d7e04b96a72eec..97af6228f31b85 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,4 +6,4 @@ Latest commits in master branch ## Reporting a Vulnerability -If you believe you have found a security vulnerability in RSSHub, please let us know right away, you can email us at [i@diygod.me](mailto:i@diygod.me). We will investigate all legitimate reports and do our best to quickly fix the problem. +If you believe you have found a security vulnerability in RSSHub, please let us know right away, you can [open a draft security advisory](https://github.com/DIYgod/RSSHub/security/advisories/new) or email us at [i@diygod.me](mailto:i@diygod.me). We will investigate all legitimate reports and do our best to quickly fix the problem. diff --git a/app.json b/app.json index 796f14bb931b84..e351d522029245 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,6 @@ { "name": "RSSHub", - "description": "万物皆可 RSS", + "description": "Everything is RSSible", "repository": "https://github.com/DIYgod/RSSHub", "website": "https://docs.rsshub.app/", "logo": "https://i.loli.net/2019/04/23/5cbeb7e41414c.png", diff --git a/assets/404.html b/assets/404.html deleted file mode 100644 index f8c64279428b4f..00000000000000 --- a/assets/404.html +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/assets/CNAME b/assets/CNAME deleted file mode 100644 index 5ab3a9991b7eef..00000000000000 --- a/assets/CNAME +++ /dev/null @@ -1 +0,0 @@ -rsshub.js.org \ No newline at end of file diff --git a/assets/index.html b/assets/index.html deleted file mode 100644 index f8c64279428b4f..00000000000000 --- a/assets/index.html +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/assets/radar-rules.js b/assets/radar-rules.js deleted file mode 100644 index 1b172452956688..00000000000000 --- a/assets/radar-rules.js +++ /dev/null @@ -1,387 +0,0 @@ -({ - 'aamacau.com': { _name: '論盡媒體 AllAboutMacau Media', '.': [{ title: '话题', docs: 'https://docs.rsshub.app/routes/new-media#lun-jin-mei-ti-allaboutmacau-media-hua-ti', source: ['/'], target: '/:category?/:id?' }] }, - 'eprice.com.tw': { _name: 'ePrice', '.': [{ title: 'ePrice 比價王', docs: 'https://docs.rsshub.app/routes/new-media#eprice', source: ['/'], target: '/:region?' }] }, - 'eprice.com.hk': { _name: 'ePrice', '.': [{ title: 'ePrice 香港', docs: 'https://docs.rsshub.app/routes/new-media#eprice', source: ['/'], target: '/:region?' }] }, - 'furstar.jp': { - _name: 'Furstar', - '.': [ - { title: '最新售卖角色列表', docs: 'https://docs.rsshub.app/routes/shopping#furstar-zui-xin-shou-mai-jiao-se-lie-biao', source: ['/:lang', '/'], target: '/furstar/characters/:lang' }, - { title: '已经出售的角色列表', docs: 'https://docs.rsshub.app/routes/shopping#furstar-yi-jing-chu-shou-de-jiao-se-lie-biao', source: ['/:lang/archive.php', '/archive.php'], target: '/furstar/archive/:lang' }, - { title: '画师列表', docs: 'https://docs.rsshub.app/routes/shopping#furstar-hua-shi-lie-biao', source: ['/'], target: '/furstar/artists' }, - ], - }, - 'trow.cc': { _name: 'The Ring of Wonder', '.': [{ title: '首页更新', docs: 'https://docs.rsshub.app/routes/bbs#the-ring-of-wonder', source: ['/'], target: '/portal' }] }, - 'github.com': { - _name: 'GitHub', - '.': [ - { title: '用户仓库', docs: 'https://docs.rsshub.app/routes/programming#github', source: '/:user', target: '/github/repos/:user' }, - { title: '用户 Followers', docs: 'https://docs.rsshub.app/routes/programming#github', source: '/:user', target: '/github/user/followers/:user' }, - { title: 'Trending', docs: 'https://docs.rsshub.app/routes/programming#github', source: '/trending', target: '/github/trending/:since' }, - { title: 'Trending', docs: 'https://docs.rsshub.app/routes/programming#github', source: '/topics', target: '/github/topics/:name/:qs?' }, - { title: '仓库 Issue', docs: 'https://docs.rsshub.app/routes/programming#github', source: ['/:user/:repo/issues', '/:user/:repo/issues/:id', '/:user/:repo'], target: '/github/issue/:user/:repo' }, - { title: '仓库 Pull Requests', docs: 'https://docs.rsshub.app/routes/programming#github', source: ['/:user/:repo/pulls', '/:user/:repo/pulls/:id', '/:user/:repo'], target: '/github/pull/:user/:repo' }, - { title: '仓库 Stars', docs: 'https://docs.rsshub.app/routes/programming#github', source: ['/:user/:repo/stargazers', '/:user/:repo'], target: '/github/stars/:user/:repo' }, - { title: '仓库 Branches', docs: 'https://docs.rsshub.app/routes/programming#github', source: ['/:user/:repo/branches', '/:user/:repo'], target: '/github/branches/:user/:repo' }, - { title: '文件 Commits', docs: 'https://docs.rsshub.app/routes/programming#github', source: '/:user/:repo/blob/:branch/*filepath', target: '/github/file/:user/:repo/:branch/:filepath' }, - { title: '用户 Starred Repositories', docs: 'https://docs.rsshub.app/routes/programming#github', source: '/:user', target: '/github/starred_repos/:user' }, - { title: '仓库 Contributors', docs: 'https://docs.rsshub.app/routes/programming#github', source: ['/:user/:repo/graphs/contributors', '/:user/:repo'], target: '/github/contributors/:user/:repo' }, - ], - }, - 'algocasts.io': { _name: 'AlgoCasts', '.': [{ title: '视频更新', docs: 'https://docs.rsshub.app/routes/programming#algocasts', source: '/episodes', target: '/algocasts' }] }, - 'soulapp.cn': { _name: 'Soul', '.': [{ title: '瞬间更新', docs: 'https://docs.rsshub.app/routes/social-media#soul' }] }, - 'anime1.me': { - _name: 'Anime1', - '.': [ - { title: '動畫', docs: 'https://docs.rsshub.app/routes/anime#anime1', source: '/category/:time/:name', target: '/anime1/anime/:time/:name' }, - { - title: '搜尋', - docs: 'https://docs.rsshub.app/routes/anime#anime1', - source: '/', - target: (params, url) => { - const keyword = new URL(url).searchParams.get('s'); - return keyword ? `/anime1/search/${keyword}` : ''; - }, - }, - ], - }, - 'swufe.edu.cn': { - _name: '西南财经大学', - it: [ - { title: '经济信息工程学院 - 通知公告', docs: 'https://docs.rsshub.app/routes/university#xi-nan-cai-jing-da-xue', source: '/index/tzgg.htm', target: '/swufe/seie/tzgg' }, - { title: '经济信息工程学院 - 学院新闻', docs: 'https://docs.rsshub.app/routes/university#xi-nan-cai-jing-da-xue', source: '/index/xyxw.htm', target: '/swufe/seie/xyxw' }, - ], - }, - 'www.chicagotribune.com': { _name: 'Chicago Tribune', www: [{ title: 'Chicago Tribune', docs: 'https://docs.rsshub.app/routes/traditional_media#chicago-tribune', source: '/' }] }, - 'monsterhunter.com': { - _name: '怪物猎人世界', - www: [ - { title: '更新情报', docs: 'https://docs.rsshub.app/routes/game#guai-wu-lie-ren-shi-jie', source: ['', '/*tpath'], target: '/mhw/update' }, - { title: '最新消息', docs: 'https://docs.rsshub.app/routes/game#guai-wu-lie-ren-shi-jie', source: ['', '/*tpath'], target: '/mhw/news' }, - ], - }, - 'bing.com': { _name: 'Bing', www: [{ title: '每日壁纸', docs: 'https://docs.rsshub.app/routes/picture#bing-bi-zhi', source: '', target: '/bing' }] }, - 'wegene.com': { - _name: 'WeGene', - www: [ - { title: '最近更新', docs: 'https://docs.rsshub.app/routes/other#wegene', source: '', target: '/wegene/newest' }, - { title: '栏目', docs: 'https://docs.rsshub.app/routes/other#wegene', source: '/crowdsourcing', target: '/wegene/column/all/all' }, - ], - }, - 'emi-nitta.net': { - _name: 'Emi Nitta', - '.': [ - { title: '最近更新', docs: 'https://docs.rsshub.app/routes/other#xin-tian-hui-hai-guan-fang-wang-zhan', source: '/updates', target: '/emi-nitta/updates' }, - { title: '新闻', docs: 'https://docs.rsshub.app/routes/other#xin-tian-hui-hai-guan-fang-wang-zhan', source: '/contents/news', target: '/emi-nitta/news' }, - ], - }, - 'yuancheng.work': { - _name: '远程.work', - '.': [ - { - title: '招聘信息', - docs: 'https://docs.rsshub.app/routes/other#yuan-cheng-work', - source: '/:caty', - target: (params, url) => { - if (!url) { - return '/remote-work'; - } - return '/remote-work/' + /\w+-(\w+)-\w+/.exec(url)[1]; - }, - }, - ], - }, - 'govopendata.com': { _name: '新闻联播文字版', cn: [{ title: '新闻联播文字版', docs: 'https://docs.rsshub.app/routes/traditional-media#xin-wen-lian-bo-wen-zi-ban', source: '/xinwenlianbo', target: '/xinwenlianbo/index' }] }, - 'steampowered.com': { _name: 'Steam', store: [{ title: 'search', docs: 'https://docs.rsshub.app/routes/game#steam', source: '/search/', target: (params, url) => `/steam/search/${new URL(url).searchParams}` }] }, - 'suzhou.gov.cn': { _name: '苏州市政府', www: [{ title: '政府新闻', docs: 'https://docs.rsshub.app/routes/government#su-zhou-shi-ren-min-zheng-fu', source: '/szsrmzf/:uid/nav_list.', target: '/gov/suzhou/news/:uid' }] }, - 'last.fm': { - _name: 'Last.fm', - www: [ - { title: '用户播放记录', docs: 'https://docs.rsshub.app/routes/multimedia#last-fm', source: ['/user/:user', '/user/:user/*'], target: '/lastfm/recent/:user' }, - { title: '用户 Love 记录', docs: 'https://docs.rsshub.app/routes/multimedia#last-fm', source: ['/user/:user', '/user/:user/*'], target: '/lastfm/loved/:user' }, - { title: '站内 Top 榜单', docs: 'https://docs.rsshub.app/routes/multimedia#last-fm', source: '/charts', target: '/lastfm/top' }, - ], - }, - 'hackerone.com': { _name: 'HackerOne', '.': [{ title: 'HackerOne Hacker Activity', docs: 'https://docs.rsshub.app/routes/other#hackerone-hacker-activity', source: '/hacktivity', target: '/hackerone/hacktivity' }] }, - 'cowlevel.net': { _name: '奶牛关', '.': [{ title: '元素文章', docs: 'https://docs.rsshub.app/routes/game#nai-niu-guan', source: ['/element/:id', '/element/:id/article'], target: '/cowlevel/element/:id' }] }, - 'beijing.gov.cn': { wjw: [{ title: '北京卫生健康委员会', docs: 'https://docs.rsshub.app/routes/government#bei-jing-shi-wei-sheng-jian-kang-wei-yuan-hui', source: '/xwzx_20031/:caty', target: '/gov/beijing/mhc/:caty' }] }, - 'ynu.edu.cn': { - _name: '云南大学', - home: [{ title: '官网消息通告', docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', source: '/tzgg.htm', target: '/ynu/home' }], - jwc: [ - { title: '教务处教务科通知', docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', source: '/*', target: '/jwc/1' }, - { title: '教务处学籍科通知', docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', source: '/*', target: '/jwc/2' }, - { title: '教务处教学研究科通知', docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', source: '/*', target: '/jwc/3' }, - { title: '教务处实践科学科通知', docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', source: '/*', target: '/jwc/4' }, - ], - grs: [{ title: '研究生院通知', docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', source: '/*', target: '' }], - }, - // 'biquge5200.com': { www: [{ title: 'biquge5200.com', docs: 'https://docs.rsshub.app/routes/reading#bi-qu-ge-biquge5200-com', source: '/:id', target: '/novel/biquge/:id' }] }, - // 'biquge.info': { www: [{ title: 'biquge.info', docs: 'https://docs.rsshub.app/routes/reading#bi-qu-ge-biquge-info', source: '/:id', target: '/novel/biqugeinfo/:id' }] }, - 'matters.news': { - _name: 'Matters', - '.': [ - { title: '最新排序', docs: 'https://docs.rsshub.app/routes/new-media#matters', source: '', target: '/matters/latest' }, - { title: '标签', docs: 'https://docs.rsshub.app/routes/new-media#matters', source: '/tags/:tid', target: '/matters/tags/:tid' }, - { - title: '作者', - docs: 'https://docs.rsshub.app/routes/new-media#matters', - source: ['/:id', '/:id/comments'], - target: (params) => { - const uid = params.id.replace('@', ''); - return uid ? `/matters/author/${uid}` : ''; - }, - }, - ], - }, - 'hbut.edu.cn': { - _name: '湖北工业大学', - www: [ - { - title: '新闻中心', - docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', - source: '/xwzx/:name', - target: (params) => { - const type = params.name.replace('.htm', ''); - return type ? `/hbut/news/${type}` : '/hbut/news/tzgg'; - }, - }, - ], - jsjxy: [ - { title: '新闻动态', docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', source: '/index/xwdt.htm', target: '/hbut/cs/xwdt' }, - { title: '通知公告', docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', source: '/index/tzgg.htm', target: '/hbut/cs/tzgg' }, - { title: '教学信息', docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', source: '/jxxx.htm', target: '/hbut/cs/jxxx' }, - { title: '科研动态', docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', source: '/kxyj/kydt.htm', target: '/hbut/cs/kydt' }, - { title: '党建活动', docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', source: '/djhd/djhd.htm', target: '/hbut/cs/djhd' }, - ], - }, - 'zhuixinfan.com': { _name: '追新番日剧站', '.': [{ title: '更新列表', docs: 'https://docs.rsshub.app/routes/multimedia#zhui-xin-fan-ri-ju-zhan', source: ['/main.php'], target: '/zhuixinfan/list' }] }, - 'etoland.co.kr': { - _name: 'eTOLAND', - '.': [{ title: '主题贴', docs: 'https://docs.rsshub.app/routes/bbs#etoland', source: ['/bbs/board.php', '/plugin/mobile/board.php'], target: (params, url) => `/etoland/${new URL(url).searchParams.get('bo_table')}` }], - }, - 'onejav.com': { - _name: 'OneJAV BT', - '.': [ - { - title: '今日种子', - docs: 'https://docs.rsshub.app/routes/multimedia#onejav', - source: '/', - target: (params, url, document) => { - const today = document.querySelector('div.card.mb-1.card-overview').dataset.date.replaceAll('-', ''); - return `/onejav/day/${today}`; - }, - }, - { - title: '今日演员', - docs: 'https://docs.rsshub.app/routes/multimedia#onejav', - source: '/', - target: (params, url, document) => { - const star = document.querySelector('div.card-content > div > a').getAttribute('href'); - return `/onejav${star}`; - }, - }, - { - title: '页面种子', - docs: 'https://docs.rsshub.app/routes/multimedia#onejav', - source: ['/:type', '/:type/:key', '/:type/:key/:morekey'], - target: (params, url, document) => { - const itype = params.morekey === undefined ? params.type : params.type === 'tag' ? 'tag' : 'day'; - let ikey = `${itype === 'day' ? params.type : ''}${params.key || ''}${itype === 'tag' && params.morekey !== undefined ? '%2F' : ''}${params.morekey || ''}`; - if (ikey === '' && itype === 'tag') { - ikey = document.querySelector('div.thumbnail.is-inline > a').getAttribute('href').replace('/tag/', '').replace('/', '%2F'); - } else if (ikey === '' && itype === 'actress') { - ikey = document.querySelector('div.card > a').getAttribute('href').replace('/actress/', ''); - } - return `/onejav/${itype}/${ikey}`; - }, - }, - ], - }, - 'sexinsex.net': { - _name: 'sexinsex', - '.': [ - { - title: '分区帖子', - docs: 'https://docs.rsshub.app/routes/multimedia#sexinsex', - source: '/bbs/:path', - target: (params, url) => { - let pid, typeid; - const static_matched = params.path.match(/forum-(\d+)-\d+.html/); - if (static_matched) { - pid = static_matched[1]; - } else if (params.path === 'forumdisplay.php') { - pid = new URL(url).searchParams.get('fid'); - typeid = new URL(url).searchParams.get('typeid'); - } else { - return false; - } - return `/sexinsex/${pid}/${typeid ?? ''}`; - }, - }, - ], - }, - 't66y.com': { - _name: '草榴社区', - www: [ - { - title: '分区帖子', - docs: 'https://docs.rsshub.app/routes/multimedia#cao-liu-she-qu', - source: '/thread0806.php', - target: (params, url) => { - const id = new URL(url).searchParams.get('fid'); - const type = new URL(url).searchParams.get('type'); - return `/t66y/${id}/${type ?? ''}`; - }, - }, - ], - }, - 'umass.edu': { - _name: 'UMASS Amherst', - ece: [ - { title: 'ECE News', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/news', target: '/umass/amherst/ecenews' }, - { title: 'ECE Seminar', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/seminars', target: '/umass/amherst/eceseminar' }, - ], - 'www.cics': [{ title: 'CICS News', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/news', target: '/umass/amherst/csnews' }], - www: [ - { title: 'IPO Events', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/ipo/iss/events', target: '/umass/amherst/ipoevents' }, - { title: 'IPO Featured Stories', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/ipo/iss/featured-stories', target: '/umass/amherst/ipostories' }, - ], - }, - 'bjeea.com': { - _name: '北京考试院', - www: [ - { title: '首页 / 通知公告', docs: 'https://docs.rsshub.app/routes/government#bei-jing-jiao-yu-kao-shi-yuan', source: ['/bjeeagg'], target: '/gov/beijing/bjeea/bjeeagg' }, - { title: '首页 / 招考政策', docs: 'https://docs.rsshub.app/routes/government#bei-jing-jiao-yu-kao-shi-yuan', source: ['/zkzc'], target: '/gov/beijing/bjeea/zkzc' }, - { title: '首页 / 自考快递', docs: 'https://docs.rsshub.app/routes/government#bei-jing-jiao-yu-kao-shi-yuan', source: ['/zkkd'], target: '/gov/beijing/bjeea/zkkd' }, - ], - }, - 'nppa.gov.cn': { - _name: '国家新闻出版署', - www: [ - { title: '栏目', docs: 'https://docs.rsshub.app/routes/government#guo-jia-xin-wen-chu-ban-shu', source: '/nppa/channels/:channel', target: (params, url) => `/gov/nppa/${/nppa\/channels\/(\d+)\./.exec(url)[1]}` }, - { - title: '内容', - docs: 'https://docs.rsshub.app/routes/government#guo-jia-xin-wen-chu-ban-shu', - source: '/nppa/contents/:channel/:content', - target: (params, url) => `/gov/nppa/${/nppa\/contents\/(\d+\/\d+)\.shtml/.exec(url)[1]}`, - }, - ], - }, - 'jjmhw.cc': { _name: '漫小肆', www: [{ title: '漫画更新', docs: 'https://docs.rsshub.app/routes/anime#man-xiao-si', source: '/book/:id', target: '/manxiaosi/book/:id' }] }, - 'wenxuecity.com': { - _name: '文学城', - blog: [ - { title: '博客', docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-bo-ke', source: '/myblog/:id', target: '/wenxuecity/blog/:id' }, - { title: '博客', docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-bo-ke', source: '/myoverview/:id', target: '/wenxuecity/blog/:id' }, - ], - bbs: [ - { title: '最新主题', docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-zui-xin-zhu-ti', source: '/:cat', target: '/wenxuecity/bbs/:cat' }, - { title: '最新主题 - 精华区', docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-zui-xin-zhu-ti', source: '/:cat', target: '/wenxuecity/bbs/:cat/1' }, - { - title: '最热主题', - docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-zui-re-zhu-ti', - source: '/?cid=*', - target: (params, url, document) => { - const cid = document && new URL(document.location).searchParams.get('cid'); - return `/wenxuecity/hot/${cid}`; - }, - }, - ], - }, - 'eventernote.com': { _name: 'Eventernote', www: [{ title: '声优活动及演唱会', docs: 'https://docs.rsshub.app/routes/anime#eventernote', source: '/actors/:name/:id/events', target: '/eventernote/actors/:name/:id' }] }, - 'huya.com': { _name: '虎牙直播', '.': [{ title: '直播间开播', docs: 'https://docs.rsshub.app/routes/live#hu-ya-zhi-bo-zhi-bo-jian-kai-bo', source: '/:id', target: '/huya/live/:id' }] }, - 'scboy.com': { - _name: 'scboy 论坛', - www: [ - { - title: '帖子', - docs: 'https://docs.rsshub.app/routes/bbs#scboy', - source: '', - target: (params, url) => { - const id = url.includes('thread') ? url.split('-')[1].split('.')[0] : ''; - return id ? `/scboy/thread/${id}` : ''; - }, - }, - ], - }, - 'cqut.edu.cn': { - _name: '重庆理工大学', - tz: [{ title: '通知', docs: 'https://docs.rsshub.app/routes/university#chong-qing-li-gong-da-xue', source: '/*' }], - lib: [{ title: '图书馆通知', docs: 'https://docs.rsshub.app/routes/university#chong-qing-li-gong-da-xue', source: '/*' }], - }, - 'cqwu.net': { - _name: '重庆文理学院', - www: [ - { - title: '通知', - docs: 'https://docs.rsshub.app/routes/university#chong-qing-wen-li-xue-yuan', - source: '/:type', - target: (params) => { - if (params.type === 'channel_7721.html') { - return '/cqwu/news/notify'; - } - }, - }, - { - title: '学术活动', - docs: 'https://docs.rsshub.app/routes/university#chong-qing-wen-li-xue-yuan', - source: '/:type', - target: (params) => { - if (params.type === 'channel_7722.html') { - return '/cqwu/news/academiceve'; - } - }, - }, - ], - }, - 'trakt.tv': { - _name: 'Trakt.tv', - '.': [ - { - title: '用户收藏', - docs: 'https://docs.rsshub.app/routes/multimedia#trakt-tv-yong-hu-shou-cang', - source: ['/users/:username/collection/:type/added', '/users/:username/collection'], - target: (params) => `/trakt/collection/${params.username}/${params.type || 'all'}`, - }, - ], - }, - 'furaffinity.net': { - _name: 'Fur Affinity', - www: [ - { title: '主页', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/', target: '/furaffinity/home' }, - { title: '浏览', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/browse/', target: '/furaffinity/browse' }, - { title: '站点状态', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/', target: '/furaffinity/status' }, - { - title: '搜索', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/search/', - target: (params, url) => { - const keyword = new URL(url).searchParams.get('q'); - if (keyword) { - return `/furaffinity/search/${keyword}`; - } - }, - }, - { title: '用户主页简介', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/user/:username/', target: '/furaffinity/user/:username' }, - { title: '用户关注列表', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/watchlist/by/:username/', target: '/furaffinity/watching/:username' }, - { title: '用户被关注列表', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/watchlist/to/:username/', target: '/furaffinity/watchers/:username' }, - { title: '用户接受委托信息', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/commissions/:username/', target: '/furaffinity/commissions/:username' }, - { title: '用户的 Shouts 留言', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/user/:username/', target: '/furaffinity/shouts/:username' }, - { title: '用户的日记', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/journals/:username/', target: '/furaffinity/journals/:username' }, - { title: '用户的创作画廊', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/gallery/:username/', target: '/furaffinity/gallery/:username' }, - { title: '用户非正式作品', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/scraps/:username/', target: '/furaffinity/scraps/:username' }, - { title: '用户的喜爱列表', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/favorites/:username/', target: '/furaffinity/favorites/:username' }, - { title: '作品评论区', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/view/:id/', target: '/furaffinity/submission_comments/:id' }, - { title: '日记评论区', docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', source: '/journal/:id/', target: '/furaffinity/journal_comments/:id' }, - ], - }, - 'foreverblog.cn': { - _name: 'foreverblog', - www: [ - { - title: '十年之约', - docs: 'https://docs.rsshub.app/routes/social-media#foreverblog', - }, - ], - }, -}); diff --git a/package.json b/package.json index 9c208fc3beebe5..0262288623a623 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "scripts": { "build": "tsx scripts/workflow/build-routes.ts", "dev": "cross-env NODE_ENV=dev tsx watch --no-cache lib/index.ts", - "format": "eslint --cache --fix \"**/*.{ts,js,yml}\" && node website/docs/.format/format.mjs && prettier \"**/*.{ts,js,json}\" --write", + "format": "eslint --cache --fix \"**/*.{ts,js,yml}\" && prettier \"**/*.{ts,js,json}\" --write", "format:check": "eslint --cache \"**/*.{ts,js,yml}\" && prettier \"**/*.{ts,js,json}\" --check", "format:staged": "lint-staged", "vitest": "cross-env NODE_ENV=test vitest", @@ -43,7 +43,6 @@ "eslint --cache --fix", "prettier --ignore-unknown --ignore-path ./.gitignore --write" ], - "*.md?(x)": "node website/docs/.format/format.mjs --staged", "*.yml": "eslint --cache --fix" }, "dependencies": { diff --git a/scripts/workflow/radar-rules.js b/scripts/workflow/radar-rules.js deleted file mode 100644 index 13055c349f0afa..00000000000000 --- a/scripts/workflow/radar-rules.js +++ /dev/null @@ -1,815 +0,0 @@ -module.exports = { - 'algocasts.io': { - _name: 'AlgoCasts', - '.': [ - { - title: '视频更新', - docs: 'https://docs.rsshub.app/routes/programming#algocasts', - source: '/episodes', - target: '/algocasts', - }, - ], - }, - 'soulapp.cn': { - _name: 'Soul', - '.': [ - { - title: '瞬间更新', - docs: 'https://docs.rsshub.app/routes/social-media#soul', - }, - ], - }, - 'anime1.me': { - _name: 'Anime1', - '.': [ - { - title: '動畫', - docs: 'https://docs.rsshub.app/routes/anime#anime1', - source: '/category/:time/:name', - target: '/anime1/anime/:time/:name', - }, - { - title: '搜尋', - docs: 'https://docs.rsshub.app/routes/anime#anime1', - source: '/', - target: (params, url) => { - const keyword = new URL(url).searchParams.get('s'); - return keyword ? `/anime1/search/${keyword}` : ''; - }, - }, - ], - }, - 'swufe.edu.cn': { - _name: '西南财经大学', - it: [ - { - title: '经济信息工程学院 - 通知公告', - docs: 'https://docs.rsshub.app/routes/university#xi-nan-cai-jing-da-xue', - source: '/index/tzgg.htm', - target: '/swufe/seie/tzgg', - }, - { - title: '经济信息工程学院 - 学院新闻', - docs: 'https://docs.rsshub.app/routes/university#xi-nan-cai-jing-da-xue', - source: '/index/xyxw.htm', - target: '/swufe/seie/xyxw', - }, - ], - }, - 'www.chicagotribune.com': { - _name: 'Chicago Tribune', - www: [ - { - title: 'Chicago Tribune', - docs: 'https://docs.rsshub.app/routes/traditional_media#chicago-tribune', - source: '/', - }, - ], - }, - 'monsterhunter.com': { - _name: '怪物猎人世界', - www: [ - { - title: '更新情报', - docs: 'https://docs.rsshub.app/routes/game#guai-wu-lie-ren-shi-jie', - source: ['', '/*tpath'], - target: '/mhw/update', - }, - { - title: '最新消息', - docs: 'https://docs.rsshub.app/routes/game#guai-wu-lie-ren-shi-jie', - source: ['', '/*tpath'], - target: '/mhw/news', - }, - ], - }, - 'bing.com': { - _name: 'Bing', - www: [ - { - title: '每日壁纸', - docs: 'https://docs.rsshub.app/routes/picture#bing-bi-zhi', - source: '', - target: '/bing', - }, - ], - }, - 'wegene.com': { - _name: 'WeGene', - www: [ - { - title: '最近更新', - docs: 'https://docs.rsshub.app/routes/other#wegene', - source: '', - target: '/wegene/newest', - }, - { - title: '栏目', - docs: 'https://docs.rsshub.app/routes/other#wegene', - source: '/crowdsourcing', - target: '/wegene/column/all/all', - }, - ], - }, - - 'emi-nitta.net': { - _name: 'Emi Nitta', - '.': [ - { - title: '最近更新', - docs: 'https://docs.rsshub.app/routes/other#xin-tian-hui-hai-guan-fang-wang-zhan', - source: '/updates', - target: '/emi-nitta/updates', - }, - { - title: '新闻', - docs: 'https://docs.rsshub.app/routes/other#xin-tian-hui-hai-guan-fang-wang-zhan', - source: '/contents/news', - target: '/emi-nitta/news', - }, - ], - }, - - 'yuancheng.work': { - _name: '远程.work', - '.': [ - { - title: '招聘信息', - docs: 'https://docs.rsshub.app/routes/other#yuan-cheng-work', - source: '/:caty', - target: (params, url) => { - if (!url) { - return '/remote-work'; - } - return '/remote-work/' + /\w+-(\w+)-\w+/.exec(url)[1]; - }, - }, - ], - }, - - 'govopendata.com': { - _name: '新闻联播文字版', - cn: [ - { - title: '新闻联播文字版', - docs: 'https://docs.rsshub.app/routes/traditional-media#xin-wen-lian-bo-wen-zi-ban', - source: '/xinwenlianbo', - target: '/xinwenlianbo/index', - }, - ], - }, - - 'steampowered.com': { - _name: 'Steam', - store: [ - { - title: 'search', - docs: 'https://docs.rsshub.app/routes/game#steam', - source: '/search/', - target: (params, url) => `/steam/search/${new URL(url).searchParams}`, - }, - ], - }, - 'suzhou.gov.cn': { - _name: '苏州市政府', - www: [ - { - title: '政府新闻', - docs: 'https://docs.rsshub.app/routes/government#su-zhou-shi-ren-min-zheng-fu', - source: '/szsrmzf/:uid/nav_list.shtml', - target: '/gov/suzhou/news/:uid', - }, - ], - }, - 'last.fm': { - _name: 'Last.fm', - www: [ - { - title: '用户播放记录', - docs: 'https://docs.rsshub.app/routes/multimedia#last-fm', - source: ['/user/:user', '/user/:user/*'], - target: '/lastfm/recent/:user', - }, - { - title: '用户 Love 记录', - docs: 'https://docs.rsshub.app/routes/multimedia#last-fm', - source: ['/user/:user', '/user/:user/*'], - target: '/lastfm/loved/:user', - }, - { - title: '站内 Top 榜单', - docs: 'https://docs.rsshub.app/routes/multimedia#last-fm', - source: '/charts', - target: '/lastfm/top', - }, - ], - }, - 'hackerone.com': { - _name: 'HackerOne', - '.': [ - { - title: 'HackerOne Hacker Activity', - docs: 'https://docs.rsshub.app/routes/other#hackerone-hacker-activity', - source: '/hacktivity', - target: '/hackerone/hacktivity', - }, - ], - }, - 'cowlevel.net': { - _name: '奶牛关', - '.': [ - { - title: '元素文章', - docs: 'https://docs.rsshub.app/routes/game#nai-niu-guan', - source: ['/element/:id', '/element/:id/article'], - target: '/cowlevel/element/:id', - }, - ], - }, - 'ynu.edu.cn': { - _name: '云南大学', - home: [ - { - title: '官网消息通告', - docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', - source: '/tzgg.htm', - target: '/ynu/home', - }, - ], - jwc: [ - { - title: '教务处教务科通知', - docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', - source: '/*', - target: '/jwc/1', - }, - { - title: '教务处学籍科通知', - docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', - source: '/*', - target: '/jwc/2', - }, - { - title: '教务处教学研究科通知', - docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', - source: '/*', - target: '/jwc/3', - }, - { - title: '教务处实践科学科通知', - docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', - source: '/*', - target: '/jwc/4', - }, - ], - grs: [ - { - title: '研究生院通知', - docs: 'https://docs.rsshub.app/routes/university#yun-nan-da-xue', - source: '/*', - target: '', - }, - ], - }, - 'hrbeu.edu.cn': { - _name: '哈尔滨工程大学', - yjsy: [ - { - title: '研究生院 - 通知公告', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/yjsy/announcement', - }, - { - title: '研究生院 - 新闻动态', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/yjsy/news', - }, - { - title: '研究生院 - 国家公派项目', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/yjsy/gjgp', - }, - { - title: '研究生院 - 国际合作与交流项目', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/yjsy/gjhz', - }, - ], - job: [ - { - title: '就业服务平台 - 通知公告', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/job/tzgg', - }, - ], - uae: [ - { - title: '水声学院 - 新闻动态', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/shuisheng/xwdt', - }, - { - title: '研究生院 - 通知公告', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/shuisheng/tzgg', - }, - ], - }, - 'gongxue.cn': { - _name: '工学网', - '.': [ - { - title: '要闻', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/gongxue/yw', - }, - { - title: '时讯', - docs: 'https://docs.rsshub.app/routes/university#ha-er-bin-gong-cheng-da-xue', - source: '/*', - target: '/heu/gongxue/sx', - }, - ], - }, - // 'biquge5200.com': { - // www: [ - // { - // title: 'biquge5200.com', - // docs: 'https://docs.rsshub.app/routes/reading#bi-qu-ge-biquge5200-com', - // source: '/:id', - // target: '/novel/biquge/:id', - // }, - // ], - // }, - // 'biquge.info': { - // www: [ - // { - // title: 'biquge.info', - // docs: 'https://docs.rsshub.app/routes/reading#bi-qu-ge-biquge-info', - // source: '/:id', - // target: '/novel/biqugeinfo/:id', - // }, - // ], - // }, - 'matters.news': { - _name: 'Matters', - '.': [ - { - title: '最新排序', - docs: 'https://docs.rsshub.app/routes/new-media#matters', - source: '', - target: '/matters/latest', - }, - { - title: '标签', - docs: 'https://docs.rsshub.app/routes/new-media#matters', - source: '/tags/:tid', - target: '/matters/tags/:tid', - }, - { - title: '作者', - docs: 'https://docs.rsshub.app/routes/new-media#matters', - source: ['/:id', '/:id/comments'], - target: (params) => { - const uid = params.id.replace('@', ''); - return uid ? `/matters/author/${uid}` : ''; - }, - }, - ], - }, - 'hbut.edu.cn': { - _name: '湖北工业大学', - www: [ - { - title: '新闻中心', - docs: 'http://docs.rsshub.app/university#hu-bei-gong-ye-da-xue', - source: '/xwzx/:name', - target: (params) => { - const type = params.name.replace('.htm', ''); - return type ? `/hbut/news/${type}` : '/hbut/news/tzgg'; - }, - }, - ], - jsjxy: [ - { - title: '新闻动态', - docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', - source: '/index/xwdt.htm', - target: '/hbut/cs/xwdt', - }, - { - title: '通知公告', - docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', - source: '/index/tzgg.htm', - target: '/hbut/cs/tzgg', - }, - { - title: '教学信息', - docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', - source: '/jxxx.htm', - target: '/hbut/cs/jxxx', - }, - { - title: '科研动态', - docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', - source: '/kxyj/kydt.htm', - target: '/hbut/cs/kydt', - }, - { - title: '党建活动', - docs: 'http://docs.rsshub.app/routes/university#hu-bei-gong-ye-da-xue', - source: '/djhd/djhd.htm', - target: '/hbut/cs/djhd', - }, - ], - }, - 'zhuixinfan.com': { - _name: '追新番日剧站', - '.': [ - { - title: '更新列表', - docs: 'https://docs.rsshub.app/routes/multimedia#zhui-xin-fan-ri-ju-zhan', - source: ['/main.php'], - target: '/zhuixinfan/list', - }, - ], - }, - 'etoland.co.kr': { - _name: 'eTOLAND', - '.': [ - { - title: '主题贴', - docs: 'https://docs.rsshub.app/routes/bbs#etoland', - source: ['/bbs/board.php', '/plugin/mobile/board.php'], - target: (params, url) => `/etoland/${new URL(url).searchParams.get('bo_table')}`, - }, - ], - }, - 'onejav.com': { - _name: 'OneJAV BT', - '.': [ - { - title: '今日种子', - docs: 'https://docs.rsshub.app/routes/multimedia#onejav', - source: '/', - target: (params, url, document) => { - const today = document.querySelector('div.card.mb-1.card-overview').dataset.date.replaceAll('-', ''); - return `/onejav/day/${today}`; - }, - }, - { - title: '今日演员', - docs: 'https://docs.rsshub.app/routes/multimedia#onejav', - source: '/', - target: (params, url, document) => { - const star = document.querySelector('div.card-content > div > a').getAttribute('href'); - return `/onejav${star}`; - }, - }, - { - title: '页面种子', - docs: 'https://docs.rsshub.app/routes/multimedia#onejav', - source: ['/:type', '/:type/:key', '/:type/:key/:morekey'], - target: (params, url, document) => { - const itype = params.morekey === undefined ? params.type : params.type === 'tag' ? 'tag' : 'day'; - let ikey = `${itype === 'day' ? params.type : ''}${params.key || ''}${itype === 'tag' && params.morekey !== undefined ? '%2F' : ''}${params.morekey || ''}`; - if (ikey === '' && itype === 'tag') { - ikey = document.querySelector('div.thumbnail.is-inline > a').getAttribute('href').replace('/tag/', '').replace('/', '%2F'); - } else if (ikey === '' && itype === 'actress') { - ikey = document.querySelector('div.card > a').getAttribute('href').replace('/actress/', ''); - } - return `/onejav/${itype}/${ikey}`; - }, - }, - ], - }, - 'sexinsex.net': { - _name: 'sexinsex', - '.': [ - { - title: '分区帖子', - docs: 'https://docs.rsshub.app/routes/multimedia#sexinsex', - source: '/bbs/:path', - target: (params, url) => { - let pid, typeid; - const static_matched = params.path.match(/forum-(\d+)-\d+.html/); - if (static_matched) { - pid = static_matched[1]; - } else if (params.path === 'forumdisplay.php') { - pid = new URL(url).searchParams.get('fid'); - typeid = new URL(url).searchParams.get('typeid'); - } else { - return false; - } - return `/sexinsex/${pid}/${typeid ?? ''}`; - }, - }, - ], - }, - 't66y.com': { - _name: '草榴社区', - www: [ - { - title: '分区帖子', - docs: 'https://docs.rsshub.app/routes/multimedia#cao-liu-she-qu', - source: '/thread0806.php', - target: (params, url) => { - const id = new URL(url).searchParams.get('fid'); - const type = new URL(url).searchParams.get('type'); - return `/t66y/${id}/${type ?? ''}`; - }, - }, - ], - }, - 'umass.edu': { - _name: 'UMASS Amherst', - ece: [ - { - title: 'ECE News', - docs: 'http://docs.rsshub.app/routes/university#umass-amherst', - source: '/news', - target: '/umass/amherst/ecenews', - }, - { - title: 'ECE Seminar', - docs: 'http://docs.rsshub.app/routes/university#umass-amherst', - source: '/seminars', - target: '/umass/amherst/eceseminar', - }, - ], - 'www.cics': [ - { - title: 'CICS News', - docs: 'http://docs.rsshub.app/routes/university#umass-amherst', - source: '/news', - target: '/umass/amherst/csnews', - }, - ], - www: [ - { - title: 'IPO Events', - docs: 'http://docs.rsshub.app/routes/university#umass-amherst', - source: '/ipo/iss/events', - target: '/umass/amherst/ipoevents', - }, - { - title: 'IPO Featured Stories', - docs: 'http://docs.rsshub.app/routes/university#umass-amherst', - source: '/ipo/iss/featured-stories', - target: '/umass/amherst/ipostories', - }, - ], - }, - 'bjeea.com': { - _name: '北京考试院', - www: [ - { - title: '首页 / 通知公告', - docs: 'https://docs.rsshub.app/routes/government#bei-jing-jiao-yu-kao-shi-yuan', - source: ['/html/bjeeagg'], - target: '/gov/beijing/bjeea/bjeeagg', - }, - { - title: '首页 / 招考政策', - docs: 'https://docs.rsshub.app/routes/government#bei-jing-jiao-yu-kao-shi-yuan', - source: ['/html/zkzc'], - target: '/gov/beijing/bjeea/zkzc', - }, - { - title: '首页 / 自考快递', - docs: 'https://docs.rsshub.app/routes/government#bei-jing-jiao-yu-kao-shi-yuan', - source: ['/html/zkkd'], - target: '/gov/beijing/bjeea/zkkd', - }, - ], - }, - 'nppa.gov.cn': { - _name: '国家新闻出版署', - www: [ - { - title: '栏目', - docs: 'https://docs.rsshub.app/routes/government#guo-jia-xin-wen-chu-ban-shu', - source: '/nppa/channels/:channel', - target: (params, url) => `/gov/nppa/${/nppa\/channels\/(\d+)\.shtml/.exec(url)[1]}`, - }, - { - title: '内容', - docs: 'https://docs.rsshub.app/routes/government#guo-jia-xin-wen-chu-ban-shu', - source: '/nppa/contents/:channel/:content', - target: (params, url) => `/gov/nppa/${/nppa\/contents\/(\d+\/\d+)\.shtml/.exec(url)[1]}`, - }, - ], - }, - 'jjmhw.cc': { - _name: '漫小肆', - www: [ - { - title: '漫画更新', - docs: 'https://docs.rsshub.app/routes/anime#man-xiao-si', - source: '/book/:id', - target: '/manxiaosi/book/:id', - }, - ], - }, - 'wenxuecity.com': { - _name: '文学城', - blog: [ - { - title: '博客', - docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-bo-ke', - source: '/myblog/:id', - target: '/wenxuecity/blog/:id', - }, - { - title: '博客', - docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-bo-ke', - source: '/myoverview/:id', - target: '/wenxuecity/blog/:id', - }, - ], - bbs: [ - { - title: '最新主题', - docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-zui-xin-zhu-ti', - source: '/:cat', - target: '/wenxuecity/bbs/:cat', - }, - { - title: '最新主题 - 精华区', - docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-zui-xin-zhu-ti', - source: '/:cat', - target: '/wenxuecity/bbs/:cat/1', - }, - { - title: '最热主题', - docs: 'https://docs.rsshub.app/routes/bbs#wen-xue-cheng-zui-re-zhu-ti', - source: '/?cid=*', - target: (params, url, document) => { - const cid = document && new URL(document.location).searchParams.get('cid'); - return `/wenxuecity/hot/${cid}`; - }, - }, - ], - }, - 'huya.com': { - _name: '虎牙直播', - '.': [ - { - title: '直播间开播', - docs: 'https://docs.rsshub.app/routes/live#hu-ya-zhi-bo-zhi-bo-jian-kai-bo', - source: '/:id', - target: '/huya/live/:id', - }, - ], - }, - 'scboy.com': { - _name: 'scboy 论坛', - www: [ - { - title: '帖子', - docs: 'https://docs.rsshub.app/routes/bbs#scboy', - source: '', - target: (params, url) => { - const id = url.includes('thread') ? url.split('-')[1].split('.')[0] : ''; - return id ? `/scboy/thread/${id}` : ''; - }, - }, - ], - }, - 'cqut.edu.cn': { - _name: '重庆理工大学', - tz: [ - { - title: '通知', - docs: 'https://docs.rsshub.app/routes/university#chong-qing-li-gong-da-xue', - source: '/*', - }, - ], - lib: [ - { - title: '图书馆通知', - docs: 'https://docs.rsshub.app/routes/university#chong-qing-li-gong-da-xue', - source: '/*', - }, - ], - }, - 'trakt.tv': { - _name: 'Trakt.tv', - '.': [ - { - title: '用户收藏', - docs: 'https://docs.rsshub.app/routes/multimedia#trakt-tv-yong-hu-shou-cang', - source: ['/users/:username/collection/:type/added', '/users/:username/collection'], - target: (params) => `/trakt/collection/${params.username}/${params.type || 'all'}`, - }, - ], - }, - 'furaffinity.net': { - _name: 'Fur Affinity', - www: [ - { - title: '主页', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/', - target: '/furaffinity/home', - }, - { - title: '浏览', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/browse/', - target: '/furaffinity/browse', - }, - { - title: '站点状态', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/', - target: '/furaffinity/status', - }, - { - title: '搜索', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/search/', - target: (params, url) => { - const keyword = new URL(url).searchParams.get('q'); - if (keyword) { - return `/furaffinity/search/${keyword}`; - } - }, - }, - { - title: '用户主页简介', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/user/:username/', - target: '/furaffinity/user/:username', - }, - { - title: '用户关注列表', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/watchlist/by/:username/', - target: '/furaffinity/watching/:username', - }, - { - title: '用户被关注列表', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/watchlist/to/:username/', - target: '/furaffinity/watchers/:username', - }, - { - title: '用户接受委托信息', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/commissions/:username/', - target: '/furaffinity/commissions/:username', - }, - { - title: '用户的 Shouts 留言', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/user/:username/', - target: '/furaffinity/shouts/:username', - }, - { - title: '用户的日记', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/journals/:username/', - target: '/furaffinity/journals/:username', - }, - { - title: '用户的创作画廊', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/gallery/:username/', - target: '/furaffinity/gallery/:username', - }, - { - title: '用户非正式作品', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/scraps/:username/', - target: '/furaffinity/scraps/:username', - }, - { - title: '用户的喜爱列表', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/favorites/:username/', - target: '/furaffinity/favorites/:username', - }, - { - title: '作品评论区', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/view/:id/', - target: '/furaffinity/submission_comments/:id', - }, - { - title: '日记评论区', - docs: 'https://docs.rsshub.app/routes/social-media#fur-affinity', - source: '/journal/:id/', - target: '/furaffinity/journal_comments/:id', - }, - ], - }, -}; diff --git a/website/docs/.format/file.mjs b/website/docs/.format/file.mjs deleted file mode 100644 index f271d9bed4620e..00000000000000 --- a/website/docs/.format/file.mjs +++ /dev/null @@ -1,11 +0,0 @@ -import fs from 'fs/promises'; - -export default { - ROUTE_TYPE: 'route', - GUIDE_TYPE: 'guide', - NAV_TYPE: 'nav', - LANG_CN: 'zh-CN', - LANG_EN: 'en-US', - readFile: async (filePath) => await fs.readFile(filePath, { encoding: 'utf8' }), - writeFile: async (filePath, data) => await fs.writeFile(filePath, data, { encoding: 'utf8' }), -}; diff --git a/website/docs/.format/format.mjs b/website/docs/.format/format.mjs deleted file mode 100644 index a4b8c233fdf020..00000000000000 --- a/website/docs/.format/format.mjs +++ /dev/null @@ -1,133 +0,0 @@ -import file from './file.mjs'; -import sgf from 'staged-git-files'; -import sortByHeading from './sortByHeading.mjs'; -// import slugId from './slugId.mjs'; -import routeFormat from './routeFormat.mjs'; -import { exec } from 'child_process'; -import { fileURLToPath } from 'url'; -import sidebars from '../../sidebars.mjs'; - -/** - * Processors are objects contains two methods: - * `rules(list)`, and `handler(str)` - * rules filters required file document object - * and handler get document string and return formatted document - */ -const processors = [sortByHeading, routeFormat]; - -// Helpers -// const loopSideBar = (children, type, lang, prefix) => -// children -// .filter((e) => e !== '') -// .map((x) => ({ -// path: path.resolve(__dirname, '..', prefix, `./${x}.md`), -// type, -// lang, -// })); -// const loopNav = (nav, lang) => -// nav.flatMap((e) => { -// if (e.items) { -// return loopNav(e.items, lang); -// } -// if (e.link.endsWith('/')) { -// return { -// path: path.resolve(__dirname, '..', e.link.slice(1), 'README.md'), -// type: file.NAV_TYPE, -// lang, -// }; -// } else { -// return { -// path: path.resolve(__dirname, '..', `${e.link.replace(/^\//, '')}.md`), -// type: file.NAV_TYPE, -// lang, -// }; -// } -// }); -// const loopType = (sidebar, lang, prefix) => loopSideBar(sidebar[0].children, file.GUIDE_TYPE, lang, prefix).concat(loopSideBar(sidebar[1].children, file.ROUTE_TYPE, lang, prefix)); - -/** - * Iterate config and build document object: - * E.g. - * { - path: 'docs/other.md', <-- full path here - type: 'route', <--- Defined in file.js - lang: 'en' <-- Defined in file.js - } - */ -const buildFileList = async () => { - const fileList = sidebars.guideSidebar[2].items.map(({ id }) => ({ - type: file.ROUTE_TYPE, - path: fileURLToPath(new URL(`../${id}.mdx`, import.meta.url)), - lang: file.LANG_EN, - })); - // let fileList = []; - // Object.keys(config.themeConfig.locales).forEach((key) => { - // const locale = config.themeConfig.locales[key]; - // const key_path = key.slice(1); - // if (locale.hasOwnProperty('sidebar')) { - // fileList = fileList.concat(loopType(locale.sidebar[key], locale.lang, key_path)); - // } - // if (locale.hasOwnProperty('nav')) { - // fileList = fileList.concat(loopNav(locale.nav, locale.lang)); - // } - // }); - - return fileList; -}; - -/** - * Select files that only being modified - * Same format as `buildFileList()` - */ -const buildStagedList = async () => { - const stagedFiles = await sgf(); - // const stagedFileList = []; - // stagedFiles.forEach((e) => { - // if (e.filename.endsWith('.md')) { - // stagedFileList.push(e.filename); - // } - // }); - const stagedFileList = stagedFiles.filter((e) => e.filename.endsWith('.md') || e.filename.endsWith('.mdx')).map((e) => e.filename); - const fullFileList = await buildFileList(); - // const result = []; - // stagedFileList.forEach((e) => { - // const f = fullFileList.find((x) => x.path.indexOf(e) !== -1); - // if (f) { - // result.push(f); - // } - // }); - const result = stagedFileList.map((e) => fullFileList.find((x) => x.path.includes(e))).filter((e) => e); - - return result; -}; - -/** Entry - * Usage: node format.mjs --full/--staged - */ -(async () => { - // Mode - const flag = process.argv[2] || '--full'; - let fileList = []; - switch (flag) { - case '--staged': - fileList = await buildStagedList(); - break; - case '--full': - default: - fileList = await buildFileList(); - } - // console.log(fileList); - // return - - const stagedFiles = await sgf(); - for (const processor of processors) { - for (const e of processor.rules(fileList)) { - let formatted = await file.readFile(e.path); - formatted = await processor.handler(formatted, e.path); // remark requires path to show error position - await file.writeFile(e.path, formatted); - if (stagedFiles.find((x) => e.path.indexOf(x.filename) !== -1)) { - await exec(`git add ${e.path}`); - } - } - } -})(); diff --git a/website/docs/.format/handle/heading.mjs b/website/docs/.format/handle/heading.mjs deleted file mode 100644 index 73a9f85aaee34f..00000000000000 --- a/website/docs/.format/handle/heading.mjs +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Fork of https://github.com/syntax-tree/mdast-util-to-markdown/blob/8ce8dbf681a29f0f33db91bcfffdabeb9345d609/lib/handle/heading.js - * v1.5.0 - */ - -/** - * @typedef {import('mdast').Heading} Heading - * @typedef {import('../types.js').Parent} Parent - * @typedef {import('../types.js').State} State - * @typedef {import('../types.js').Info} Info - */ - -// import { formatHeadingAsSetext } from "../util/format-heading-as-setext.js"; - -/** - * @param {Heading} node - * @param {Parent | undefined} _ - * @param {State} state - * @param {Info} info - * @returns {string} - */ -export function heading(node, _, state, info) { - const rank = Math.max(Math.min(6, node.depth || 1), 1); - const tracker = state.createTracker(info); - - // if (formatHeadingAsSetext(node, state)) { - // const exit = state.enter("headingSetext"); - // const subexit = state.enter("phrasing"); - // const value = state.containerPhrasing(node, { - // ...tracker.current(), - // before: "\n", - // after: "\n", - // }); - // subexit(); - // exit(); - - // return ( - // value + - // "\n" + - // (rank === 1 ? "=" : "-").repeat( - // // The whole size… - // value.length - - // // Minus the position of the character after the last EOL (or - // // 0 if there is none)… - // (Math.max(value.lastIndexOf("\r"), value.lastIndexOf("\n")) + 1), - // ) - // ); - // } - - const sequence = '#'.repeat(rank); - const exit = state.enter('headingAtx'); - const subexit = state.enter('phrasing'); - - // Note: for proper tracking, we should reset the output positions when there - // is no content returned, because then the space is not output. - // Practically, in that case, there is no content, so it doesn’t matter that - // we’ve tracked one too many characters. - tracker.move(sequence + ' '); - - let value = state.containerPhrasing(node, { - before: '# ', - after: '\n', - ...tracker.current(), - }); - - if (/^[\t ]/.test(value)) { - // To do: what effect has the character reference on tracking? - value = '&#x' + value.charCodeAt(0).toString(16).toUpperCase() + ';' + value.slice(1); - } - - value = value ? sequence + ' ' + value + (node.data?.id ? ' {#' + node.data?.id + '}' : '') : sequence; - - if (state.options.closeAtx) { - value += ' ' + sequence; - } - - subexit(); - exit(); - - return value; -} diff --git a/website/docs/.format/removeHeadingId.mjs b/website/docs/.format/removeHeadingId.mjs deleted file mode 100644 index 8adff5a465fc22..00000000000000 --- a/website/docs/.format/removeHeadingId.mjs +++ /dev/null @@ -1,26 +0,0 @@ -export default { - rules: (list) => list.filter((e) => e), - handler: async (data) => { - const content = data.split('\n'); - let lastH2 = ''; - let lastH3 = ''; - - for (let i = 0; i < content.length; i++) { - if (content[i].startsWith('## ')) { - lastH2 = content[i].match(`## (([^{])*)`)?.[1].trim(); - - content[i] = `## ${lastH2}`; - } else if (content[i].startsWith('### ')) { - lastH3 = content[i].match(`### (([^{])*)`)?.[1].trim(); - - content[i] = `### ${lastH3}`; - } else if (content[i].startsWith('#### ')) { - const title = content[i].match(`#### (([^{])*)`)?.[1].trim(); - - content[i] = `#### ${title}`; - } - } - - return Promise.resolve(content.join('\n')); - }, -}; diff --git a/website/docs/.format/routeFormat.mjs b/website/docs/.format/routeFormat.mjs deleted file mode 100644 index a484f352729fd7..00000000000000 --- a/website/docs/.format/routeFormat.mjs +++ /dev/null @@ -1,49 +0,0 @@ -import file from './file.mjs'; -import stringWidth from 'string-width'; -import { heading } from './handle/heading.mjs'; -import { read } from 'to-vfile'; -import { remark } from 'remark'; -import { remarkHeadingId } from 'remark-custom-heading-id'; -import remarkDirective from 'remark-directive'; -import remarkFrontmatter from 'remark-frontmatter'; -import remarkGfm from 'remark-gfm'; -import remarkMdx from 'remark-mdx'; -import remarkPangu from 'remark-pangu'; -import remarkPrettier from 'remark-preset-prettier'; -import rssHubHeadingId from './rsshub-heading-id.mjs'; -import rssHubNoDupeAttrs from './rsshub-no-dupe-attrs.mjs'; -import rssHubRouteLevel from './rsshub-route-level.mjs'; - -export default { - rules: (list) => list.filter((e) => e.lang === file.LANG_EN && e.type === file.ROUTE_TYPE), - handler: async (_doc, path) => { - const result = await remark() - // remark-stringify settings - .data('settings', { - bullet: '-', - ruleSpaces: true, - handlers: { - heading: (node, parent, state, info) => heading(node, parent, state, info), - }, - }) - .use(remarkMdx) - .use(remarkFrontmatter) - .use(remarkHeadingId) - .use(remarkDirective) - .use(remarkPangu, { - inlineCode: false, - link: false, - }) - .use(remarkPrettier) - .use(remarkGfm, { - stringLength: stringWidth, - }) - .use(rssHubHeadingId, { - overwrite: true, - }) - .use(rssHubNoDupeAttrs) - .use(rssHubRouteLevel) - .process(await read(path)); - return String(result); - }, -}; diff --git a/website/docs/.format/rsshub-heading-id.mjs b/website/docs/.format/rsshub-heading-id.mjs deleted file mode 100644 index 8a5daf77c3df67..00000000000000 --- a/website/docs/.format/rsshub-heading-id.mjs +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @typedef {import('mdast').Heading} Heading - */ - -import { pinyin } from 'pinyin-pro'; -// import { visit } from 'unist-util-visit'; -import { visitParents } from 'unist-util-visit-parents'; - -const slugify = (/** @type {string} */ s) => { - s = s?.replace(/[!"#&'()+,./:[\]_|’“”、「」・().:|]/g, '-'); - return encodeURIComponent( - pinyin(s, { - nonZh: 'consecutive', - toneType: 'none', - type: 'array', - v: true, - }) - .join(' ') - .trim() - .toLowerCase() - .replace(/\s+/g, '-') - .replace(/-+/g, '-') - .replace(/(^-|-$)/g, '') - ); -}; - -// const findAllHeadings = (tree) => { -// /** @type {Heading[]} */ -// const headings = []; -// visit(tree, 'heading', (node) => { -// headings.push(node); -// }); -// return headings; -// }; - -const extractIdString = (node) => node.children.map((child) => child?.value ?? '').join(''); - -export default function remarkRssHubHeadingId(options = { overwrite: false }) { - return (mdast) => { - // const flatHeadings = findAllHeadings(mdast); - visitParents(mdast, 'heading', (node, ancestors) => { - if (node.depth === 2) { - const idString = extractIdString(node); - - node.data ||= {}; - node.data.hProperties ||= {}; - if (options.overwrite) { - node.data.id = node.data.hProperties.id = slugify(idString); - } - } else if (node.depth > 2) { - // const currentHeadingIndex = flatHeadings.indexOf(node); - // let prevHeading; - // for (let i = currentHeadingIndex - 1; i >= 0; i--) { - // if (flatHeadings[i].depth < node.depth) { - // prevHeading = flatHeadings[i]; - // break; - // } - // } - // Do not add heading ids to headings that are children of JSX elements (i.e. components, details, admonitions, etc.) - // since they will be parsed as JSX expressions and cause errors. - - const parentNode = ancestors[ancestors.length - 1]; - const nodeIndex = parentNode.children.indexOf(node); - let prevHeading; - - for (let i = nodeIndex - 1; i >= 0; i--) { - if (parentNode.children[i]?.depth < node.depth && parentNode.children[i]?.type === 'heading') { - prevHeading = parentNode.children[i]; - break; - } - } - - if (options.overwrite && prevHeading) { - const idString = extractIdString(node); - - node.data ||= {}; - node.data.hProperties ||= {}; - node.data.id = node.data.hProperties.id = prevHeading.data.id + '-' + slugify(idString); - } - } - }); - }; -} diff --git a/website/docs/.format/rsshub-no-dupe-attrs.mjs b/website/docs/.format/rsshub-no-dupe-attrs.mjs deleted file mode 100644 index 3673e50087c2d9..00000000000000 --- a/website/docs/.format/rsshub-no-dupe-attrs.mjs +++ /dev/null @@ -1,22 +0,0 @@ -import { visit } from 'unist-util-visit'; - -export default function RssHubNoDupeAttrs() { - return (mdast, file) => { - visit(mdast, 'mdxJsxFlowElement', (node) => { - const attributes = node.attributes; - const attributeNames = attributes.map((attr) => attr.name); - const uniqueAttributeNames = new Set(attributeNames); - if (attributeNames.length !== uniqueAttributeNames.size) { - file.fail(`The attributes of the component "${node.name}" are not unique.`, { - ancestors: [node], - ruleId: 'rsshub-no-dupe-attrs', - source: 'rsshub-no-dupe-attrs', - place: { - start: node.position.start, - end: node.position.end, - }, - }); - } - }); - }; -} diff --git a/website/docs/.format/rsshub-route-level.mjs b/website/docs/.format/rsshub-route-level.mjs deleted file mode 100644 index d1a5cc35ae28a6..00000000000000 --- a/website/docs/.format/rsshub-route-level.mjs +++ /dev/null @@ -1,23 +0,0 @@ -import { visitParents } from 'unist-util-visit-parents'; - -export default function remarkRssHub() { - return (mdast, file) => { - visitParents(mdast, 'mdxJsxFlowElement', (node, ancestors) => { - const parentNode = ancestors[ancestors.length - 1]; - const nodeIndex = parentNode.children.indexOf(node); - const previousNode = parentNode.children[nodeIndex - 1]; - - if (node.name === 'Route' && previousNode?.type === 'heading' && previousNode?.depth < 3) { - file.fail('The heading before the Route tag should be a level 3 heading.', { - ancestors: [node], - ruleId: 'rsshub-route-level', - source: 'rsshub-route-level', - place: { - start: node.position.start, - end: node.position.end, - }, - }); - } - }); - }; -} diff --git a/website/docs/.format/slugId.mjs b/website/docs/.format/slugId.mjs deleted file mode 100644 index 7ab74b8e941652..00000000000000 --- a/website/docs/.format/slugId.mjs +++ /dev/null @@ -1,46 +0,0 @@ -import { pinyin } from 'pinyin-pro'; - -const slugify = (s) => { - s = s?.replace(/[#&'()+,/:[\]|’“”、「」・().:|]/g, '-'); - return encodeURIComponent( - pinyin(s, { - nonZh: 'consecutive', - toneType: 'none', - type: 'array', - v: true, - }) - .join(' ') - .trim() - .toLowerCase() - .replace(/\s+/g, '-') - .replace(/-+/g, '-') - .replace(/(^-|-$)/g, '') - ); -}; - -export default { - rules: (list) => list.filter((e) => e), - handler: async (data) => { - const content = data.split('\n'); - let lastH2 = ''; - let lastH3 = ''; - - for (let i = 0; i < content.length; i++) { - if (content[i].startsWith('## ')) { - lastH2 = content[i].match(`## (([^{])*)`)?.[1].trim(); - - content[i] = `## ${lastH2} {#${slugify(lastH2)}}`; - } else if (content[i].startsWith('### ')) { - lastH3 = content[i].match(`### (([^{])*)`)?.[1].trim(); - - content[i] = `### ${lastH3} {#${slugify(lastH2)}-${slugify(lastH3)}}`; - } else if (content[i].startsWith('#### ')) { - const title = content[i].match(`#### (([^{])*)`)?.[1].trim(); - - content[i] = `#### ${title} {#${slugify(lastH2)}-${slugify(lastH3)}-${slugify(title)}}`; - } - } - - return Promise.resolve(content.join('\n')); - }, -}; diff --git a/website/docs/.format/sortByHeading.mjs b/website/docs/.format/sortByHeading.mjs deleted file mode 100644 index 18fa95be6c2c3e..00000000000000 --- a/website/docs/.format/sortByHeading.mjs +++ /dev/null @@ -1,56 +0,0 @@ -import file from './file.mjs'; -const pinyinCompare = new Intl.Collator('zh-Hans-CN-u-co-pinyin').compare; -const isASCII = (str) => /^[\x00-\x7F]*$/.test(str); - -export default { - rules: (list) => list.filter((e) => e.type === file.ROUTE_TYPE), - handler: async (data) => { - const content = data.split('\n'); - const blocks = []; - const h1 = []; - - let i = 0; - while (i < content.length) { - const m = /^##\s*(.*)$/.exec(content[i]); - if (m) { - const b = { - title: m[1], - content: [], - }; - - b.content.push(content[i]); - i++; - while (i < content.length && !/^##\s.*$/.test(content[i])) { - b.content.push(content[i]); - i++; - } - blocks.push(b); - } else { - h1.push(content[i]); - i++; - } - } - - let newContent = blocks - .sort((a, b) => { - const ia = isASCII(a.title[0]); - const ib = isASCII(b.title[0]); - if (ia && ib) { - return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : 1; - } else if (ia || ib) { - return ia > ib ? -1 : 1; - } else { - return pinyinCompare(a.title, b.title); - } - }) - .map((x) => x.content.join('\n')) - .join('\n'); - if (newContent) { - h1.push(newContent); - } - - newContent = h1.join('\n'); - - return Promise.resolve(newContent); - }, -}; diff --git a/website/docs/.format/tojson.js b/website/docs/.format/tojson.js deleted file mode 100644 index 066f69e3457c0e..00000000000000 --- a/website/docs/.format/tojson.js +++ /dev/null @@ -1,132 +0,0 @@ -const fs = require('fs'); - -function parse(data) { - const lines = data.split('\n'); - - const result = { - h1: '', - h2: [], - }; - let current = ''; - - lines.forEach((line) => { - if (line.startsWith('# ')) { - result.h1 = line.replace(/^# /, ''); - result.h1 = result.h1.replace(/ {([^}])*}$/, ''); - } else if (line.startsWith('## ')) { - let h2 = line.replace(/^## /, ''); - // h2 = h2.replace(/ {([^}])*}$/, ''); - current = { - h2, - content: '', - h3: [], - }; - result.h2.push(current); - } else if (line.startsWith('### ')) { - let h3 = line.replace(/^### /, ''); - // h3 = h3.replace(/ {([^}])*}$/, ''); - current = { - h3, - content: '', - }; - result.h2[result.h2.length - 1].h3.push(current); - } else if (current) { - current.content += line + '\n'; - } - }); - - result.h2.forEach((item) => { - item.content = item.content.trim(); - item.h3.forEach((h3) => { - h3.content = h3.content.trim(); - h3.id = h3.content.match(/path="([^"]+)"/)?.[1]; - if (!h3.id) { - console.log('no id', h3.content); - } - }); - }); - - return result; - - // console.log(JSON.stringify(result, null, 2)); -} - -function parseMd(name) { - const cn = fs.readFileSync(`./docs/routes/${name}.md`, 'utf8'); - const cnParsed = parse(cn); - - // const en = fs.readFileSync(`./i18n/en/docusaurus-plugin-content-docs/current/routes/${name}.md`, 'utf8') - // const enParsed = parse(en); - - // cnParsed.h1 = enParsed.h1 - - // enParsed.h2.forEach((item, index) => { - // item.h3.forEach((h3) => { - // if (h3.id) { - // let found = false - // cnParsed.h2.forEach((cnitem, index) => { - // cnitem.h3.forEach((cnh3) => { - // if (!found && cnh3.id === h3.id) { - // found = true - // console.log('found', h3.id) - // cnh3.content = h3.content - // cnh3.h3 = h3.h3 - // cnitem.content = item.content - // cnitem.h2 = item.h2 - // } - // }) - // }) - // if (!found) { - // console.log('not found', h3.id) - // cnParsed.h2.push(item) - // } - // } - // }) - // }) - - let newContent = `# ${cnParsed.h1}\n\n`; - cnParsed.h2.forEach((item) => { - newContent += `## ${item.h2}\n\n`; - if (item.content) { - newContent += `${item.content}\n\n`; - } - item.h3.forEach((h3) => { - newContent += `### ${h3.h3}\n\n`; - newContent += `${h3.content}\n\n`; - }); - }); - fs.writeFile(`./docs/routes/${name}.md`, newContent, (err) => { - if (err) throw err; - console.log('The file has been saved!'); - }); - // fs.writeFile(`./docs/routes/${name}.json`, JSON.stringify(cnParsed, null, 2), (err) => { - // if (err) throw err; - // console.log('The file has been saved!'); - // }); -} - -[ - 'routes/social-media', - 'routes/new-media', - 'routes/traditional-media', - 'routes/bbs', - 'routes/blog', - 'routes/programming', - 'routes/design', - 'routes/live', - 'routes/multimedia', - 'routes/picture', - 'routes/anime', - 'routes/program-update', - 'routes/university', - 'routes/forecast', - 'routes/travel', - 'routes/shopping', - 'routes/game', - 'routes/reading', - 'routes/government', - 'routes/study', - 'routes/journal', - 'routes/finance', - 'routes/other', -].map((name) => parseMd(name.replace(/^routes\//, '')));