mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-08-28 04:46:34 -04:00
Allow the user to choose preferred editor, drop nano as dependency
Former-commit-id: d84048c212beca87419aac3577cf32c01d4f518f [formerly 9891fe4a81]
Former-commit-id: 2204730779caa4adad44a03f1fcd0bb76f25a1cd
This commit is contained in:
+14
-9
@@ -164,7 +164,7 @@ def edit_note(_shm_folder, _shm_entry):
|
||||
lines = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}").readlines()
|
||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines(lines[0:3])
|
||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'w').writelines(lines[3:])
|
||||
system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||
system(f"{editor} {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||
edit_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n").read()
|
||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'a').write(edit_notes)
|
||||
|
||||
@@ -216,7 +216,6 @@ def tweak(): # runs configuration wizard
|
||||
print('\na unique gpg key has been generated for you.')
|
||||
system(f"{gpg} --full-generate-key")
|
||||
_gpg_id = str(input('\nplease input the id of your gpg key: '))
|
||||
open(path.expanduser('~/.config/sshyp/sshyp-gpg'), 'w').write(_gpg_id + '\n')
|
||||
|
||||
# lock file generation
|
||||
open(path.expanduser('~/.config/sshyp/lock'), 'w')
|
||||
@@ -242,6 +241,10 @@ def tweak(): # runs configuration wizard
|
||||
_username_ssh = str(input('\nusername of the remote server: '))
|
||||
print(f"\nentry directory: /home/{_username_ssh}/.password-pasture/")
|
||||
|
||||
# sshyp-only data storage
|
||||
open(path.expanduser('~/.config/sshyp/sshyp-data'), 'w')\
|
||||
.write(_gpg_id + '\n' + input('\nexample input: vim\n\npreferred text editor: '))
|
||||
|
||||
# sshync profile generation
|
||||
sshync.make_profile(path.expanduser('~/.config/sshyp/sshyp.sshync'),
|
||||
path.expanduser('~/.password-pasture/'), f"/home/{_username_ssh}/.password-pasture/",
|
||||
@@ -308,10 +311,10 @@ def print_info(): # prints help text based on argument
|
||||
'randall winkhart\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m '
|
||||
'\u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mversion 1.0.1'
|
||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mversion 1.1.0'
|
||||
'\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mthe polished trotters '
|
||||
'update\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m \u001b[38;5;15;48;5;8mthe sheecrets '
|
||||
'update\u001b[38;5;15;48;5;15m \u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||
print('\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m '
|
||||
'\u001b[38;5;7;48;5;8m/\u001b[0m')
|
||||
print('\u001b[38;5;7;48;5;8m<><><><><><><><><><><><><><><><><><><><><><><><><><><><>\u001b[0m\n')
|
||||
@@ -436,7 +439,7 @@ def add_entry(): # adds a new entry
|
||||
s_exit(1)
|
||||
if argument_list[1] == 'note' or argument_list[1] == '-n':
|
||||
_shm_folder, _shm_entry = shm_gen()
|
||||
system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||
system(f"{editor} {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
||||
open(f"{tmp_dir}{_shm_folder}/{_shm_entry}", 'w').writelines('\n\n\n' + _notes)
|
||||
elif argument_list[1] == 'password' or argument_list[1] == '-p':
|
||||
@@ -446,7 +449,7 @@ def add_entry(): # adds a new entry
|
||||
_add_note = input('add a note to this entry? (y/N) ')
|
||||
_shm_folder, _shm_entry = shm_gen()
|
||||
if _add_note.lower() == 'y':
|
||||
system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||
system(f"{editor} {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
||||
else:
|
||||
_notes = ''
|
||||
@@ -547,7 +550,7 @@ def gen(): # generates a password for a new or an existing entry
|
||||
_add_note = input('add a note to this entry? (y/N) ')
|
||||
_shm_folder, _shm_entry = shm_gen()
|
||||
if _add_note.lower() == 'y':
|
||||
system(f"nano {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||
system(f"{editor} {tmp_dir}{_shm_folder}/{_shm_entry}-n")
|
||||
_notes = open(f"{tmp_dir}{_shm_folder}/{_shm_entry}-n", 'r').read()
|
||||
else:
|
||||
_notes = ''
|
||||
@@ -659,7 +662,9 @@ if __name__ == "__main__":
|
||||
directory = str(ssh_info[3].replace('\n', ''))
|
||||
directory_ssh = '/home/' + username_ssh + '/.password-pasture/'
|
||||
client_device_name = listdir(path.expanduser('~/.config/sshyp/devices'))[0]
|
||||
gpg_id = open(path.expanduser('~/.config/sshyp/sshyp-gpg')).read().strip()
|
||||
sshyp_data = open(path.expanduser('~/.config/sshyp/sshyp-data')).readlines()
|
||||
gpg_id = sshyp_data[0].replace('\n', '')
|
||||
editor = sshyp_data[1].replace('\n', '')
|
||||
ssh_error = int(open(path.expanduser('~/.config/sshyp/ssh-error')).read().strip())
|
||||
if ssh_error != 0:
|
||||
ssh_error = copy_name_check(port, username_ssh, ip, client_device_name)
|
||||
|
||||
Regular → Executable
+4
-8
@@ -55,7 +55,6 @@ requires {
|
||||
gnupg
|
||||
openssh
|
||||
python3
|
||||
nano
|
||||
}
|
||||
urls {
|
||||
\"https://github.com/rwinkhart/sshyp\"
|
||||
@@ -85,7 +84,7 @@ Section: utils
|
||||
Architecture: all
|
||||
Maintainer: Randall Winkhart <idgr at tutanota dot com>
|
||||
Description: A light-weight, self-hosted, synchronized password manager
|
||||
Depends: python3, gnupg, openssh-client, nano, xclip, wl-clipboard
|
||||
Depends: python3, gnupg, openssh-client, xclip, wl-clipboard
|
||||
Priority: optional
|
||||
Installed-Size: 185
|
||||
" > packages/debiantemp/sshyp_"$version"-"$revision"_all/DEBIAN/control
|
||||
@@ -110,7 +109,7 @@ Section: utils
|
||||
Architecture: all
|
||||
Maintainer: Randall Winkhart <idgr at tutanota dot com>
|
||||
Description: A light-weight, self-hosted, synchronized password manager
|
||||
Depends: python, gnupg, openssh, nano, termux-api, termux-am
|
||||
Depends: python, gnupg, openssh, termux-api, termux-am
|
||||
Priority: optional
|
||||
Installed-Size: 185
|
||||
" > packages/termuxtemp/sshyp_"$version"-"$revision"_all_termux/DEBIAN/control
|
||||
@@ -155,7 +154,7 @@ License: GPLv3
|
||||
URL: https://github.com/rwinkhart/sshyp
|
||||
Source0: sshyp-"$version".tar.xz
|
||||
|
||||
Requires: python gnupg openssh nano wl-clipboard
|
||||
Requires: python gnupg openssh wl-clipboard
|
||||
|
||||
%description
|
||||
sshyp is a password-store compatible CLI password manager available for UNIX(-like) systems - its primary goal is to make syncing passwords and notes across devices as easy as possible via CLI.
|
||||
@@ -201,9 +200,6 @@ prefix: /
|
||||
\"gnupg\" : {
|
||||
\"origin\" : \"security/gnupg\"
|
||||
},
|
||||
\"nano\" : {
|
||||
\"origin\" : \"editors/nano\"
|
||||
},
|
||||
\"xclip\" : {
|
||||
\"origin\" : \"x11/xclip\"
|
||||
},
|
||||
@@ -237,7 +233,7 @@ pkgdesc='A light-weight, self-hosted, synchronized password manager'
|
||||
url='https://github.com/rwinkhart/sshyp'
|
||||
arch=('any')
|
||||
license=('GPL3')
|
||||
depends=(python gnupg openssh nano xclip wl-clipboard)
|
||||
depends=(python gnupg openssh xclip wl-clipboard)
|
||||
|
||||
source=(\""$source"\")
|
||||
sha512sums=('"$sha512"')
|
||||
|
||||
Regular → Executable
Reference in New Issue
Block a user