Skip to content

Commit 261b4a3

Browse files
committed
feat(remove-redirect): 适配 ACG 盒子
1 parent 17dcd66 commit 261b4a3

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

.changeset/mean-pears-matter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'remove-redirect': minor
3+
---
4+
5+
适配 ACG 盒子

packages/remove-redirect/metablock.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "跳转链接修复(移除重定向外链直达)",
33
"name:zh-CN": "跳转链接修复(移除重定向外链直达)",
4-
"name:zh-TW": "跳转链接修复(移除重定向外链直达",
4+
"name:zh-TW": "跳轉連結修復(移除重定向外鏈直達",
55
"name:en": "Remove Redirect",
66
"namespace": "maomao1996.remove-redirect",
77
"version": "1.12.0",
8-
"description": "提升用户体验:修复跳转链接为站外直链(移除重定向直接跳转),免去拦截页面点击步骤可直达站外;拦截页面自动跳转(无须额外操作);已适配爱发电、百度搜索、百度贴吧、Bing 搜索、书签地球、酷安、CSDN、豆瓣、Facebook、码云、Google 搜索、Google 重定向页、花瓣网、InfoQ、Instagram、简书、掘金、金山文档、链滴、力扣(Leetcode)、51CTO 博客、NGA 玩家社区、牛客网、开源中国、pixiv、微信、微信开放社区、QQ 邮箱、PC 版 QQ、腾讯文档、腾讯兔小巢、石墨文档、360 搜索、搜狗搜索、少数派、腾讯云开发者社区、推特(Twitter)、微博、YouTube、语雀、知乎、知乎专栏",
8+
"description": "提升用户体验:修复跳转链接为站外直链(移除重定向直接跳转),免去拦截页面点击步骤可直达站外;拦截页面自动跳转(无须额外操作);已适配ACG盒子、爱发电、百度搜索、百度贴吧、Bing 搜索、书签地球、酷安、CSDN、豆瓣、Facebook、码云、Google 搜索、Google 重定向页、花瓣网、InfoQ、Instagram、简书、掘金、金山文档、链滴、力扣(Leetcode)、51CTO 博客、NGA 玩家社区、牛客网、开源中国、pixiv、微信、微信开放社区、QQ 邮箱、PC 版 QQ、腾讯文档、腾讯兔小巢、石墨文档、360 搜索、搜狗搜索、少数派、腾讯云开发者社区、推特(Twitter)、微博、YouTube、语雀、知乎、知乎专栏",
99
"author": "",
1010
"homepage": "",
1111
"supportURL": "",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { validateUrl } from '@femm/shared-utils'
2+
import { defineSite } from 'src/utils'
3+
4+
/******************************************************************************
5+
** ACG盒子
6+
** - https://www.acgbox.link
7+
** - https://www.acgbox.link/h/58.html
8+
** - https://www.acgbox.link/go/?url=aHR0cHM6Ly93d3cucGl4aXYubmV0Lw%3D%3D
9+
******************************************************************************/
10+
const sites = [
11+
defineSite([
12+
'ACG盒子',
13+
'acgbox.link',
14+
{
15+
transform: {
16+
selector: 'a[href*="/go/?url"]',
17+
customTransform(node) {
18+
let originUrl = decodeURIComponent(node.href.split('?url=')[1])
19+
try {
20+
originUrl = atob(originUrl)
21+
if (validateUrl(originUrl)) {
22+
node.href = originUrl
23+
}
24+
} catch {}
25+
},
26+
},
27+
autojump: {
28+
validator: ({ pathname }) => pathname === '/go/',
29+
selector: 'a.loading-btn',
30+
},
31+
},
32+
]),
33+
]
34+
35+
export default sites

packages/remove-redirect/src/sites/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { default as m_51CtoCom } from './51cto.com'
2+
export { default as acgboxLink } from './acgbox.link'
23
export { default as afdianCom } from './afdian.com'
34
export { default as baiduCom } from './baidu.com'
45
export { default as bingCom } from './bing.com'

0 commit comments

Comments
 (0)