From 28e956fe8898b078ebcb798155a99930b96e14ac Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Tue, 15 Jul 2025 21:07:48 +0800 Subject: timeout after 3 seconds --- main.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'main.mjs') diff --git a/main.mjs b/main.mjs index 857fd34..3baeaed 100644 --- a/main.mjs +++ b/main.mjs @@ -853,7 +853,9 @@ class SuccessForm extends Form { // We are using HTTP because the domain name is remapped to our local // mock server, and the communication between the device and our mock // server utilizes the HTTP protocol as well. - const response = await fetch(`http://i.airmx.cn/exchange?device=${this.#deviceId}`) + const response = await fetch(`http://i.airmx.cn/exchange?device=${this.#deviceId}`, { + signal: AbortSignal.timeout(3000) + }) if (! response.ok) { throw new Error('Could not retrieve the device key.') -- cgit v1.2.3