Files
BackTunnel/scripts/backtunnel-share-tui
sysadminmatmoz 608a6a371f Introduce terminal-based workflows for BackTunnel via TUI scripts and service menus
Add `backtunnel-open-term`, `backtunnel-share-tui`, and `backtunnel-access-tui` scripts for terminal-based interaction. Update Dolphin service menus to enable TUI workflows, with improved terminal detection logic. Enhance installation and uninstallation scripts to handle new files. Update README with terminal workflow details and logging information.
2025-09-19 15:30:41 +02:00

33 lines
1.0 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
FOLDER="${1:-}"
[[ -n "$FOLDER" ]] || { echo "Usage: backtunnel-share-tui <folder>"; exit 1; }
read -r -p "Remote (user@host or user:host) [user@vps.example.com]: " REMOTE
REMOTE="${REMOTE:-user@vps.example.com}"
read -r -p "Share duration (30m/2h/1d) [2h]: " DUR
DUR="${DUR:-2h}"
read -r -p "Tunnel port on remote [2222]: " TPORT
TPORT="${TPORT:-2222}"
read -r -p "Local sshd port to expose [22]: " LPORT
LPORT="${LPORT:-22}"
read -r -p "Print invite line for chat? (y/N): " yn
INV=; [[ "${yn,,}" == "y" ]] && INV="-i"
QR=
if [[ -n "$INV" ]]; then
read -r -p "Show QR code for the invite? (y/N): " yq
[[ "${yq,,}" == "y" ]] && QR="--qr"
fi
read -r -p "Invite: suggested mount point [/mnt/remote-rssh]: " MP
MP="${MP:-/mnt/remote-rssh}"
echo
echo "Running: backtunnel-share '$FOLDER' with '$REMOTE' for '$DUR' -p '$TPORT' -l '$LPORT' ${INV:+-i} ${QR:+--qr} --invite-mount '$MP'"
exec backtunnel-share "$FOLDER" with "$REMOTE" for "$DUR" -p "$TPORT" -l "$LPORT" ${INV:+-i} ${QR:+--qr} --invite-mount "$MP"