diff --git a/ani-cli b/ani-cli index 0765499..1d53d9a 100755 --- a/ani-cli +++ b/ani-cli @@ -541,37 +541,7 @@ while getopts 'hd:HlpadP:s' OPT; do exit 0 ;; s) - printf "%s" "Enter username for remote user: " - read -r username - printf "%s" "Enter host for remote user: " - read -r host - - # printf "%s" "Enter connection string for remote user in the form user@host: " - # read -r connection_str - connection_str="$username@$host" - printf "%s" "Enter port to connect to remote host with or leave blank for default (22): " - read -r port - if [[ "${port/ //}" == "" ]]; then - PORT=22 - else - PORT="$port" - fi - - if [[ ! "@" != *"$connection_str" ]]; then - printf "%s\n" "Enter in full connection string to remote user in the form: user@host" - exit 1 - fi - - printf "%s\n" "Syncing database with: $connection_str on port $PORT" - - temp_db="/tmp/aniwrapper_tmp_history.sqlite3" - scp -P "$PORT" "$connection_str:$XDG_CONFIG_HOME/aniwrapper/history.sqlite3" "$temp_db" - if [[ "$?" -ne 0 ]]; then - printf "%s\n" "Error getting database file from remote host" - exit 1 - fi - sync_search_history && sync_watch_history - exit 0 + scrape=sync ;; *) printf "%s\n" "Invalid option" @@ -654,7 +624,41 @@ case $scrape in episode_selection ;; delete) ;; + sync) + printf "%s" "Enter username for remote user: " + read -r username + printf "%s" "Enter host for remote user: " + read -r host + # printf "%s" "Enter connection string for remote user in the form user@host: " + # read -r connection_str + connection_str="$username@$host" + printf "%s" "Enter port to connect to remote host with or leave blank for default (22): " + read -r port + if [[ "${port/ //}" == "" ]]; then + PORT=22 + else + PORT="$port" + fi + + printf "%s" "Enter path to private key (leave blank if unsure or not needed): " + read -r key_path + + printf "%s\n" "Syncing database with: $connection_str on port $PORT" + temp_db="/tmp/aniwrapper_tmp_history.sqlite3" + + if [[ -z "$key_path" ]]; then + scp -P "$PORT" "$connection_str:$XDG_CONFIG_HOME/aniwrapper/history.sqlite3" "$temp_db" + else + scp -P "$PORT" -i "$key_path" "$connection_str:$XDG_CONFIG_HOME/aniwrapper/history.sqlite3" "$temp_db" + fi + if [[ "$?" -ne 0 ]]; then + printf "%s\n" "Error getting database file from remote host" + exit 1 + fi + sync_search_history && sync_watch_history + exit 0 + ;; esac { # checking input diff --git a/aniwrapper b/aniwrapper index f62f405..187fc0d 100755 --- a/aniwrapper +++ b/aniwrapper @@ -162,7 +162,14 @@ case "$selection" in if [[ -z "$port" ]] || [[ "$port" == "" ]]; then port=22 fi - printf "%s\n%s\n%d\n" "$username" "$host" "$port" | ani-cli -s + keypath=$(rofi -dmenu -config "$CFG_DIR/$CFG_FILE" \ + -l 1 -p "Enter path to private key (leave blank if not needed or if unsure):") + + if [[ -z "$keypath" ]]; then + printf "%s\n%s\n%d\n%s\n" "$username" "$host" "$port" "" | ani-cli -s + else + printf "%s\n%s\n%d\n%s\n" "$username" "$host" "$port" "$keypath" | ani-cli -s + fi if [[ "$?" -ne 0 ]]; then log "Aniwrapper was unable to sync the databases..." exit 1 diff --git a/themes/meh.rasi b/themes/meh.rasi index 40bfefd..38e21c1 100644 --- a/themes/meh.rasi +++ b/themes/meh.rasi @@ -191,6 +191,6 @@ textbox-prompt-colon { expand: false; str: ":"; margin: 0px 0.3em 0em 0em ; - text-color: #1E90FF; + text-color: #c678dd; padding: 4px 0px; }