termux-connecting 1.1.34 → 1.1.36

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.
@@ -7,7 +7,7 @@ CONFIG_FILE="$CONFIG_DIR/config"
7
7
  DEVICES_DIR="$CONFIG_DIR/devices"
8
8
  ACTIVE_DEVICE=""
9
9
  SSH_PORT=8022
10
- SSH_KEY="$HOME/.ssh/id_ed25519"
10
+ SSH_KEY="$HOME/.ssh/id_ed25519_termux_connecting"
11
11
 
12
12
  GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; CYAN='\033[0;36m'; NC='\033[0m'
13
13
  info() { echo -e "${GREEN}[✓]${NC} $1"; }
@@ -196,12 +196,13 @@ cmd_connection() {
196
196
  if ! $connected; then
197
197
  error "Gagal terhubung ke ${SSH_USER}@${SSH_HOST}:${SSH_PORT}"
198
198
  echo ""
199
- echo " Pastikan:"
200
- echo " 1. HP sudah menjalankan: sshd (di Termux)"
201
- echo " 2. HP dan PC dalam jaringan WiFi yang SAMA"
202
- echo " 3. IP dan username yang dimasukkan benar"
199
+ echo " 📡 Timeout → HP tidak reachable. Buka Termux di HP & jalankan: sshd"
200
+ echo " 🔑 Auth failed → Password salah. Cek password HP: passwd"
201
+ echo " 🌐 Wrong net → HP dan PC harus di WiFi yang SAMA"
203
202
  echo ""
204
- echo " Coba lagi: termux-connect-pc connection"
203
+ echo " Cek: ping -c1 ${SSH_HOST}"
204
+ echo " HP: sshd"
205
+ echo " PC: termux-connect-pc connection hp-pribadi"
205
206
  return
206
207
  fi
207
208
 
@@ -255,21 +256,22 @@ cmd_connection() {
255
256
  echo " Nanti cukup: ssh ${HOST_ALIAS}"
256
257
  echo ""
257
258
  mkdir -p "$HOME/.ssh"
258
- if ! grep -q "Host $HOST_ALIAS$" "$HOME/.ssh/config"; then
259
- cat >> "$HOME/.ssh/config" << EOF
259
+ # Hapus blok config lama jika ada, lalu tulis ulang
260
+ if [ -f "$HOME/.ssh/config" ]; then
261
+ sed -i '' "/^Host $HOST_ALIAS$/,/^$/d" "$HOME/.ssh/config" 2>/dev/null || true
262
+ fi
263
+ cat >> "$HOME/.ssh/config" << EOF
260
264
 
261
265
  Host $HOST_ALIAS
262
266
  HostName $SSH_HOST
263
267
  User $SSH_USER
264
268
  Port $SSH_PORT
269
+ IdentityFile $SSH_KEY
265
270
  StrictHostKeyChecking no
266
271
  UserKnownHostsFile /dev/null
267
272
  EOF
268
- chmod 600 "$HOME/.ssh/config"
269
- info "SSH config siap: ssh $HOST_ALIAS"
270
- else
271
- info "Host '$HOST_ALIAS' sudah ada di SSH config"
272
- fi
273
+ chmod 600 "$HOME/.ssh/config"
274
+ info "SSH config siap: ssh $HOST_ALIAS"
273
275
 
274
276
  # ── Telegram ──
275
277
  title "4. Telegram Alert (opsional)"
@@ -379,9 +381,9 @@ cmd_check() {
379
381
  else
380
382
  error "Koneksi GAGAL"
381
383
  echo " Penyebab:"
382
- echo " - HP mati/sleep buka Termux, jalankan: sshd"
383
- echo " - Key bermasalahsetup ulang: termux-connect-pc connection"
384
- echo " - Password berubah cek password di HP: passwd"
384
+ echo " 📡 Timeout → HP tidak reachable. Buka Termux & jalankan: sshd"
385
+ echo " 🔑 Auth failedPassword/key salah. Cek password HP: passwd"
386
+ echo " 🌐 Wrong net HP dan PC beda jaringan. Cek WiFi HP"
385
387
  echo ""
386
388
  telegram_alert "🚨 *Koneksi Termux PUTUS*%0ADevice: ${ACTIVE_DEVICE}%0AHost: ${SSH_USER}@${SSH_HOST}:${SSH_PORT}%0AWaktu: $(date)"
387
389
  echo ""
@@ -143,15 +143,17 @@ if command -v termux-wake-lock >/dev/null; then
143
143
  termux-wake-lock sshd 2>/dev/null && info "Wake lock aktif — koneksi tetap terjaga saat layar mati"
144
144
  fi
145
145
 
146
- # battery optimization matikan agar Termux tidak di-kill Android
147
- if command -v termux-battery-status >/dev/null 2>&1; then
148
- : # termux-api tersedia
149
- else
150
- echo " Matikan battery optimization untuk Termux di Pengaturan:"
151
- echo " Setelan → Aplikasi → Termux → Baterai → Tidak dioptimalkan"
152
- echo ""
146
+ # notification — agar Android tidak kill Termux
147
+ if command -v termux-notification >/dev/null; then
148
+ termux-notification -t "Termux Connecting" -c "SSH server berjalan — ${USERNAME}@${IP}:8022" --id sshd-keepalive --ongoing 2>/dev/null
153
149
  fi
154
150
 
151
+ # battery optimization — buka setelan langsung
152
+ echo " Buka setelan battery optimization:"
153
+ echo " am start -a android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"
154
+ echo " Lalu cari Termux → pilih 'Tidak dioptimalkan'"
155
+ echo ""
156
+
155
157
  # ─── 6. Informasi Koneksi ───
156
158
  title "5. Informasi Koneksi"
157
159
  USERNAME=$(whoami)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "termux-connecting",
3
- "version": "1.1.34",
3
+ "version": "1.1.36",
4
4
  "description": "CLI setup Termux + koneksi SSH dari PC/Mac dengan Telegram alert",
5
5
  "bin": {
6
6
  "termux-connecting": "bin/termux-connecting",