From 7469e00fff870ee6ebbb2cb345b9d102c7479c65 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 6 Sep 2021 01:02:43 +0200 Subject: [PATCH 1/5] -z -> -n to validate that password ain't empty --- config_app_ynh/scripts/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_app_ynh/scripts/config b/config_app_ynh/scripts/config index cb99b95..c51b077 100644 --- a/config_app_ynh/scripts/config +++ b/config_app_ynh/scripts/config @@ -62,7 +62,7 @@ validate__arg8() { # SPECIFIC SETTERS FOR TOML SHORT KEYS #================================================= set__arg8() { - if [ -z "${arg8}" ] + if [ -n "${arg8}" ] then python -c "import crypt; print(crypt.crypt(\"${arg8}\", \"\$6\$saltsalt\$\"))" > $final_path/password ynh_print_info "The hash of your password has been registered in $final_path/password" From 750f43471b4ebacebdc0728407b38252e885a76f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 6 Sep 2021 01:18:10 +0200 Subject: [PATCH 2/5] config_app: let's ask a 12 character long password, makes test implementation easier in the core --- config_app_ynh/scripts/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_app_ynh/scripts/config b/config_app_ynh/scripts/config index c51b077..32a0505 100644 --- a/config_app_ynh/scripts/config +++ b/config_app_ynh/scripts/config @@ -55,7 +55,7 @@ EOF # SPECIFIC VALIDATORS FOR TOML SHORT KEYS #================================================= validate__arg8() { - if [[ "${#arg8}" -lt 8 ]]; then echo 'Too short password'; fi + if [[ "${#arg8}" -lt 12 ]]; then echo 'Too short password'; fi } #================================================= From 8f3193ff6cd8d52f517b94d2a75e14bbd18f1c09 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 6 Sep 2021 16:28:53 +0200 Subject: [PATCH 3/5] Improve(?) config_app questions ;P --- config_app_ynh/config_panel.toml | 83 ++++++++++++++++---------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/config_app_ynh/config_panel.toml b/config_app_ynh/config_panel.toml index 416ba03..73bfcef 100644 --- a/config_app_ynh/config_panel.toml +++ b/config_app_ynh/config_panel.toml @@ -3,79 +3,80 @@ version = "1.0" [main] name = "Main panel" services = ["nginx"] + [main.components] - name = "" + name = "Classic fields" [main.components.boolean] - ask = "Put a boolean" + ask = "I can haz boolean?" type = "boolean" [main.components.number] - ask = "Put a number" + ask = "I can haz number?" type = "number" min = 1 max = 100 [main.components.range] - ask = "Put a range" + ask = "I can haz range?" type = "range" min = 0 max = 100 step = 10 [main.components.str] - ask = "Put a string" + ask = "I can haz string?" type = "string" [main.components.text] - ask = "Put a text" + ask = "I can haz text?" type = "text" [main.components.password] - ask = "Put a password" + ask = "I can haz paszwurd?" type = "password" [main.components.path] - ask = "Put a path" + ask = "I can haz path?" type = "path" [main.components.email] - ask = "Put a email" + ask = "I can haz email?" type = "email" [main.components.url] - ask = "Put a url" + ask = "I can haz url?" type = "url" [main.components.date] - ask = "Put a date" + ask = "I can haz date?" type = "date" [main.components.time] - ask = "Put a time" + ask = "I can haz time?" type = "time" [main.components.color] - ask = "Put a color" + ask = "I can haz color?" type = "color" [main.components.select] - ask = "Choose an option" + ask = "I can chose option?" type = "select" choices.option1 = "Plop1" choices.option2 = "Plop2" choices.option3 = "Plop3" [main.components.domain] - ask = "Put a domain" + ask = "I can haz domain?" type = "domain" [main.components.user] - ask = "Put a user" + ask = "I can haz user?" type = "user" [main.components.tags] - ask = "Put some emails" + ask = "I can haz several emailz?" type = "tags" placeholder = "Enter some emails separated by commas" limit = 3 @@ -83,46 +84,46 @@ services = ["nginx"] pattern.error = 'An email is required for this field' [main.components.tags2] - ask = "Put some tags from a list" + ask = "I can chose several tagz?" type = "tags" choices = ['table', 'chair', 'bed', 'desk'] placeholder = "Add some tags" icon = "bed" [main.components.file] - ask = "Put a file" + ask = "I can haz file?" type = "file" [main.messages] - name = "Read only components" + name = "Messages / Read-only components" [main.messages.success] - ask = "This is a success message" + ask = "I can haz success" type = "alert" style = "success" icon = "beer" [main.messages.info] - ask = "This is an info message" + ask = "I can haz info" type = "alert" style = "info" [main.messages.warning] - ask = "This is an warning message" + ask = "Onoez i haz a warnin'" type = "alert" style = "warning" [main.messages.danger] - ask = "This is a danger message" + ask = "Onoez i haz a Danger!!" type = "alert" style = "danger" [main.messages.display_text] - ask = "This is a simple text" + ask = "I haz a simple text" type = "display_text" [main.messages.markdown] - ask = "This is a **markdown** text" + ask = "I haz some **awesome** *markdown* text!!" type = "markdown" [main.generic] @@ -147,77 +148,77 @@ services = ["nginx"] [main.generic.help] ask = "Here we add some help" type = "select" - help = "You can not feel this question with your keyboard (yes i know it's very useful)" + help = "You can not fill this question with your keyboard (yes i know it's very useful)" choices.question = "Display next question" choices.section = "Display next section" [main.generic.visible] - ask = "Display if help question is filled" + ask = "This question is only displayed if previous question is set to 'Display next question'" type = "string" visible = "help == 'question'" [main.ifsection] - name = "Section displayed only if helplink is filled" + name = "This section is only displayed if the previous question is set to 'Display next section'" visible = "help == 'section'" [main.ifsection.sub] - ask = "Display if helpLink question is filled" + ask = "I can haz cheezburgers?" type = "string" [bind] name = "Bind panel" [bind.settings] - name = "App settings" + name = "Bind to settings" [bind.settings.arg1] ask = "Save app settings arg1" type = "string" [bind.variable] - name = "YAML" + name = "Bind to key/value in files" [bind.variable.arg2] - ask = "Save arg2 in YAML" + ask = "I can haz value for arg2 in test.yml ?" type = "string" bind = ":__FINALPATH__/test.yml" [bind.variable.arg3] - ask = "Save arg3 in JSON" + ask = "I can haz value for arg3 in test.json ?" type = "string" bind = ":__FINALPATH__/test.json" [bind.variable.arg4] - ask = "Save arg4 in INI" + ask = "I can haz value for arg4 in test.ini ?" type = "string" bind = ":__FINALPATH__/test.ini" [bind.variable.arg5] - ask = "Save arg5 in PHP file" + ask = "I can haz value for arg5 in test.php ?" type = "string" bind = ":__FINALPATH__/test.php" [bind.variable.arg6] - ask = "Save arg6 in python file" + ask = "I can haz value for arg6 in test.py ?" type = "string" bind = ":__FINALPATH__/test.py" [bind.file] - name = "File" + name = "Bind to an entire file" [bind.file.arg7] - ask = "Save a cube file" + ask = "I can haz a .cube ?" type = "file" accept = ".cube" bind = "__FINALPATH__/test.cube" [bind.file.arg7b] - ask = "Nginx file" + ask = "Emeged i can edit sum file!#1!" type = "text" bind = "__FINALPATH__/nginx.conf" [bind.function] - name = "Bash function" + name = "Custom bash getters / validators / setters" [bind.function.arg8] ask = "Custom validator and setter for arg8 password" From 1d758642aec85b1edd740abb9ed1d48e43d2d016 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 6 Sep 2021 16:45:27 +0200 Subject: [PATCH 4/5] Moar tweaking of the config panel example because idk --- config_app_ynh/config_panel.toml | 124 ++++++++++++++++--------------- 1 file changed, 66 insertions(+), 58 deletions(-) diff --git a/config_app_ynh/config_panel.toml b/config_app_ynh/config_panel.toml index 73bfcef..0d83a8d 100644 --- a/config_app_ynh/config_panel.toml +++ b/config_app_ynh/config_panel.toml @@ -6,11 +6,11 @@ services = ["nginx"] [main.components] name = "Classic fields" - + [main.components.boolean] ask = "I can haz boolean?" type = "boolean" - + [main.components.number] ask = "I can haz number?" type = "number" @@ -23,15 +23,15 @@ services = ["nginx"] min = 0 max = 100 step = 10 - + [main.components.str] ask = "I can haz string?" type = "string" - + [main.components.text] ask = "I can haz text?" type = "text" - + [main.components.password] ask = "I can haz paszwurd?" type = "password" @@ -39,42 +39,42 @@ services = ["nginx"] [main.components.path] ask = "I can haz path?" type = "path" - + [main.components.email] ask = "I can haz email?" type = "email" - + [main.components.url] ask = "I can haz url?" type = "url" - + [main.components.date] ask = "I can haz date?" type = "date" - + [main.components.time] ask = "I can haz time?" type = "time" - + [main.components.color] ask = "I can haz color?" type = "color" - + [main.components.select] - ask = "I can chose option?" + ask = "I can haz choices?" type = "select" - choices.option1 = "Plop1" - choices.option2 = "Plop2" - choices.option3 = "Plop3" - + choices.option_one = "W00t \o\" + choices.option_two = "Awesom! =D" + choices.option_three = "Uhoh? ô.o" + [main.components.domain] ask = "I can haz domain?" type = "domain" - + [main.components.user] ask = "I can haz user?" type = "user" - + [main.components.tags] ask = "I can haz several emailz?" type = "tags" @@ -82,122 +82,127 @@ services = ["nginx"] limit = 3 pattern.regexp = '^.+@.+$' pattern.error = 'An email is required for this field' - + [main.components.tags2] ask = "I can chose several tagz?" type = "tags" choices = ['table', 'chair', 'bed', 'desk'] placeholder = "Add some tags" icon = "bed" - + [main.components.file] ask = "I can haz file?" type = "file" [main.messages] name = "Messages / Read-only components" - + [main.messages.success] - ask = "I can haz success" + ask = "I can haz success!" type = "alert" style = "success" icon = "beer" - + [main.messages.info] ask = "I can haz info" type = "alert" style = "info" - + [main.messages.warning] ask = "Onoez i haz a warnin'" type = "alert" style = "warning" - + [main.messages.danger] ask = "Onoez i haz a Danger!!" type = "alert" style = "danger" - + [main.messages.display_text] ask = "I haz a simple text" type = "display_text" - + [main.messages.markdown] ask = "I haz some **awesome** *markdown* text!!" type = "markdown" - + [main.generic] - name = "Generic options" - + name = "Specific question options demo" + [main.generic.pattern] - ask = "This is a question with a pattern validation" + ask = "I can haz pattern validation!" type = "string" pattern.regexp = '^[A-F]\d\d$' pattern.error = "Provide a room like F12 : one uppercase and 2 numbers" - + [main.generic.example] - ask = "This is a question with an example value" + ask = "I can haz example value" type = "string" example = "Camille" - + [main.generic.required] - ask = "This is a required value" + ask = "I can haz required field" type = "string" optional = false - + [main.generic.help] - ask = "Here we add some help" + ask = "I can haz some help tips" + type = "string" + help = "Im in ur help text helpin' yar userz" + + [main.generic.triggervisible] + ask = "I can trigger visibility for other questionz or sectionz!!" type = "select" - help = "You can not fill this question with your keyboard (yes i know it's very useful)" - choices.question = "Display next question" - choices.section = "Display next section" - + choices.nothing = "Not triggering any invisible question/section" + choices.nextquestion = "Display next question" + choices.nextsection = "Display next section" + [main.generic.visible] ask = "This question is only displayed if previous question is set to 'Display next question'" type = "string" - visible = "help == 'question'" - + visible = "triggervisible == 'nextquestion'" + [main.ifsection] name = "This section is only displayed if the previous question is set to 'Display next section'" - visible = "help == 'section'" - + visible = "trigglervisible == 'nextsection'" + [main.ifsection.sub] ask = "I can haz cheezburgers?" type = "string" [bind] name = "Bind panel" - + [bind.settings] name = "Bind to settings" - + [bind.settings.arg1] ask = "Save app settings arg1" type = "string" [bind.variable] name = "Bind to key/value in files" - + [bind.variable.arg2] ask = "I can haz value for arg2 in test.yml ?" type = "string" bind = ":__FINALPATH__/test.yml" - + [bind.variable.arg3] ask = "I can haz value for arg3 in test.json ?" type = "string" bind = ":__FINALPATH__/test.json" - + [bind.variable.arg4] ask = "I can haz value for arg4 in test.ini ?" type = "string" bind = ":__FINALPATH__/test.ini" - + [bind.variable.arg5] ask = "I can haz value for arg5 in test.php ?" type = "string" bind = ":__FINALPATH__/test.php" - + [bind.variable.arg6] ask = "I can haz value for arg6 in test.py ?" type = "string" @@ -205,7 +210,7 @@ name = "Bind panel" [bind.file] name = "Bind to an entire file" - + [bind.file.arg7] ask = "I can haz a .cube ?" type = "file" @@ -218,20 +223,23 @@ name = "Bind panel" bind = "__FINALPATH__/nginx.conf" [bind.function] - name = "Custom bash getters / validators / setters" - + name = "Bind to custom bash getters / validators / setters" + [bind.function.arg8] - ask = "Custom validator and setter for arg8 password" + ask = "I can haz a password ?" + help = "N.B. : This is mapped to a custom validate__/set__arg8 function in the config script" type = "password" bind = "null" - + [bind.function.arg9] ask = "Custom getter arg9" + help = "N.B.: This is mapped to a custom get__arg9 function in the config script" type = "markdown" bind = "null" - + [bind.function.alert] ask = "Custom getter alert" + help = "N.B.: This is mapped to a custom get__alert function in the config script" type = "alert" style = "info" bind = "null" From 40c7eefba68c5aec1dfa14c93a32a14d6ec4c9ec Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 6 Sep 2021 16:57:47 +0200 Subject: [PATCH 5/5] Typo --- config_app_ynh/config_panel.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config_app_ynh/config_panel.toml b/config_app_ynh/config_panel.toml index 0d83a8d..09b666a 100644 --- a/config_app_ynh/config_panel.toml +++ b/config_app_ynh/config_panel.toml @@ -63,7 +63,7 @@ services = ["nginx"] [main.components.select] ask = "I can haz choices?" type = "select" - choices.option_one = "W00t \o\" + choices.option_one = "W00t \\o\\" choices.option_two = "Awesom! =D" choices.option_three = "Uhoh? ô.o" @@ -164,7 +164,7 @@ services = ["nginx"] [main.ifsection] name = "This section is only displayed if the previous question is set to 'Display next section'" - visible = "trigglervisible == 'nextsection'" + visible = "triggervisible == 'nextsection'" [main.ifsection.sub] ask = "I can haz cheezburgers?"