Do not delete existing device IDs until a new one is set

Former-commit-id: 1f60a32e293d97059648c5c107af7e2b723f2319
Former-commit-id: 4c22d92687ccd58ddcf0cf55b0758e641b978ca4
This commit is contained in:
2023-05-15 10:54:34 -04:00
parent f4bb0fb783
commit b14f925e53
+3 -2
View File
@@ -194,14 +194,15 @@ def ssh_config():
# device id configuration
def dev_id_config(_ip, _username_ssh, _port):
for _id in listdir(f"{home}/.config/sshyp/devices"):
remove(f"{home}/.config/sshyp/devices/{_id}")
_device_id_prefix = curses_text('name this device:\n\n\n\n\n(ctrl+g/enter to confirm)\n\n'
'important:\u001b[0m this id \u001b[4;1mmust\u001b[0m be '
'unique amongst your client devices\n\nthis is used to keep '
'track of database syncing 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
for _id in listdir(f"{home}/.config/sshyp/devices"):
remove(f"{home}/.config/sshyp/devices/{_id}")
open(f"{home}/.config/sshyp/devices/{_device_id}", 'w')
# test server connection and attempt to register device id
copy_id_check(_ip, _username_ssh, _port, _device_id, sshyp_data)