termux-connecting 1.1.52 → 1.1.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -159,6 +159,24 @@ cmd_connection() {
159
159
  return
160
160
  fi
161
161
 
162
+ echo ""
163
+ echo " ── Cek Ping ke $SSH_HOST ──"
164
+ echo " Ping $SSH_HOST untuk verifikasi..."
165
+ if command -v ping >/dev/null; then
166
+ result=$(timeout 5 ping -c 2 -W 2 "$SSH_HOST" 2>&1)
167
+ loss=$(echo "$result" | awk '/loss/{print $6}' | tr -d '%')
168
+ if [ -n "$loss" ] && [ "$loss" -lt 1 ] 2>/dev/null; then
169
+ rtt=$(echo "$result" | awk -F'/' '/rtt/{print $5}')
170
+ info "HP reachable (RTT: ${rtt}ms)"
171
+ else
172
+ error "HP tidak reachable (packet loss: ${loss:-100}%)"
173
+ echo " Pastikan HP dan PC di jaringan yang SAMA."
174
+ echo " Cek IP dengan termux-connecting --check di HP."
175
+ return
176
+ fi
177
+ fi
178
+ echo ""
179
+
162
180
  # ── Cek Konektifitas ──
163
181
  title "1. Cek Konektifitas"
164
182
  echo " Mencoba koneksi ke ${SSH_USER}@${SSH_HOST}:${SSH_PORT}..."
@@ -1,7 +1,7 @@
1
1
  #!/data/data/com.termux/files/usr/bin/bash
2
2
  set -e
3
3
 
4
- VERSION="1.1.52"
4
+ VERSION="1.1.54"
5
5
 
6
6
  GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; CYAN='\033[0;36m'; NC='\033[0m'
7
7
  info() { echo -e "${GREEN}[✓]${NC} $1"; }
@@ -72,7 +72,6 @@ if $HELP; then
72
72
  exit 0
73
73
  fi
74
74
 
75
- # ─── Mode: Check/Status ───
76
75
  if $CHECK; then
77
76
  echo ""
78
77
  title "TERMUX CONNECTING — Status v${VERSION}"
@@ -235,6 +234,34 @@ fi
235
234
 
236
235
  title "TERMUX CONNECTING v${VERSION} — Setup"
237
236
 
237
+ # ─── Cek Jaringan Diawal ───
238
+ title "Cek Jaringan"
239
+ ip=$(get_ip)
240
+ if [ -z "$ip" ]; then
241
+ error "Tidak ada koneksi WiFi. Setup dibatalkan."
242
+ echo " Hubungkan HP ke WiFi, lalu ulangi: termux-connecting -y"
243
+ exit 1
244
+ fi
245
+ gateway=$(timeout 3 ip route 2>/dev/null | awk '/default via/{print $3}' | head -1)
246
+ if [ -z "$gateway" ] && command -v getprop >/dev/null; then
247
+ iface=$(getprop wifi.interface 2>/dev/null); [ -z "$iface" ] && iface="wlan0"
248
+ gateway=$(getprop dhcp.${iface}.gateway 2>/dev/null)
249
+ fi
250
+ if [ -n "$gateway" ]; then
251
+ result=$(timeout 5 ping -c 2 -W 2 "$gateway" 2>&1)
252
+ loss=$(echo "$result" | awk '/loss/{print $6}' | tr -d '%')
253
+ if [ -n "$loss" ] && [ "$loss" -lt 1 ] 2>/dev/null; then
254
+ info "Jaringan stabil (0% loss) — IP: $ip"
255
+ else
256
+ error "Jaringan tidak stabil (packet loss: ${loss:-100}%)"
257
+ echo " Setup dibatalkan. Perbaiki jaringan lalu ulangi."
258
+ exit 1
259
+ fi
260
+ else
261
+ info "Jaringan terdeteksi — IP: $ip"
262
+ fi
263
+ echo ""
264
+
238
265
  # ─── 1. coreutils & iproute2 ───
239
266
  if ! command -v timeout >/dev/null; then
240
267
  echo " Dibutuhkan: coreutils (untuk timeout)"
@@ -376,25 +403,19 @@ if [ -n "$IP" ]; then
376
403
  echo " Gateway: $gateway"
377
404
  result=$(timeout 5 ping -c 2 -W 2 "$gateway" 2>&1)
378
405
  loss=$(echo "$result" | awk '/loss/{print $6}' | tr -d '%')
379
- rtt=$(echo "$result" | awk -F'/' '/rtt/{print $5}')
380
- if [ -n "$loss" ] && [ "$loss" -lt 50 ] 2>/dev/null; then
406
+ if [ -n "$loss" ] && [ "$loss" -lt 1 ] 2>/dev/null; then
381
407
  STABLE=true
382
- info "Jaringan stabil (packet loss: ${loss}%, RTT: ${rtt:-N/A}ms)"
408
+ info "Jaringan stabil (0% loss)"
383
409
  else
384
- warn "Jaringan tidak stabil (packet loss: ${loss:-100}%)"
410
+ error "Jaringan tidak stabil (packet loss: ${loss:-100}%)"
411
+ echo " Setup dibatalkan."
385
412
  echo ""
386
- echo " Kemungkinan penyebab:"
387
- echo " • Sinyal WiFi lemah — dekatkan ke router"
388
- echo " • Router sibuk / banyak perangkat"
389
- echo " • HP dalam mode hemat daya"
390
- echo ""
391
- if confirm "Tetap lanjutkan setup" "n"; then
392
- STABLE=true
393
- else
394
- echo ""
395
- info "Setup dibatalkan. Perbaiki jaringan lalu ulangi."
396
- exit 0
397
- fi
413
+ echo " Perbaiki:"
414
+ echo " • Dekatkan HP ke router"
415
+ echo " • Matikan data seluler / VPN"
416
+ echo " • Nonaktifkan hemat daya"
417
+ echo " • Ulangi: termux-connecting -y"
418
+ exit 1
398
419
  fi
399
420
  else
400
421
  warn "Tidak bisa deteksi gateway — lewati pengecekan"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "termux-connecting",
3
- "version": "1.1.52",
3
+ "version": "1.1.54",
4
4
  "description": "CLI setup Termux + koneksi SSH dari PC/Mac dengan Telegram alert",
5
5
  "bin": {
6
6
  "termux-connecting": "bin/termux-connecting",