Skip to content

Commit

Permalink
feat(remove-redirect): 适配 ACG 盒子
Browse files Browse the repository at this point in the history
  • Loading branch information
maomao1996 committed Sep 20, 2024
1 parent 17dcd66 commit 261b4a3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-pears-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'remove-redirect': minor
---

适配 ACG 盒子
4 changes: 2 additions & 2 deletions packages/remove-redirect/metablock.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "跳转链接修复(移除重定向外链直达)",
"name:zh-CN": "跳转链接修复(移除重定向外链直达)",
"name:zh-TW": "跳转链接修复(移除重定向外链直达",
"name:zh-TW": "跳轉連結修復(移除重定向外鏈直達",
"name:en": "Remove Redirect",
"namespace": "maomao1996.remove-redirect",
"version": "1.12.0",
"description": "提升用户体验:修复跳转链接为站外直链(移除重定向直接跳转),免去拦截页面点击步骤可直达站外;拦截页面自动跳转(无须额外操作);已适配爱发电、百度搜索、百度贴吧、Bing 搜索、书签地球、酷安、CSDN、豆瓣、Facebook、码云、Google 搜索、Google 重定向页、花瓣网、InfoQ、Instagram、简书、掘金、金山文档、链滴、力扣(Leetcode)、51CTO 博客、NGA 玩家社区、牛客网、开源中国、pixiv、微信、微信开放社区、QQ 邮箱、PC 版 QQ、腾讯文档、腾讯兔小巢、石墨文档、360 搜索、搜狗搜索、少数派、腾讯云开发者社区、推特(Twitter)、微博、YouTube、语雀、知乎、知乎专栏",
"description": "提升用户体验:修复跳转链接为站外直链(移除重定向直接跳转),免去拦截页面点击步骤可直达站外;拦截页面自动跳转(无须额外操作);已适配ACG盒子、爱发电、百度搜索、百度贴吧、Bing 搜索、书签地球、酷安、CSDN、豆瓣、Facebook、码云、Google 搜索、Google 重定向页、花瓣网、InfoQ、Instagram、简书、掘金、金山文档、链滴、力扣(Leetcode)、51CTO 博客、NGA 玩家社区、牛客网、开源中国、pixiv、微信、微信开放社区、QQ 邮箱、PC 版 QQ、腾讯文档、腾讯兔小巢、石墨文档、360 搜索、搜狗搜索、少数派、腾讯云开发者社区、推特(Twitter)、微博、YouTube、语雀、知乎、知乎专栏",
"author": "",
"homepage": "",
"supportURL": "",
Expand Down
35 changes: 35 additions & 0 deletions packages/remove-redirect/src/sites/acgbox.link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { validateUrl } from '@femm/shared-utils'
import { defineSite } from 'src/utils'

/******************************************************************************
** ACG盒子
** - https://www.acgbox.link
** - https://www.acgbox.link/h/58.html
** - https://www.acgbox.link/go/?url=aHR0cHM6Ly93d3cucGl4aXYubmV0Lw%3D%3D
******************************************************************************/
const sites = [
defineSite([
'ACG盒子',
'acgbox.link',
{
transform: {
selector: 'a[href*="/go/?url"]',
customTransform(node) {
let originUrl = decodeURIComponent(node.href.split('?url=')[1])
try {
originUrl = atob(originUrl)
if (validateUrl(originUrl)) {
node.href = originUrl
}
} catch {}
},
},
autojump: {
validator: ({ pathname }) => pathname === '/go/',
selector: 'a.loading-btn',
},
},
]),
]

export default sites
1 change: 1 addition & 0 deletions packages/remove-redirect/src/sites/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { default as m_51CtoCom } from './51cto.com'
export { default as acgboxLink } from './acgbox.link'
export { default as afdianCom } from './afdian.com'
export { default as baiduCom } from './baidu.com'
export { default as bingCom } from './bing.com'
Expand Down

0 comments on commit 261b4a3

Please sign in to comment.