Initial implementation of optional tweak menu (design-only, non-functional)

Former-commit-id: 389b77adc683227597f2082920ed153d09a6cb94
Former-commit-id: 6a374155f4661d17a1939dd1911618aec76e78cd
This commit is contained in:
2023-05-12 22:16:11 -04:00
parent 7b3270d70f
commit ebf58b7770
2 changed files with 37 additions and 11 deletions
+14 -9
View File
@@ -295,7 +295,8 @@ this program comes with absolutely no warranty; type 'sshyp license' for details
\u001b[1moptions:\u001b[0m
help/-h{17*' '}bring up this menu
version/-v{14*' '}display sshyp version info
settings{19*' '}configure sshyp
init{20*' '}set up sshyp
tweak{19*' '}change configuration options/manage extensions and updates
add{21*' '}add an entry
gen{21*' '}generate a new password
edit{20*' '}edit an existing entry
@@ -328,7 +329,7 @@ this program comes with absolutely no warranty; type 'sshyp license' for details
\u001b[1moptions:\u001b[0m
help/-h{17*' '}bring up this menu
version/-v{14*' '}display sshyp version info
settings{19*' '}configure sshyp
init{20*' '}set up sshyp
whitelist{15*' '}manage the quick-unlock whitelist
\n\u001b[1mflags:\u001b[0m
whitelist:
@@ -706,7 +707,7 @@ if __name__ == "__main__":
arg_count = len(arguments)
# check if an entry name is correctly supplied
if arg_count < 1 or (arg_count > 0 and arguments[0] not in ('tweak', 'settings')):
if arg_count < 1 or (arg_count > 0 and arguments[0] != 'init'):
if arg_count > 0 and arguments[0].startswith('/'):
arg_start = 1
entry_name = arguments[0].strip('/')
@@ -743,9 +744,9 @@ if __name__ == "__main__":
else:
ssh_error = True
except (FileNotFoundError, IndexError):
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
print("not all necessary configurations have been made - please run 'sshyp settings'")
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
print("not all necessary configurations have been made - please run 'sshyp init'")
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
s_exit(1)
else:
from stweak import initial_setup
@@ -792,9 +793,13 @@ if __name__ == "__main__":
success_flag, sync_flag = True, True
remove_data()
elif arg_count == 1 and arg_start == 1:
success_flag = True
read_shortcut()
elif arg_count == 1:
if arg_start == 1:
success_flag = True
read_shortcut()
elif arguments[0] == 'tweak':
from stweak import global_menu
global_menu(False)
# PORT START ARGS-SERVER
# server arguments
+23 -2
View File
@@ -161,8 +161,7 @@ def quick_unlock_config(_stdscr):
return _enabled
# ARGUMENT-SPECIFIC FUNCTIONS
# runs configuration wizard
# runs initial configuration wizard
def initial_setup():
# config directory creation
Path(f"{home}/.config/sshyp/devices").mkdir(mode=0o700, parents=True, exist_ok=True)
@@ -256,3 +255,25 @@ def initial_setup():
_lines += 1
_config_file.write('n')
print('\nconfiguration complete\n')
# runs secondary configuration menu
def global_menu(_post_setup):
# curses initialization
_stdscr = initscr()
noecho()
cbreak()
_stdscr.keypad(True)
# a client device is assumed, the server should never show this menu
_options = []
if not _post_setup:
_options = ['change device/synchronization types', 'change gpg key', 're-configure ssh', 'change device name']
_message = 'all configuration options'
_options.extend(['[OPTIONAL, RECOMMENDED] set custom text editor',
'[OPTIONAL, RECOMMENDED] enable/disable quick-unlock',
'[OPTIONAL, NOT IMPLEMENTED] su security mode',
'[OPTIONAL, NOT IMPLEMENTED] extensions and updates', 'exit'])
_message = 'additional configuration options'
_choice = settings_radio(_stdscr, _options, _message)