Skip to content

Commit 313f590

Browse files
committed
Revert "🐛 传递网页安装入口标记"
This reverts commit ebc6400.
1 parent 08deb84 commit 313f590

2 files changed

Lines changed: 1 addition & 25 deletions

File tree

src/pages/install/useInstallData.test.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -440,28 +440,6 @@ describe("useInstallData 数据流编排", () => {
440440
expect(result.current.localFile).toBe(false);
441441
});
442442

443-
it("?url= 且 byWebRequest=1 时应把入口标记传给脚本准备流程", async () => {
444-
window.history.replaceState({}, "", "/install.html?byWebRequest=1&url=https://e.com/x.user.js");
445-
const metadata = { name: ["URL脚本"], version: ["1.0.0"] };
446-
(fetchScriptBody as Mock).mockResolvedValue("// url code");
447-
(parseMetadata as Mock).mockReturnValue(metadata);
448-
(prepareScriptByCode as Mock).mockResolvedValue({
449-
script: { name: "URL脚本", metadata, status: SCRIPT_STATUS_ENABLE } as unknown as Script,
450-
});
451-
452-
const { result } = renderHook(() => useInstallData());
453-
await waitFor(() => expect(result.current.state.status).toBe("ready"));
454-
455-
expect(prepareScriptByCode).toHaveBeenCalledWith(
456-
"// url code",
457-
"https://e.com/x.user.js",
458-
undefined,
459-
false,
460-
undefined,
461-
{ byWebRequest: true }
462-
);
463-
});
464-
465443
it("?url= 下载过程中在 loading 状态展示已接收字节与百分比", async () => {
466444
window.history.replaceState({}, "", "/install.html?url=https://e.com/x.user.js");
467445
const metadata = { name: ["URL脚本"], version: ["1.0.0"] };

src/pages/install/useInstallData.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ export function useInstallData(): UseInstallData {
304304
});
305305
const metadata = parseMetadata(code);
306306
if (!metadata) throw new Error(t("install:script_info_load_failed"));
307-
await loadFromInfo(buildScriptInfo(uuidv4(), code, parsed.href, metadata), false, {
308-
byWebRequest: byWebRequestRef.current,
309-
});
307+
await loadFromInfo(buildScriptInfo(uuidv4(), code, parsed.href, metadata), false, {});
310308
} else if (fid) {
311309
const handle = await loadHandle(fid);
312310
if (!handle) throw new Error(t("install:script_info_load_failed"));

0 commit comments

Comments
 (0)