Skip to content

Commit efa07aa

Browse files
committed
docs: document install provenance boundaries
1 parent 1d1c111 commit efa07aa

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/app/service/service_worker/script.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ export class ScriptService {
323323
action: {
324324
type: "redirect" as chrome.declarativeNetRequest.RuleActionType,
325325
redirect: {
326+
// 直接 URL 入口不经过 UUID 暂存;byWebRequest 只在暂存链路中用于脚本身份匹配,
327+
// 不能再作为安装页 history.back()/window.close() 的来源标记。
326328
regexSubstitution: `${installPageURL}?url=\\1`,
327329
},
328330
},

src/pages/install/useInstallData.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ export function useInstallData(): UseInstallData {
301301
});
302302
const metadata = parseMetadata(code);
303303
if (!metadata) throw new Error(t("install:script_info_load_failed"));
304+
// 直接 URL 入口保持普通脚本准备参数;网页来源身份匹配只由 UUID 暂存选项传递,
305+
// 安装页离开方式统一由 history.length 决定,不要为此重新添加 query 标记。
304306
await loadFromInfo(buildScriptInfo(uuidv4(), code, parsed.href, metadata), false, {});
305307
} else if (fid) {
306308
const handle = await loadHandle(fid);

src/pkg/utils/script.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ export async function prepareScriptByCode(
178178
dao?: ScriptDAO,
179179
options?: {
180180
byEditor?: boolean; // 是否通过编辑器导入
181-
byWebRequest?: boolean; // 是否通过网页连结安装或更新
181+
// 仅控制网页来源脚本的身份匹配,不参与安装页 history.back()/window.close() 决策。
182+
byWebRequest?: boolean;
182183
}
183184
): Promise<{ script: Script; oldScript?: Script; oldScriptCode?: string; oldInTrash?: boolean }> {
184185
dao = dao ?? new ScriptDAO();

0 commit comments

Comments
 (0)