Merge branch 'master' of github.com:YunoHost/test_apps

This commit is contained in:
ljf 2021-09-06 17:24:58 +02:00
commit 3e0377fe05
2 changed files with 109 additions and 100 deletions

View file

@ -3,234 +3,243 @@ version = "1.0"
[main] [main]
name = "Main panel" name = "Main panel"
services = ["nginx"] services = ["nginx"]
[main.components] [main.components]
name = "" name = "Classic fields"
[main.components.boolean] [main.components.boolean]
ask = "Put a boolean" ask = "I can haz boolean?"
type = "boolean" type = "boolean"
[main.components.number] [main.components.number]
ask = "Put a number" ask = "I can haz number?"
type = "number" type = "number"
min = 1 min = 1
max = 100 max = 100
[main.components.range] [main.components.range]
ask = "Put a range" ask = "I can haz range?"
type = "range" type = "range"
min = 0 min = 0
max = 100 max = 100
step = 10 step = 10
[main.components.str] [main.components.str]
ask = "Put a string" ask = "I can haz string?"
type = "string" type = "string"
[main.components.text] [main.components.text]
ask = "Put a text" ask = "I can haz text?"
type = "text" type = "text"
[main.components.password] [main.components.password]
ask = "Put a password" ask = "I can haz paszwurd?"
type = "password" type = "password"
[main.components.path] [main.components.path]
ask = "Put a path" ask = "I can haz path?"
type = "path" type = "path"
[main.components.email] [main.components.email]
ask = "Put a email" ask = "I can haz email?"
type = "email" type = "email"
[main.components.url] [main.components.url]
ask = "Put a url" ask = "I can haz url?"
type = "url" type = "url"
[main.components.date] [main.components.date]
ask = "Put a date" ask = "I can haz date?"
type = "date" type = "date"
[main.components.time] [main.components.time]
ask = "Put a time" ask = "I can haz time?"
type = "time" type = "time"
[main.components.color] [main.components.color]
ask = "Put a color" ask = "I can haz color?"
type = "color" type = "color"
[main.components.select] [main.components.select]
ask = "Choose an option" ask = "I can haz choices?"
type = "select" type = "select"
choices.option1 = "Plop1" choices.option_one = "W00t \\o\\"
choices.option2 = "Plop2" choices.option_two = "Awesom! =D"
choices.option3 = "Plop3" choices.option_three = "Uhoh? ô.o"
[main.components.domain] [main.components.domain]
ask = "Put a domain" ask = "I can haz domain?"
type = "domain" type = "domain"
[main.components.user] [main.components.user]
ask = "Put a user" ask = "I can haz user?"
type = "user" type = "user"
[main.components.tags] [main.components.tags]
ask = "Put some emails" ask = "I can haz several emailz?"
type = "tags" type = "tags"
placeholder = "Enter some emails separated by commas" placeholder = "Enter some emails separated by commas"
limit = 3 limit = 3
pattern.regexp = '^.+@.+$' pattern.regexp = '^.+@.+$'
pattern.error = 'An email is required for this field' pattern.error = 'An email is required for this field'
[main.components.tags2] [main.components.tags2]
ask = "Put some tags from a list" ask = "I can chose several tagz?"
type = "tags" type = "tags"
choices = ['table', 'chair', 'bed', 'desk'] choices = ['table', 'chair', 'bed', 'desk']
placeholder = "Add some tags" placeholder = "Add some tags"
icon = "bed" icon = "bed"
[main.components.file] [main.components.file]
ask = "Put a file" ask = "I can haz file?"
type = "file" type = "file"
[main.messages] [main.messages]
name = "Read only components" name = "Messages / Read-only components"
[main.messages.success] [main.messages.success]
ask = "This is a success message" ask = "I can haz success!"
type = "alert" type = "alert"
style = "success" style = "success"
icon = "beer" icon = "beer"
[main.messages.info] [main.messages.info]
ask = "This is an info message" ask = "I can haz info"
type = "alert" type = "alert"
style = "info" style = "info"
[main.messages.warning] [main.messages.warning]
ask = "This is an warning message" ask = "Onoez i haz a warnin'"
type = "alert" type = "alert"
style = "warning" style = "warning"
[main.messages.danger] [main.messages.danger]
ask = "This is a danger message" ask = "Onoez i haz a Danger!!"
type = "alert" type = "alert"
style = "danger" style = "danger"
[main.messages.display_text] [main.messages.display_text]
ask = "This is a simple text" ask = "I haz a simple text"
type = "display_text" type = "display_text"
[main.messages.markdown] [main.messages.markdown]
ask = "This is a **markdown** text" ask = "I haz some **awesome** *markdown* text!!"
type = "markdown" type = "markdown"
[main.generic] [main.generic]
name = "Generic options" name = "Specific question options demo"
[main.generic.pattern] [main.generic.pattern]
ask = "This is a question with a pattern validation" ask = "I can haz pattern validation!"
type = "string" type = "string"
pattern.regexp = '^[A-F]\d\d$' pattern.regexp = '^[A-F]\d\d$'
pattern.error = "Provide a room like F12 : one uppercase and 2 numbers" pattern.error = "Provide a room like F12 : one uppercase and 2 numbers"
[main.generic.example] [main.generic.example]
ask = "This is a question with an example value" ask = "I can haz example value"
type = "string" type = "string"
example = "Camille" example = "Camille"
[main.generic.required] [main.generic.required]
ask = "This is a required value" ask = "I can haz required field"
type = "string" type = "string"
optional = false optional = false
[main.generic.help_visible] [main.generic.help]
ask = "Here we add some help" ask = "I can haz some help tips"
type = "select"
help = "You can not feel 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_field]
ask = "Display if help question is filled"
type = "string" type = "string"
visible = "help_visible == 'question'" help = "Im in ur help text helpin' yar userz"
[main.generic.triggervisible]
ask = "I can trigger visibility for other questionz or sectionz!!"
type = "select"
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 = "triggervisible == 'nextquestion'"
[main.ifsection] [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_visible == 'section'" visible = "triggervisible == 'nextsection'"
[main.ifsection.sub] [main.ifsection.sub]
ask = "Display if helpLink question is filled" ask = "I can haz cheezburgers?"
type = "string" type = "string"
[bind] [bind]
name = "Bind panel" name = "Bind panel"
[bind.settings] [bind.settings]
name = "App settings" name = "Bind to settings"
[bind.settings.arg1] [bind.settings.arg1]
ask = "Save app settings arg1" ask = "Save app settings arg1"
type = "string" type = "string"
[bind.variable] [bind.variable]
name = "YAML" name = "Bind to key/value in files"
[bind.variable.arg2] [bind.variable.arg2]
ask = "Save arg2 in YAML" ask = "I can haz value for arg2 in test.yml ?"
type = "string" type = "string"
bind = ":__FINALPATH__/test.yml" bind = ":__FINALPATH__/test.yml"
[bind.variable.arg3] [bind.variable.arg3]
ask = "Save arg3 in JSON" ask = "I can haz value for arg3 in test.json ?"
type = "string" type = "string"
bind = ":__FINALPATH__/test.json" bind = ":__FINALPATH__/test.json"
[bind.variable.arg4] [bind.variable.arg4]
ask = "Save arg4 in INI" ask = "I can haz value for arg4 in test.ini ?"
type = "string" type = "string"
bind = ":__FINALPATH__/test.ini" bind = ":__FINALPATH__/test.ini"
[bind.variable.arg5] [bind.variable.arg5]
ask = "Save arg5 in PHP file" ask = "I can haz value for arg5 in test.php ?"
type = "string" type = "string"
bind = ":__FINALPATH__/test.php" bind = ":__FINALPATH__/test.php"
[bind.variable.arg6] [bind.variable.arg6]
ask = "Save arg6 in python file" ask = "I can haz value for arg6 in test.py ?"
type = "string" type = "string"
bind = ":__FINALPATH__/test.py" bind = ":__FINALPATH__/test.py"
[bind.file] [bind.file]
name = "File" name = "Bind to an entire file"
[bind.file.arg7] [bind.file.arg7]
ask = "Save a cube file" ask = "I can haz a .cube ?"
type = "file" type = "file"
accept = ".cube" accept = ".cube"
bind = "__FINALPATH__/test.cube" bind = "__FINALPATH__/test.cube"
[bind.file.arg7b] [bind.file.arg7b]
ask = "Nginx file" ask = "Emeged i can edit sum file!#1!"
type = "text" type = "text"
bind = "__FINALPATH__/nginx.conf" bind = "__FINALPATH__/nginx.conf"
[bind.function] [bind.function]
name = "Bash function" name = "Bind to custom bash getters / validators / setters"
[bind.function.arg8] [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" type = "password"
bind = "null" bind = "null"
[bind.function.arg9] [bind.function.arg9]
ask = "Custom getter arg9" ask = "Custom getter arg9"
help = "N.B.: This is mapped to a custom get__arg9 function in the config script"
type = "markdown" type = "markdown"
bind = "null" bind = "null"
[bind.function.alert] [bind.function.alert]
ask = "Custom getter alert" ask = "Custom getter alert"
help = "N.B.: This is mapped to a custom get__alert function in the config script"
type = "alert" type = "alert"
style = "info" style = "info"
bind = "null" bind = "null"

View file

@ -55,14 +55,14 @@ EOF
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS # SPECIFIC VALIDATORS FOR TOML SHORT KEYS
#================================================= #=================================================
validate__arg8() { validate__arg8() {
if [[ "${#arg8}" -lt 8 ]]; then echo 'Too short password'; fi if [[ "${#arg8}" -lt 12 ]]; then echo 'Too short password'; fi
} }
#================================================= #=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS # SPECIFIC SETTERS FOR TOML SHORT KEYS
#================================================= #=================================================
set__arg8() { set__arg8() {
if [ -z "${arg8}" ] if [ -n "${arg8}" ]
then then
python -c "import crypt; print(crypt.crypt(\"${arg8}\", \"\$6\$saltsalt\$\"))" > $final_path/password 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" ynh_print_info "The hash of your password has been registered in $final_path/password"