From 18d03279b98904d3dc2da0f0bdf7d6162617b237 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Wed, 3 Jan 2024 22:56:13 -0500 Subject: [PATCH] Standardize language: device name/id -> device id, syncing -> synchronization/synchronizing --- README.md | 2 +- extra/manpage | 2 +- lib/sshync.py | 10 +++++----- lib/sshyp.py | 8 ++++---- lib/stweak.py | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 1660ec9..aebc06c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ sshyp is compatible with entries created by pass/password-store, as its original sshyp makes use of a custom sftp wrapper, called sshync (ssh+sync), to reliably sync user entries with a local or remote server. -The name "sshyp" is a combination of its syncing library, "sshync", and "passwords". +The name "sshyp" is a combination of its synchronization library, "sshync", and "passwords". # WARNING It is your responsibility to assess the security and stability of "sshyp" before using it and ensure it meets your needs. diff --git a/extra/manpage b/extra/manpage index a80bfaf..2644c30 100644 --- a/extra/manpage +++ b/extra/manpage @@ -38,7 +38,7 @@ Making a new entry saved as '~/.local/share/sshyp/school/university.gpg' using t Creating a note-only entry saved as '~/.local/share/sshyp/notes/test note.gpg': sshyp /notes/test\ note add -n -Manually syncing entries with the server: +Manually synchronizing entries with the server: sshyp sync .SH ARGUMENTS (CLIENT) help/-h bring up the help menu diff --git a/lib/sshync.py b/lib/sshync.py index 0be0d08..009702c 100644 --- a/lib/sshync.py +++ b/lib/sshync.py @@ -8,12 +8,12 @@ home = expanduser('~') # PORT START SSHYNC-REMOTE # REMOTE # prints all necessary remote data to stdout -def remote_list_gen(_client_device_name, _remote_dir): +def remote_list_gen(_client_device_id, _remote_dir): # deletions for _file in listdir(f"{home}/.config/sshyp/deleted"): _file_path, _sep, _device = _file.partition('\x1f') _file_path = _file_path.replace('\x1e', '/') - if _device == _client_device_name: + if _device == _client_device_id: print(_file_path) try: remove(f"{home}/.config/sshyp/deleted/{_file}") @@ -31,7 +31,7 @@ def remote_list_gen(_client_device_name, _remote_dir): # HYBRID -# deletes a file or folder and/or marks it for deletion upon syncing +# deletes a file or folder and/or marks it for deletion upon synchronizing def delete(_file_path, _target_database, _silent): from shutil import rmtree _directory = f"{home}/.local/share/sshyp/" @@ -44,8 +44,8 @@ def delete(_file_path, _target_database, _silent): if not _silent: print(f"location does not exist {_target_database}") if _target_database == 'remotely': - for _device_name in listdir(f"{home}/.config/sshyp/devices"): - open(f"{home}/.config/sshyp/deleted/" + _file_path.replace('/', '\x1e') + '\x1f' + _device_name, 'w') + for _device_id in listdir(f"{home}/.config/sshyp/devices"): + open(f"{home}/.config/sshyp/deleted/" + _file_path.replace('/', '\x1e') + '\x1f' + _device_id, 'w') # retrieves and returns titles and mod times from the local device diff --git a/lib/sshyp.py b/lib/sshyp.py index 16179da..98ed4dc 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -260,7 +260,7 @@ def line_edit(_lines, _edit_data, _edit_line): return _lines -# attempts to connect to the user's server via ssh to register the device for syncing +# attempts to connect to the user's server via ssh to register the device for synchronization def copy_id_check(_port, _username_ssh, _ip, _client_device_id, _identity, _sshyp_data): from stweak import write_config if not _sshyp_data.has_section('CLIENT-ONLINE'): @@ -271,8 +271,8 @@ def copy_id_check(_port, _username_ssh, _ip, _client_device_id, _identity, _sshy f'{_client_device_id}").touch(mode=0o400, exist_ok=True)\''), stderr=DEVNULL, check=True) except CalledProcessError: print(f'\n\u001b[38;5;9mwarning: ssh connection could not be made - ensure the public key ({_identity}) is ' - 'registered on the remote server and that the entered ip, port, and username are correct\n\nsyncing ' - 'functionality will be disabled until this is addressed\u001b[0m\n') + 'registered on the remote server and that the entered ip, port, and username are correct\n\n' + 'synchronization functionality will be disabled until this is addressed\u001b[0m\n') _sshyp_data.set('CLIENT-ONLINE', 'ssh_error', 'true') write_config(_sshyp_data) return True @@ -392,7 +392,7 @@ def read_shortcut(): # calls sshync to sync changes to the user's server def sync(_start_text=''): - print(f"{_start_text}syncing entries with the server device...\n") + print(f"{_start_text}synchronizing entries with the server device...\n") # set permissions before uploading for _root, _dirs, _files in walk(f"{home}/.local/share/sshyp"): for _path in _root.splitlines(): diff --git a/lib/stweak.py b/lib/stweak.py index 19c2a1c..0cbb63c 100644 --- a/lib/stweak.py +++ b/lib/stweak.py @@ -247,9 +247,9 @@ def dev_id_config(_ip, _username_ssh, _port, _identity, _reconfig=False): if _proceed != 1: return from sshyp import copy_id_check, string_gen - _device_id_prefix = curses_text('name this device:\n\n\n\n\n(ctrl+g/enter to confirm)\n\nimportant: this ' + _device_id_prefix = curses_text('set this device\'s id:\n\n\n\n\n(ctrl+g/enter to confirm)\n\nimportant: this ' 'id must be unique amongst your client devices\n\nthis is used to keep track of ' - 'database syncing and quick-unlock permissions\n') + 'database synchronization and quick-unlock permissions\n') _device_id_suffix = string_gen('f', randint(24, 48)) _device_id = _device_id_prefix + '-' + _device_id_suffix # remove existing device ids @@ -332,7 +332,7 @@ def refresh_encryption(): # PORT START WHITELIST-SERVER # removes a registered device id from the server-side pool and prunes the quick-unlock whitelist -def registered_remover(): +def registered_dev_id_remover(): _device_ids = listdir(f"{home}/.config/sshyp/devices") _whitelisted_ids = listdir(f"{home}/.config/sshyp/whitelist") @@ -514,7 +514,7 @@ def global_menu(_scr, _device_type, _top_message): while True: _options, _choice, _exit_signal = ['change device/synchronization types'], 0, False if _device_type == 'client': - _options.extend(['change gpg key', 're-configure ssh(ync)', 'change device name', + _options.extend(['change gpg key', 're-configure ssh(ync)', 'change device id', '[OPTIONAL, RECOMMENDED] set custom text editor', '[OPTIONAL] enable/disable quick-unlock', '[OPTIONAL] re-encrypt/optimize entries', @@ -534,7 +534,7 @@ def global_menu(_scr, _device_type, _top_message): # ...and text editor settings are missing if not sshyp_data.has_option('CLIENT-GENERAL', 'text_editor'): editor_config(True) - # ...and online (synced) mode is enabled... + # ...and online (synchronized) mode is enabled... if _dev_sync_types[1] == 'false': # ...and quick-unlock settings are missing if not sshyp_data.has_option('CLIENT-ONLINE', 'quick_unlock_enabled'): @@ -558,7 +558,7 @@ def global_menu(_scr, _device_type, _top_message): if _device_type == 'client': gpg_config() else: - registered_remover() + registered_dev_id_remover() elif _choice == 2: if _device_type == 'client': ssh_config(True)