Skip to content

Commit cf80af6

Browse files
refactor: Improve modem reachability check by adjusting timeout and API endpoint, and update README download link text.
1 parent 1b2bc46 commit cf80af6

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
> [!TIP]
4141
> ![Latest Version](https://img.shields.io/github/v/release/alrescha79-cmd/huawei-manager-mobile?label=Latest%20Version&color=brightgreen) ![Downloads](https://img.shields.io/github/downloads/alrescha79-cmd/huawei-manager-mobile/latest/total?style=flat&logo=android&label=Download@Latest&color=)
4242
>
43-
> **📥 Download di [Github Releases](https://github.com/alrescha79-cmd/huawei-manager-mobile/releases/latest)** Tersedia 3 versi untuk Android
43+
> **📥 Lihat Changelog dan Download di [Github Releases](https://github.com/alrescha79-cmd/huawei-manager-mobile/releases/latest)** Tersedia 3 versi untuk Android
4444
4545
> **![Downloads arm64-v8a](https://img.shields.io/github/downloads/alrescha79-cmd/huawei-manager-mobile/latest/huawei-manager-arm64-v8a.apk?style=flat&logo=android&label=Downloads&color=)** Untuk Android 64-bit (Rekomendasi) → [Link Download](https://github.com/alrescha79-cmd/huawei-manager-mobile/releases/latest/download/huawei-manager-arm64-v8a.apk)
4646
>

src/services/network.service.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,25 @@ export class NetworkService {
7070
/**
7171
* Check if modem is reachable at given IP with timeout
7272
*/
73-
async isModemReachable(modemIp: string, timeoutMs: number = 3000): Promise<boolean> {
73+
async isModemReachable(modemIp: string, timeoutMs: number = 10000): Promise<boolean> {
7474
try {
7575
const controller = new AbortController();
7676
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
7777

78-
const response = await fetch(`http://${modemIp}/html/home.html`, {
79-
method: 'HEAD',
78+
const response = await fetch(`http://${modemIp}/api/webserver/SesTokInfo`, {
79+
method: 'GET',
8080
signal: controller.signal,
8181
});
8282

8383
clearTimeout(timeoutId);
84-
return response.ok || response.status === 401 || response.status === 403;
85-
} catch (error) {
86-
console.log('[Network] Modem not reachable:', modemIp);
84+
console.log('[Network] Modem reachable, status:', response.status);
85+
return true;
86+
} catch (error: any) {
87+
if (error.name === 'AbortError') {
88+
console.log('[Network] Modem check timeout:', modemIp);
89+
} else {
90+
console.log('[Network] Modem not reachable:', modemIp, error.message);
91+
}
8792
return false;
8893
}
8994
}

0 commit comments

Comments
 (0)