V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Get Google Chrome
Vimium · 在 Chrome 里使用 vim 快捷键
IdontWanToBeBan
V2EX  ›  Chrome

悬赏 300 元,如何在老版本 Chrome 上正常访问 github

  •  
  •   IdontWanToBeBan · 2019-01-15 09:01:29 +08:00 · 3887 次点击
    这是一个创建于 1921 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用老版本的 Chrome 访问 Github 的时候,会收到” github 不再支持你的浏览器“的通告,这个时候,github 的 activities 无法加载,然后 issue 等许多地方都无法被编辑

    我用的是 chrome51

    之前还可以用修改 user-agent 的方法来欺骗一下 Github,但是最近 Github 不知道搞了什么鬼,反正这个方法是没用了,使用了这个方法之后,虽然说 Github 不再有任何提示,但是症状和不修改 user-agent 之前一样

    F12 可以看到如下错误

    Frameworks-be15e106b4a7518f3a8ee2f63fa595ba.js:1 Uncaught SyntaxError: Unexpected token function

    Github-a004f249d4a217e23cc0ccd89aa8f76c.js:1 Uncaught SyntaxError: Unexpected token function

    这俩文件的地址是

    Frameworks-be15e106b4a7518f3a8ee2f63fa595ba.js Github-a004f249d4a217e23cc0ccd89aa8f76c.js

    然后我还去找了下相关的油猴脚本,然后找到了这个

    然而使用之后症状还是一样,只不过错误变了,变成了

    userscript.html?id=7a7d91eb-35b9-4dda-ace0-06e30608174e:77 Refused to load the script 'https://assets-cdn.github.com/assets/frameworks-5cc68fa4a212f8349010ddff8198506c.js' because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' github.githubassets.com"

    所以,各位有什么好主意么?

    PS:请不要劝我升级浏览器了....谢谢,特殊用途

    17 条回复    2019-02-11 23:08:00 +08:00
    IdontWanToBeBan
        1
    IdontWanToBeBan  
    OP
       2019-01-15 09:16:24 +08:00
    忘记说了,油猴脚本是这个 https://github.com/LEORChn/Github_Compat_For_Chrome
    IdontWanToBeBan
        2
    IdontWanToBeBan  
    OP
       2019-01-15 09:24:01 +08:00
    我初步怀疑是 github 的 js 里面用了 chrome 老版本不支持的功能,但具体找不出来不支持的是啥
    whattheh3ll
        3
    whattheh3ll  
       2019-01-15 11:14:28 +08:00
    async/await
    IdontWanToBeBan
        4
    IdontWanToBeBan  
    OP
       2019-01-15 11:33:04 +08:00
    @whattheh3ll 这玩意和处理我这个问题没有什么联系吧,能否具体说下?
    shadowyue
        5
    shadowyue  
       2019-01-15 11:37:38 +08:00
    @IdontWanToBeBan
    人家说的八成是对的,老版本浏览器不支持 async/await
    你上面两个 js 文件都用了这两个关键字
    whattheh3ll
        6
    whattheh3ll  
       2019-01-15 11:37:56 +08:00
    @IdontWanToBeBan 应该是这个版本的 Chrome 不支持这两个关键字吧。看了一下 Github 的代码是有这两个关键字的。关键字的话好像不容易解决。
    shadowyue
        7
    shadowyue  
       2019-01-15 11:38:41 +08:00
    @IdontWanToBeBan
    我觉得你可以试试伪装自己的浏览器是个 ie
    IdontWanToBeBan
        8
    IdontWanToBeBan  
    OP
       2019-01-15 11:51:18 +08:00
    @shadowyue #7 Github 已经全面不支持 IE 了...
    IdontWanToBeBan
        9
    IdontWanToBeBan  
    OP
       2019-01-15 11:51:57 +08:00
    @whattheh3ll #6 我看这个功能是在 Chrome55 之后才支持的...所以真的没有一点办法了么...
    SakuraKuma
        10
    SakuraKuma  
       2019-01-15 12:03:40 +08:00
    装个 firefox.用来上 github..
    abmin521
        11
    abmin521  
       2019-01-15 12:07:29 +08:00 via Android
    开一个虚拟机 装 chrome70 远程过去
    journey0ad
        12
    journey0ad  
       2019-01-15 13:10:01 +08:00
    1.安装这个插件 https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj

    2.然后导入
    {"title":"Github","hideComment":"true","headers":[{"enabled":true,"name":"","value":"","comment":""}],"respHeaders":[{"enabled":true,"name":"Content-Security-Policy","value":"default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com wss://live.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: github.githubassets.com assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src github.githubassets.com assets-cdn.github.com; style-src 'unsafe-inline' github.githubassets.com","comment":""}],"filters":[{"enabled":true,"type":"urls","urlPattern":"https://github.com/*"}],"appendMode":""}

    3.然后再试试那个油猴脚本
    Zy143L
        13
    Zy143L  
       2019-01-15 13:18:17 +08:00
    把 UA 设置为
    "Opera/9.80 (Windows NT 6.1; WOW64; U; en) Presto/2.10.229 Version/11.62"
    你是试试
    IdontWanToBeBan
        14
    IdontWanToBeBan  
    OP
       2019-01-15 13:32:20 +08:00
    @journey0ad #12 还是一样的问题,我怀疑 CSP 错误是假的

    @Zy143L #13 这次错误变了
    send-beacon.js:110Uncaught SyntaxError: Unexpected token function
    installation-repo-selection.js:85Uncaught SyntaxError: Unexpected token function
    这两个文件:
    https://github.githubassets.com/assets/app/assets/modules/github/send-beacon.js
    https://github.githubassets.com/assets/app/assets/modules/github/apps/installation-repo-selection.js
    journey0ad
        15
    journey0ad  
       2019-01-15 14:08:25 +08:00
    似乎是油猴插件与这个修改 Header 的插件冲突,手动执行油猴脚本是可以的
    似乎只能自己写一个插件了,把修改 Header 和执行 JS 封装到一个插件里
    LEORChn
        16
    LEORChn  
       2019-02-11 23:05:01 +08:00
    我本人觉得有必要亲自出面发布一下进度。脚本已从 v1.0.3 更新至 v1.1.1
    新仓库:(油猴脚本合集仓库,旧仓库已不更新)
    https://github.com/LEORChn/GreasyMonkey/tree/master/GithubCompatForChrome
    安装页面:
    https://greasyfork.org/scripts/369095
    LEORChn
        17
    LEORChn  
       2019-02-11 23:08:00 +08:00
    然后还有我本人的博客地址,捐款二维码等等乱七八糟的东西
    https://leorchn.github.io/?about
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   983 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:48 · PVG 06:48 · LAX 15:48 · JFK 18:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.