Skip to content

Conversation

@cyfung1031
Copy link
Collaborator

概述

变更内容

截图

@CodFrm
Copy link
Member

CodFrm commented Oct 26, 2025

这个问题就不修复先,下个版本(1.3)和 #842 一起吧

@CodFrm CodFrm changed the title #876 修复 无法通过GitHub链接安装脚本 Oct 28, 2025
@cyfung1031
Copy link
Collaborator Author

这个问题就不修复先,下个版本(1.3)和 #842 一起吧

#842 里有包含这个修改
你可以直接 review & 合并 842

@CodFrm
Copy link
Member

CodFrm commented Oct 29, 2025

这个问题就不修复先,下个版本(1.3)和 #842 一起吧

#842 里有包含这个修改 你可以直接 review & 合并 842

内容有点多,现在v1.2只做bug修复了,新功能下一个版本吧

@cyfung1031
Copy link
Collaborator Author

这个问题就不修复先,下个版本(1.3)和 #842 一起吧

#842 里有包含这个修改 你可以直接 review & 合并 842

内容有点多,现在v1.2只做bug修复了,新功能下一个版本吧

#842 改的内容主要是 install UI (css)
不影响正常操作
随你吧

requestMethods: ["get" as chrome.declarativeNetRequest.RequestMethod],
};
const browserType = getBrowserType();
if (browserType.chrome && browserType.chromeVersion >= 128) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

responseHeaders与excludedResponseHeaders 都需要 >= 128 的版本,是不打算兼容旧版本的浏览器了么?(虽然我也想,恶心的兼容性) https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest?hl=zh-cn#:~:text=main_frame%20%E8%B5%84%E6%BA%90%E7%B1%BB%E5%9E%8B%E3%80%82-,responseHeaders,-HeaderInfo%5B%5D%C2%A0%E5%8F%AF

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不使用 excludedResponseHeaders

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CodFrm
Copy link
Member

CodFrm commented Oct 30, 2025

这样做有问题,这样的话,这种链接也会跳转到脚本安装页:https://github.com/scriptscat/scriptcat/blob/main/example/vscode.user.js

简单整理一下 github有下面这些链接,你的做法处理代码页有问题,之前我的做法处理 Release 文件数据有问题,可能需要考虑针对github编写规则,或者其它实现方式

期望 页面 链接 Content Type
代码页 https://github.com/scriptscat/scriptcat/blob/main/example/vscode.user.js text/html
代码数据302跳转 https://github.com/scriptscat/scriptcat/raw/refs/heads/main/example/vscode.user.js text/html
代码数据 https://raw.githubusercontent.com/scriptscat/scriptcat/refs/heads/main/example/vscode.user.js text/plain
Release 文件302跳转 https://github.com/MapoMagpie/comic-looms/releases/download/4.12.9/comic-looms.user.js text/html
Release 文件数据 https://release-assets.githubusercontent.com/github-production-release-asset/244410282/f9c8dabc-66e0-45b4-b3cd-5bd98d8c4b33?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-10-30T10%3A31%3A40Z&rscd=attachment%3B+filename%3Dcomic-looms.user.js&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-10-30T09%3A30%3A54Z&ske=2025-10-30T10%3A31%3A40Z&sks=b&skv=2018-11-09&sig=77dAI8%2FgZoEeP%2FEkr52c%2FSev7PvGAnqHyIu9CtP0hLk%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc2MTgxNzIwMSwibmJmIjoxNzYxODE2OTAxLCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.pcwsD44ukMzcKcrajFXlmTtemFeB1VMFce7J7b-iZV8&response-content-disposition=attachment%3B%20filename%3Dcomic-looms.user.js&response-content-type=application%2Foctet-stream application/octet-stream

@CodFrm
Copy link
Member

CodFrm commented Oct 30, 2025

我试了一下,chrome.webNavigation.onBeforeNavigate + chrome.tabs.update 似乎也可以实现类似效果,🤔这样的话,可以写复杂一些的规则,特殊处理?

我看了一下其它的:

https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md -> https://gitlab.com/gitlab-org/gitlab/-/raw/master/README.md

https://gitea.com/gitea/act_runner/src/branch/main/README.md -> https://gitea.com/gitea/act_runner/raw/branch/main/README.md

    chrome.webNavigation.onBeforeNavigate.addListener((nav) => {
      console.log("onBeforeNavigate", nav);
      if (nav.url.endsWith(".user.js") && !nav.url.includes("script_installation")) {
        // 处理 user.js 脚本
        chrome.tabs.update(nav.tabId, {
          url: `${DocumentationSite}${localePath}/docs/script_installation/#url=${nav.url}`,
        });
      }
    });

@cyfung1031
Copy link
Collaborator Author

我试了一下,chrome.webNavigation.onBeforeNavigate + chrome.tabs.update 似乎也可以实现类似效果,🤔这样的话,可以写复杂一些的规则,特殊处理?

我看了一下其它的:

https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md -> https://gitlab.com/gitlab-org/gitlab/-/raw/master/README.md

https://gitea.com/gitea/act_runner/src/branch/main/README.md -> https://gitea.com/gitea/act_runner/raw/branch/main/README.md

    chrome.webNavigation.onBeforeNavigate.addListener((nav) => {
      console.log("onBeforeNavigate", nav);
      if (nav.url.endsWith(".user.js") && !nav.url.includes("script_installation")) {
        // 处理 user.js 脚本
        chrome.tabs.update(nav.tabId, {
          url: `${DocumentationSite}${localePath}/docs/script_installation/#url=${nav.url}`,
        });
      }
    });

不要這樣搞
性能問題

用dnr就行

我提交的代碼沒有相容性問題

@CodFrm
Copy link
Member

CodFrm commented Oct 30, 2025

不要這樣搞 性能問題

用dnr就行

我提交的代碼沒有相容性問題

确实dnr的更好,那可能就需要再多条规则去处理 Github/Gitlab/Gitea 代码页的问题。

兼容性问题,你看我后续的回复 #877 (comment)

@cyfung1031
Copy link
Collaborator Author

不要這樣搞 性能問題
用dnr就行
我提交的代碼沒有相容性問題

确实dnr的更好,那可能就需要再多条规则去处理 Github/Gitlab/Gitea 代码页的问题。

兼容性问题,你看我后续的回复 #877 (comment)

改了

cyfung1031 added a commit to cyfung1031/scriptcat that referenced this pull request Nov 3, 2025
cyfung1031 added a commit to cyfung1031/scriptcat that referenced this pull request Nov 3, 2025
@cyfung1031 cyfung1031 marked this pull request as draft November 5, 2025 12:22
cyfung1031 added a commit to cyfung1031/scriptcat that referenced this pull request Nov 5, 2025
@cyfung1031
Copy link
Collaborator Author

这个问题就不修复先,下个版本(1.3)和 #842 一起吧

#842

@CodFrm
Copy link
Member

CodFrm commented Nov 15, 2025

这个问题就不修复先,下个版本(1.3)和 #842 一起吧

#842 里有包含这个修改 你可以直接 review & 合并 842

内容有点多,现在v1.2只做bug修复了,新功能下一个版本吧

我的问题,看起来得重新打开 合并修复了

@cyfung1031 cyfung1031 marked this pull request as ready for review November 15, 2025 15:40
@cyfung1031
Copy link
Collaborator Author

这个问题就不修复先,下个版本(1.3)和 #842 一起吧

#842 里有包含这个修改 你可以直接 review & 合并 842

内容有点多,现在v1.2只做bug修复了,新功能下一个版本吧

我的问题,看起来得重新打开 合并修复了

你喜欢吧

@cyfung1031
Copy link
Collaborator Author

@CodFrm CodFrm merged commit b9268e7 into scriptscat:main Nov 16, 2025
2 of 3 checks passed
@cyfung1031
Copy link
Collaborator Author

close #876

excludedRequestDomains: ["github.com", "gitlab.com", "gitea.com", "bitbucket.org"], // Chrome 101+
},
{
regexFilter: "^(.+?\\.user(\\.bg|\\.sub)?\\.js&response-content-type=application%2Foctet-stream)",
Copy link
Member

@CodFrm CodFrm Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种应该是可以不匹配的(不过无所谓,可以少点规则)

CodFrm added a commit that referenced this pull request Nov 20, 2025
* 不依赖外部网站访问进行安装

* Update script.ts

* 修正 fetchScriptBody

* css

* css

* css

* i18n t

* css

* css

* 显示 7.5 个项目来提醒使用者以滚动浏览更多

* 空白调整

* .

* 兼容修正

* #876

* lint

* i18n

* #877

* #877 修正

* 合并

* typescript fix

* Update src/locales/de-DE/translation.json

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/pages/install/App.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/pages/install/App.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chrome.runtime.lastError

* fix

* 中文

* formatBytes

* 整理代码和添加单元测试

* 修复typecheck

* 添加dels测试

---------

Co-authored-by: 王一之 <yz@ggnb.top>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotfix 需要尽快更新到扩展商店 P0 🚑 需要紧急处理的内容

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants