Standardize language: device name/id -> device id, syncing -> synchronization/synchronizing

This commit is contained in:
2024-01-03 22:56:13 -05:00
parent d4f1831486
commit 18d03279b9
5 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -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. 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 # WARNING
It is your responsibility to assess the security and stability of "sshyp" before using it and ensure it meets your needs. It is your responsibility to assess the security and stability of "sshyp" before using it and ensure it meets your needs.
+1 -1
View File
@@ -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': Creating a note-only entry saved as '~/.local/share/sshyp/notes/test note.gpg':
sshyp /notes/test\ note add -n sshyp /notes/test\ note add -n
Manually syncing entries with the server: Manually synchronizing entries with the server:
sshyp sync sshyp sync
.SH ARGUMENTS (CLIENT) .SH ARGUMENTS (CLIENT)
help/-h bring up the help menu help/-h bring up the help menu
+5 -5
View File
@@ -8,12 +8,12 @@ home = expanduser('~')
# PORT START SSHYNC-REMOTE # PORT START SSHYNC-REMOTE
# REMOTE # REMOTE
# prints all necessary remote data to stdout # 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 # deletions
for _file in listdir(f"{home}/.config/sshyp/deleted"): for _file in listdir(f"{home}/.config/sshyp/deleted"):
_file_path, _sep, _device = _file.partition('\x1f') _file_path, _sep, _device = _file.partition('\x1f')
_file_path = _file_path.replace('\x1e', '/') _file_path = _file_path.replace('\x1e', '/')
if _device == _client_device_name: if _device == _client_device_id:
print(_file_path) print(_file_path)
try: try:
remove(f"{home}/.config/sshyp/deleted/{_file}") remove(f"{home}/.config/sshyp/deleted/{_file}")
@@ -31,7 +31,7 @@ def remote_list_gen(_client_device_name, _remote_dir):
# HYBRID # 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): def delete(_file_path, _target_database, _silent):
from shutil import rmtree from shutil import rmtree
_directory = f"{home}/.local/share/sshyp/" _directory = f"{home}/.local/share/sshyp/"
@@ -44,8 +44,8 @@ def delete(_file_path, _target_database, _silent):
if not _silent: if not _silent:
print(f"location does not exist {_target_database}") print(f"location does not exist {_target_database}")
if _target_database == 'remotely': if _target_database == 'remotely':
for _device_name in listdir(f"{home}/.config/sshyp/devices"): for _device_id in listdir(f"{home}/.config/sshyp/devices"):
open(f"{home}/.config/sshyp/deleted/" + _file_path.replace('/', '\x1e') + '\x1f' + _device_name, 'w') 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 # retrieves and returns titles and mod times from the local device
+4 -4
View File
@@ -260,7 +260,7 @@ def line_edit(_lines, _edit_data, _edit_line):
return _lines 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): def copy_id_check(_port, _username_ssh, _ip, _client_device_id, _identity, _sshyp_data):
from stweak import write_config from stweak import write_config
if not _sshyp_data.has_section('CLIENT-ONLINE'): 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) f'{_client_device_id}").touch(mode=0o400, exist_ok=True)\''), stderr=DEVNULL, check=True)
except CalledProcessError: except CalledProcessError:
print(f'\n\u001b[38;5;9mwarning: ssh connection could not be made - ensure the public key ({_identity}) is ' 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 ' 'registered on the remote server and that the entered ip, port, and username are correct\n\n'
'functionality will be disabled until this is addressed\u001b[0m\n') 'synchronization functionality will be disabled until this is addressed\u001b[0m\n')
_sshyp_data.set('CLIENT-ONLINE', 'ssh_error', 'true') _sshyp_data.set('CLIENT-ONLINE', 'ssh_error', 'true')
write_config(_sshyp_data) write_config(_sshyp_data)
return True return True
@@ -392,7 +392,7 @@ def read_shortcut():
# calls sshync to sync changes to the user's server # calls sshync to sync changes to the user's server
def sync(_start_text=''): 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 # set permissions before uploading
for _root, _dirs, _files in walk(f"{home}/.local/share/sshyp"): for _root, _dirs, _files in walk(f"{home}/.local/share/sshyp"):
for _path in _root.splitlines(): for _path in _root.splitlines():
+6 -6
View File
@@ -247,9 +247,9 @@ def dev_id_config(_ip, _username_ssh, _port, _identity, _reconfig=False):
if _proceed != 1: if _proceed != 1:
return return
from sshyp import copy_id_check, string_gen 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 ' '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_suffix = string_gen('f', randint(24, 48))
_device_id = _device_id_prefix + '-' + _device_id_suffix _device_id = _device_id_prefix + '-' + _device_id_suffix
# remove existing device ids # remove existing device ids
@@ -332,7 +332,7 @@ def refresh_encryption():
# PORT START WHITELIST-SERVER # PORT START WHITELIST-SERVER
# removes a registered device id from the server-side pool and prunes the quick-unlock whitelist # 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") _device_ids = listdir(f"{home}/.config/sshyp/devices")
_whitelisted_ids = listdir(f"{home}/.config/sshyp/whitelist") _whitelisted_ids = listdir(f"{home}/.config/sshyp/whitelist")
@@ -514,7 +514,7 @@ def global_menu(_scr, _device_type, _top_message):
while True: while True:
_options, _choice, _exit_signal = ['change device/synchronization types'], 0, False _options, _choice, _exit_signal = ['change device/synchronization types'], 0, False
if _device_type == 'client': 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, RECOMMENDED] set custom text editor',
'[OPTIONAL] enable/disable quick-unlock', '[OPTIONAL] enable/disable quick-unlock',
'[OPTIONAL] re-encrypt/optimize entries', '[OPTIONAL] re-encrypt/optimize entries',
@@ -534,7 +534,7 @@ def global_menu(_scr, _device_type, _top_message):
# ...and text editor settings are missing # ...and text editor settings are missing
if not sshyp_data.has_option('CLIENT-GENERAL', 'text_editor'): if not sshyp_data.has_option('CLIENT-GENERAL', 'text_editor'):
editor_config(True) editor_config(True)
# ...and online (synced) mode is enabled... # ...and online (synchronized) mode is enabled...
if _dev_sync_types[1] == 'false': if _dev_sync_types[1] == 'false':
# ...and quick-unlock settings are missing # ...and quick-unlock settings are missing
if not sshyp_data.has_option('CLIENT-ONLINE', 'quick_unlock_enabled'): 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': if _device_type == 'client':
gpg_config() gpg_config()
else: else:
registered_remover() registered_dev_id_remover()
elif _choice == 2: elif _choice == 2:
if _device_type == 'client': if _device_type == 'client':
ssh_config(True) ssh_config(True)