mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 16:47:14 -04:00
Initial implementation of optional tweak menu (design-only, non-functional)
Former-commit-id: 389b77adc683227597f2082920ed153d09a6cb94 Former-commit-id: 6a374155f4661d17a1939dd1911618aec76e78cd
This commit is contained in:
+12
-7
@@ -295,7 +295,8 @@ this program comes with absolutely no warranty; type 'sshyp license' for details
|
|||||||
\u001b[1moptions:\u001b[0m
|
\u001b[1moptions:\u001b[0m
|
||||||
help/-h{17*' '}bring up this menu
|
help/-h{17*' '}bring up this menu
|
||||||
version/-v{14*' '}display sshyp version info
|
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
|
add{21*' '}add an entry
|
||||||
gen{21*' '}generate a new password
|
gen{21*' '}generate a new password
|
||||||
edit{20*' '}edit an existing entry
|
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
|
\u001b[1moptions:\u001b[0m
|
||||||
help/-h{17*' '}bring up this menu
|
help/-h{17*' '}bring up this menu
|
||||||
version/-v{14*' '}display sshyp version info
|
version/-v{14*' '}display sshyp version info
|
||||||
settings{19*' '}configure sshyp
|
init{20*' '}set up sshyp
|
||||||
whitelist{15*' '}manage the quick-unlock whitelist
|
whitelist{15*' '}manage the quick-unlock whitelist
|
||||||
\n\u001b[1mflags:\u001b[0m
|
\n\u001b[1mflags:\u001b[0m
|
||||||
whitelist:
|
whitelist:
|
||||||
@@ -706,7 +707,7 @@ if __name__ == "__main__":
|
|||||||
arg_count = len(arguments)
|
arg_count = len(arguments)
|
||||||
|
|
||||||
# check if an entry name is correctly supplied
|
# 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('/'):
|
if arg_count > 0 and arguments[0].startswith('/'):
|
||||||
arg_start = 1
|
arg_start = 1
|
||||||
entry_name = arguments[0].strip('/')
|
entry_name = arguments[0].strip('/')
|
||||||
@@ -743,9 +744,9 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
ssh_error = True
|
ssh_error = True
|
||||||
except (FileNotFoundError, IndexError):
|
except (FileNotFoundError, IndexError):
|
||||||
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||||
print("not all necessary configurations have been made - please run 'sshyp settings'")
|
print("not all necessary configurations have been made - please run 'sshyp init'")
|
||||||
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
||||||
s_exit(1)
|
s_exit(1)
|
||||||
else:
|
else:
|
||||||
from stweak import initial_setup
|
from stweak import initial_setup
|
||||||
@@ -792,9 +793,13 @@ if __name__ == "__main__":
|
|||||||
success_flag, sync_flag = True, True
|
success_flag, sync_flag = True, True
|
||||||
remove_data()
|
remove_data()
|
||||||
|
|
||||||
elif arg_count == 1 and arg_start == 1:
|
elif arg_count == 1:
|
||||||
|
if arg_start == 1:
|
||||||
success_flag = True
|
success_flag = True
|
||||||
read_shortcut()
|
read_shortcut()
|
||||||
|
elif arguments[0] == 'tweak':
|
||||||
|
from stweak import global_menu
|
||||||
|
global_menu(False)
|
||||||
|
|
||||||
# PORT START ARGS-SERVER
|
# PORT START ARGS-SERVER
|
||||||
# server arguments
|
# server arguments
|
||||||
|
|||||||
+23
-2
@@ -161,8 +161,7 @@ def quick_unlock_config(_stdscr):
|
|||||||
return _enabled
|
return _enabled
|
||||||
|
|
||||||
|
|
||||||
# ARGUMENT-SPECIFIC FUNCTIONS
|
# runs initial configuration wizard
|
||||||
# runs configuration wizard
|
|
||||||
def initial_setup():
|
def initial_setup():
|
||||||
# config directory creation
|
# config directory creation
|
||||||
Path(f"{home}/.config/sshyp/devices").mkdir(mode=0o700, parents=True, exist_ok=True)
|
Path(f"{home}/.config/sshyp/devices").mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||||
@@ -256,3 +255,25 @@ def initial_setup():
|
|||||||
_lines += 1
|
_lines += 1
|
||||||
_config_file.write('n')
|
_config_file.write('n')
|
||||||
print('\nconfiguration complete\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)
|
||||||
|
|||||||
Reference in New Issue
Block a user