diff --git a/pc-sdk-probe.sh b/pc-sdk-probe.sh index afb5579..24f210d 100755 --- a/pc-sdk-probe.sh +++ b/pc-sdk-probe.sh @@ -205,7 +205,7 @@ cat <<'EOF' } console.warn("[probe] 清理完成,请关闭其它同源标签页后刷新页面并重新登录"); }; - window.__deployTestManualLogin = async ({ userID, token, apiAddr, wsAddr } = {}) => { + window.__deployTestManualLogin = async ({ userID, token, apiAddr, wsAddr, dataDir = "./" } = {}) => { userID = userID || await window.__deployTestReadLocalForage("IM_USERID"); token = token || await window.__deployTestReadLocalForage("IM_TOKEN"); const operationID = `deploy-test-${Date.now()}`; @@ -214,7 +214,7 @@ cat <<'EOF' platformID: 5, apiAddr: apiAddr || `${gatewayOrigin}/api/im`, wsAddr: wsAddr || `${gatewayOrigin.replace(/^http/, "ws")}/msg_gateway`, - dataDir: "./", + dataDir: String(dataDir), logLevel: 5, isLogStandardOutput: true, logFilePath: "./", @@ -230,7 +230,7 @@ cat <<'EOF' console.log(`[probe ${stamp()}] manual login result`, result); return result; }; - window.__deployTestManualInitDB = async (userID) => { + window.__deployTestManualInitDB = async (userID, dataDir = "./") => { userID = userID || await window.__deployTestReadLocalForage("IM_USERID") || "6087132211"; console.log(`[probe ${stamp()}] manual setSqlWasmPath`, "/sql-wasm.wasm"); if (typeof window.setSqlWasmPath === "function") { @@ -244,11 +244,11 @@ cat <<'EOF' console.error(`[probe ${stamp()}] manual setSqlWasmPath failed`, err); } } - console.log(`[probe ${stamp()}] manual initDB start`, { userID, dataDir: "./" }); + console.log(`[probe ${stamp()}] manual initDB start`, { userID, dataDir }); const timeout = new Promise((_, reject) => { setTimeout(() => reject(new Error("manual window.initDB timeout after 15000ms")), 15000); }); - const result = await Promise.race([window.initDB(String(userID), "./"), timeout]); + const result = await Promise.race([window.initDB(String(userID), String(dataDir)), timeout]); console.log(`[probe ${stamp()}] manual initDB result`, result); return result; }; @@ -279,6 +279,11 @@ window.__deployTestManualLogin({ token: "把 console 里 SDK login args 的 token 粘到这里" }) +若默认 dataDir="./" 仍报 initDB timeout,可验证是否是浏览器 IDBFS 路径问题: + +await window.__deployTestManualLogin({ dataDir: "" }) +await window.__deployTestManualInitDB(undefined, "") + 若报 10006 init database invoke javascript timeout,先查看并清理当前站点浏览器数据库: await window.__deployTestListBrowserDBs()