1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00

Use toml for actions and config-panel

This commit is contained in:
maniack 2020-01-02 18:44:54 +01:00
parent 5267ea2802
commit 4f7bac2448
4 changed files with 98 additions and 144 deletions

View file

@ -1,64 +0,0 @@
[{
"id": "clean_ip",
"name": "Clean old ip from database",
"command": "/bin/bash scripts/actions/clean_ip",
"user": "root",
"accepted_return_codes": [0],
"description": {
"en": "Remove obsolete IP from the database.",
"fr": "Supprime les IP obsolètes de la base de donnée."
}
},
{
"id": "clean_images",
"name": "Clean old images",
"command": "/bin/bash scripts/actions/clean_images",
"user": "root",
"accepted_return_codes": [0],
"description": {
"en": "Remove expired images.",
"fr": "Supprime les images dont le délai a expiré."
}
},
{
"id": "check_quota",
"name": "Check disk quota",
"command": "/bin/bash scripts/actions/check_quota",
"user": "root",
"accepted_return_codes": [0],
"description": {
"en": "Check the disk quota for images stored by Lutim.",
"fr": "Vérifie l'occupation de l'espace du dossier des images."
}
},
{
"id": "reset_default_config",
"name": "Reset the config file and restore a default one.",
"command": "/bin/bash scripts/actions/reset_default_config \"lutim.conf\"",
"user": "root",
"accepted_return_codes": [0],
"description": {
"en": "Reset the config file lutim.conf.",
"fr": "Réinitialise le fichier de configuration lutim.conf."
}
},
{
"id": "public_private",
"name": "Move to public or private",
"command": "/bin/bash scripts/actions/public_private",
"user": "root",
"accepted_return_codes": [0],
"description": {
"en": "Change the public access of the app."
},
"arguments": [
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public app ?"
},
"default": true
}
]
}]

35
actions.toml Normal file
View file

@ -0,0 +1,35 @@
[clean_ip]
name = "Clean old ip from database"
command = "/bin/bash scripts/actions/clean_ip"
accepted_return_codes = [0]
description = "Remove obsolete IP from the database."
[clean_images]
name = "Clean old images"
command = "/bin/bash scripts/actions/clean_images"
accepted_return_codes = [0]
description = "Remove expired images."
[check_quota]
name = "Check disk quota"
command = "/bin/bash scripts/actions/check_quota"
accepted_return_codes = [0]
description = "Check the disk quota for images stored by Lutim."
[reset_default_config]
name = "Reset the config file and restore a default one."
command = "/bin/bash scripts/actions/reset_default_config \"lutim.conf\""
accepted_return_codes = [0]
description = "Reset the config file lutim.conf."
[public_private]
name = "Move to public or private"
command = "/bin/bash scripts/actions/public_private"
accepted_return_codes = [0]
description = "Change the public access of the app."
[public_private.arguments]
[public_private.arguments.is_public]
type = "boolean"
ask = "Is it a public app ?"
default = true

View file

@ -1,80 +0,0 @@
{
"name": "Lutim configuration panel",
"version": "0.1",
"panel": [{
"name": "Lutim configuration",
"id": "main",
"sections": [{
"name": "Lutim configuration",
"id": "configuration",
"options": [{
"name": "Force the encryption of images ?",
"id": "always_encrypt",
"type": "bool",
"default": true
},
{
"name": "Anti-flood protection delay (seconds)",
"help": "Users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds.",
"id": "antiflood",
"type": "number",
"default": 0
},
{
"name": "Default time limit for files",
"help": "We can't use a choices field for now. In the meantime please choose between one of this values:<br>None, Day, Week, Month, Year.",
"id": "delay",
"type": "text",
"//": "\"choices\" : [\"None\", \"Day\", \"Week\", \"Month\", \"Year\"]",
"default" : "Year"
}]
},
{
"name": "Public access",
"id": "is_public",
"options": [{
"name": "Is it a public app ?",
"id": "is_public",
"type": "bool",
"default": true
}]
},
{
"name": "Overwriting config files",
"id": "overwrite_files",
"options": [{
"name": "Overwrite the config file lutim.conf ?",
"help": "If the file is overwritten, a backup will be created.",
"id": "overwrite_settings",
"type": "bool",
"default": true
},
{
"name": "Overwrite the nginx config file ?",
"help": "If the file is overwritten, a backup will be created.",
"id": "overwrite_nginx",
"type": "bool",
"default": true
},
{
"name": "Overwrite the systemd config file ?",
"help": "If the file is overwritten, a backup will be created.",
"id": "overwrite_systemd",
"type": "bool",
"default": true
}]
},
{
"name": "Global configuration",
"id": "global_config",
"options": [{
"name": "Send HTML email to admin ?",
"help": "Allow app scripts to send HTML mails instead of plain text.",
"id": "email_type",
"type": "bool",
"default": true
}]
}]
}
]
}

63
config_panel.toml Normal file
View file

@ -0,0 +1,63 @@
version = "0.1"
name = "Lutim configuration panel"
[main]
name = "Lutim configuration"
[main.configuration]
name = "Lutim configuration"
[main.configuration.always_encrypt]
ask = "Force the encryption of images ?"
type = "boolean"
default = true
[main.configuration.antiflood]
ask = "Anti-flood protection delay (seconds)"
type = "number"
default = 0
help = "Users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds."
[main.configuration.delay]
ask = "Default time limit for files"
choices = ["None", "Day", "Week", "Month", "Year"]
default = "Year"
help = "Users won't be able to ask Lutim to download images more than one per anti_flood_delay seconds."
[main.is_public]
name = "Public access"
[main.is_public.is_public]
ask = "Is it a public website?"
type = "boolean"
default = true
[main.overwrite_files]
name = "Overwriting config files"
[main.overwrite_files.overwrite_settings]
ask = "Overwrite the config file lutim.conf ?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_nginx]
ask = "Overwrite the nginx config file ?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_systemd]
ask = "Overwrite the systemd config file ?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.global_config]
name = "Global configuration"
[main.global_config.email_type]
ask = "Send HTML email to admin ?"
type = "boolean"
default = true
help = "Allow app scripts to send HTML mails instead of plain text."