Skip to content

Conversation

@cyfung1031
Copy link
Collaborator

@cyfung1031 cyfung1031 commented Oct 14, 2025

概述

相关issue #621
同时也处理一下 #748 & #681 (comment) 吧 (后续补充:#876

以前有提过,应该不用访问外部网站进行安装 ( #705
现在做了一个草稿方案
展示如何实现

由于只是简单示范,所以使用了 location.replace 相容现行设计
( script_installation_page.html#url=... -> install.html?uuid=... )
有需要的话你也可以代码调整

你有空再看看吧
另外用 webNavigation 可以直接做 host path 比对
而且不是看 resource 所以处理量也少一点吧
chrome.webNavigation.onBeforeNavigate.addListener 也是不用理会连网问题)

那个 script_installation_page.html 是很简陋的。你有需要再改
(Arco Design, i18n 什么的)

注: 没 web_accessible_resources 的话,脚本安装点击页不能跳到 扩充的页面


另一个好处是,内部页面可以展示错误,例如无法下载脚本内容/资源之类
当然你也可以整合至 install.html, 例如 没uuid 但有 url,然后错误之类在 install.html 显示
我记得 做假uuid 是TM为了,内容改了后,uuid 不变的话,cache有两份。因此可以有两个版本的安装页开著。

看你怎么处理吧

变更内容

截图

Comment on lines 48 to 58
<h1>Script Installation</h1>
<p>This page is used as an intermediate step to install a new user script in ScriptCat.</p>

<h2>Script Resources</h2>
<h3 class="downloading"><div>Downloading</div><div class="loader"></div></h3>
<h3 class="error-message"></h3>

<h2>Remarks</h2>

<p>After the Script Resources Downloading is complete, this page should be automatically redirected.</p>
<p>This page is not suitable for direct viewing. If necessary, please visit Installation Script.</p>
Copy link
Member

@CodFrm CodFrm Oct 14, 2025

Choose a reason for hiding this comment

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

需要i18n,可以考虑再用React做一个页面


其它想法:不在 chrome.webNavigation.onBeforeNavigate.addListener 监听扩展中的这个中间页,可以直接在这里展示脚本下载进度之类,不过目前先这样即可

Copy link
Collaborator Author

@cyfung1031 cyfung1031 Oct 14, 2025

Choose a reason for hiding this comment

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

你看是把 scriptcat.org 那个抄过来,还是做一个新页面,还是结合原有 install.html 吧

结合 原有 install.html 的话就减少一层中间页。
然后 pages/install/ 里面用 history replace (或者 react 的方式)把 url 换成 uuid


好像直接用现有的 pages/install/ 再做 ?url=XXXX 的支持最好?
(把url 的东西载好后换成 uuid )
你怎么看

Copy link
Member

Choose a reason for hiding this comment

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

一步到位的话就是结合原有install.html页面,但是改动有点过大了,需要处理下载进度之类的问题,感觉算一个较大的功能点了,可以下一个版本(1.3)做(目前准备修修bug,发布1.2)

看看把这个PR作为草稿,后续再来处理,还是先合了,后面再提交新的PR

Copy link
Member

Choose a reason for hiding this comment

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

我觉得可以,直接用现有的pages/install/,然后支持 ?url=xxxx

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

你可以先发布 1.2
现在的代码应该是没问题的
这个改动留待下一次

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

我觉得可以,直接用现有的pages/install/,然后支持 ?url=xxxx

ok

Comment on lines 166 to 175
// { hostEquals: "docs.scriptcat.org", pathPrefix: "/docs/script_installation/" },
// { hostEquals: "docs.scriptcat.org", pathPrefix: "/en/docs/script_installation/" },
Copy link
Member

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.

这个规则保留吧

ok

@cyfung1031 cyfung1031 marked this pull request as draft October 14, 2025 04:29
@cyfung1031
Copy link
Collaborator Author

PR内容有共识

  • 用现有的页面做url处理,不用中间页
  • 相容TM和SC以前的URL处理

1.2 或 1.3 取决于什么时候完成PR检讨。非BUG修补不急
PR内容待修改

@cyfung1031 cyfung1031 marked this pull request as ready for review October 18, 2025 09:40
@cyfung1031 cyfung1031 force-pushed the pr-network-1003 branch 3 times, most recently from ba78680 to 02b9957 Compare October 18, 2025 09:46
@cyfung1031
Copy link
Collaborator Author

顺便把 install 页面的布局问题都修了

@cyfung1031
Copy link
Collaborator Author

cyfung1031 commented Oct 18, 2025

進入時

Screenshot 2025-10-18 at 20 00 45

往下滑動看代碼時
Screenshot 2025-10-18 at 20 00 56


自適應布局

Screenshot 2025-10-18 at 20 10 49 Screenshot 2025-10-18 at 20 11 09
  • 脚本将在下面的网站中运行
  • 脚本将获得以下地址的完整访问权限
  • 脚本引用了下列外部资源

等部份显示首 7.5 项。如有第8项,只会显示半个,因此可提醒用户滚动浏览更多

Screenshot 2025-10-18 at 22 13 39

数据下载显示

screen-capture.3.webm

@cyfung1031 cyfung1031 changed the title 不依赖外部网站访问进行安装 不依赖外部网站访问进行安装 + 安装页版面调整 Oct 18, 2025
@CodFrm CodFrm added the P1 🔥 重要但是不紧急的内容 label Oct 26, 2025
@cyfung1031
Copy link
Collaborator Author

cyfung1031 commented Nov 5, 2025

@CodFrm GitHub链接问题,TM也是一个个做特殊处理。没办法。
另外改用 sessionRule. SC的设计是浏览器启动就设定,不需要dynamic做永久rule
dynamic rule 在浏览器重启还会保留。做版本升级时要移除旧的,很麻烦

@cyfung1031 cyfung1031 added the UI/UX 页面操作/显示相关 label Nov 6, 2025
@CodFrm CodFrm changed the base branch from main to release/v1.3 November 8, 2025 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 🔥 重要但是不紧急的内容 UI/UX 页面操作/显示相关

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants