Skip to content
This repository has been archived by the owner on Sep 10, 2023. It is now read-only.

Commit

Permalink
fix: 修复简书部分页面没有去除重定向 close #199
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Mar 23, 2020
1 parent d3021b1 commit 3d8c78b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.ts
Expand Up @@ -146,6 +146,7 @@ app
},
{
// 测试地址: https://www.jianshu.com/p/979776ca44b8
// https://www.jianshu.com/p/fc8abc65bbb2
name: "简书",
test: /www\.jianshu\.com/,
provider: JianShuProvider
Expand Down
18 changes: 14 additions & 4 deletions src/sites/jianshu.ts
@@ -1,9 +1,19 @@
import { IProvider } from "../provider";
import { antiRedirect } from "../utils";
import { IProvider } from '../provider'
import { antiRedirect } from '../utils'

export class JianShuProvider implements IProvider {
public test = /links\.jianshu\.com\/go/;
public test = (aElement: HTMLAnchorElement) => {
const isLink1 = /links\.jianshu\.com\/go/.test(aElement.href)
const isLink2 = /link\.jianshu\.com(\/)?\?t=/.test(aElement.href)

if (isLink1 || isLink2) {
return true
}

return false
}
public resolve(aElement: HTMLAnchorElement) {
antiRedirect(aElement, new URL(aElement.href).searchParams.get("to"));
const search = new URL(aElement.href).searchParams
antiRedirect(aElement, search.get('to') || search.get('t'))
}
}

0 comments on commit 3d8c78b

Please sign in to comment.