jiacai2050 / gooreplacer

⚡️⚡️A browser extension to modify HTTP requests :-)
https://jiacai2050.github.io/gooreplacer/
1.23k stars 178 forks source link

优化建议 #121

Open hdtopku opened 2 years ago

hdtopku commented 2 years ago
  1. 像掘金这种,url编码或base64编码的,有好多%2,无法进行跳转,能否增加这种处理: https://link.juejin.cn/?target=https%3A%2F%2Fhub.fastgit.xyz%2Falibaba%2Fp3c%2Ftree%2Fmaster%2Fp3c-formatter 我的替换规则是:
    
    https://link\.juejin\.cn/\?target=http(s?)%3A%2F%2F(.*)

http$1://$2


结果跳转不了
2. 能否增加一个pinned issue,专门用来共享广大使用者的规则,每个人都可以分享或借鉴别人的规则
jiacai2050 commented 2 years ago
inkroom commented 2 years ago
  • 第一个可以在 sandbox 里面测试下,看看哪里出了问题

我尝试替换类似的url也是这样,sandbox里替换处理的结果就是url编码后的值,没有处理过。

网页上就是一点动静都没有

要替换的url是

https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Flists.fedoraproject.org%2Farchives%2Flist%2Fdevel%40lists.fedoraproject.org%2Fthread%2FJUJV6BEJAXK5LATTSWGRFZDIAVM7KN4J%2F

规则是:

    {
      "src": "https://www\.oschina\.net/action/GoToLink\?url=(.*)",
      "kind": "regexp",
      "dst": "$1",
      "enable": true
    }

sandbox里提示如下:

匹配成功!https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Flists.fedoraproject.org%2Farchives%2Flist%2Fdevel%40lists.fedoraproject.org%2Fthread%2FJUJV6BEJAXK5LATTSWGRFZDIAVM7KN4J%2F 被重定向到 https%3A%2F%2Flists.fedoraproject.org%2Farchives%2Flist%2Fdevel%40lists.fedoraproject.org%2Fthread%2FJUJV6BEJAXK5LATTSWGRFZDIAVM7KN4J%2F

jiacai2050 commented 2 years ago

sandbox 有提示,说明规则没问题,那么大概率就是插件拿到的地址是没有 url encoding 的,用 encoding 之前的试试看?

hdtopku commented 2 years ago

实测正则匹配出的url是编码后的url,浏览器不支持编码后的url跳转。插件需要在跳转前,把url重新解码,即%2f这些还原为:、/等。其他同类插件有做类似处理,可以优化一下,跟sanbox无关。

---原始邮件--- 发件人: "Jiacai @.> 发送时间: 2022年4月20日(周三) 下午4:13 收件人: @.>; 抄送: @.**@.>; 主题: Re: [jiacai2050/gooreplacer] 优化建议 (Issue #121)

sandbox 有提示,说明规则没问题,那么大概率就是插件拿到的地址是没有 url encoding 的,用 encoding 之前的试试看?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

hdtopku commented 2 years ago

image

如图,其他插件有进行链接解码

Lehmaning commented 1 year ago
  • 第一个可以在 sandbox 里面测试下,看看哪里出了问题

同样的问题。

沙盒测试结果是https://github.com%2Frgripper%2Frusty-bomber,可能因为这个原因,我的 Firefox 没认为这是个有效的 URL,于是就没有重定向……预期结果应该是https://github.com/rgripper/rusty-bomber,然后正常重定向才对。另外,如果 URL 里的中文没有经过解码的话有的网站也只会显示 404,而不是正常的页面。