diff --git a/loopx/extensions/lark/app_setup.py b/loopx/extensions/lark/app_setup.py index d72ec98899..788698e547 100644 --- a/loopx/extensions/lark/app_setup.py +++ b/loopx/extensions/lark/app_setup.py @@ -20,6 +20,7 @@ _OFFICIAL_SETUP_HOSTS = ( "open.feishu.cn", + "open.larksuite.com", "open." + "la" + "rk" + "office.com", ) OFFICIAL_SETUP_URL_PATTERN = re.compile( diff --git a/tests/control_plane_ts/host_stdio_bridge.test.ts b/tests/control_plane_ts/host_stdio_bridge.test.ts index 568289b57f..4ddb19fae1 100644 --- a/tests/control_plane_ts/host_stdio_bridge.test.ts +++ b/tests/control_plane_ts/host_stdio_bridge.test.ts @@ -7,8 +7,9 @@ import {tmpdir} from "node:os"; import {join} from "node:path"; import {setTimeout as delay} from "node:timers/promises"; import test from "node:test"; +import {fileURLToPath} from "node:url"; -const bridge = new URL("../../loopx/control_plane/turn_driver/host_stdio_bridge.ts", import.meta.url).pathname; +const bridge = fileURLToPath(new URL("../../loopx/control_plane/turn_driver/host_stdio_bridge.ts", import.meta.url)); const launch = (script: string) => spawn(process.execPath, ["--no-warnings", "--experimental-strip-types", bridge, process.execPath, "-e", script], {stdio: ["pipe", "pipe", "pipe"]}); diff --git a/tests/extensions/test_lark_app_setup.py b/tests/extensions/test_lark_app_setup.py index cef804e546..5a1547da39 100644 --- a/tests/extensions/test_lark_app_setup.py +++ b/tests/extensions/test_lark_app_setup.py @@ -125,6 +125,34 @@ def test_setup_accepts_the_official_lark_authorization_host() -> None: ) +def test_setup_accepts_the_international_lark_authorization_host() -> None: + verification_url = ( + "https://open.larksuite.com/page/cli?user_code=public-code" + "&lpv=1.0.99&ocv=1.0.99&from=cli" + ) + manager = LarkAppSetupManager( + cli_resolution=LarkCliResolution( + command="fake-lark", + available=True, + source="path", + version="1.0.99", + error_code=None, + ), + process_factory=lambda _args, _env: _FakeProcess([ + "打开以下链接配置应用:\n", + f" {verification_url}\n", + "等待配置应用...\n", + ]), + profile_verifier=lambda app_ref: app_ref == "loopx-lark-bot", + ) + + started = manager.start(app_ref="loopx-lark-bot", brand="lark") + completed = _wait_for_terminal(manager, started["setup_id"]) + + assert completed["status"] == "ready" + assert completed["verification_url"] == verification_url + + def test_cancel_stops_the_registration_process_without_exposing_logs() -> None: process = _BlockingProcess() manager = LarkAppSetupManager(