summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLi Zhineng <[email protected]>2025-07-15 21:07:48 +0800
committerLi Zhineng <[email protected]>2025-07-15 21:08:02 +0800
commit28e956fe8898b078ebcb798155a99930b96e14ac (patch)
tree8b4140326dc1f61c3c0e6f49478eee0c7adaf321
parentb63bb1770112673bc41561dfe2cde7d8d83e3a9e (diff)
downloadsetup-28e956fe8898b078ebcb798155a99930b96e14ac.tar.gz
setup-28e956fe8898b078ebcb798155a99930b96e14ac.zip
timeout after 3 seconds
-rw-r--r--main.mjs4
1 files changed, 3 insertions, 1 deletions
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.')