mirror of
https://github.com/YunoHost-Apps/flohmarkt_ynh.git
synced 2024-09-03 18:36:30 +02:00
pimp my config_panel
This commit is contained in:
parent
4e25546bc1
commit
7929740b84
3 changed files with 70 additions and 11 deletions
|
@ -1,16 +1,33 @@
|
|||
version = "1.0"
|
||||
[notifications]
|
||||
name = "notifications"
|
||||
help.en = "The flohmarkt yunohost integration uses urlwatch to check for changes in the user database."
|
||||
help.de = "Die flohmarkt yunohost Integration verwendet urlwatch um Änderungen an der Benutzerdatenbank zu überwachen."
|
||||
[notifications.email]
|
||||
name = "notify via email"
|
||||
[notifications.email.admin_mail]
|
||||
[main]
|
||||
name.en = "configuration"
|
||||
name.de = "Konfiguration"
|
||||
[main.notifications]
|
||||
name.en = "email notifications"
|
||||
name.de = "E-Mail Benachrichtigungen"
|
||||
[main.notifications.admin_mail]
|
||||
type = "email"
|
||||
ask.en = "email address of this flohmarkts admin"
|
||||
help.en = "you'll get notified about events like changes in the user database of flohmarkt"
|
||||
ask.de = "E-Mail Adresse des Administrators dieses flohmarkts"
|
||||
help.de = "an diese Adresse werden Informationen zu z.B. Änderungen an der Benutzerdatenbank geschickt"
|
||||
ask.en = "recipient of notifications"
|
||||
help.en = "this email gets notified about events like changes in the user database of flohmarkt"
|
||||
ask.de = "Empfänger von Benachrichtigungen"
|
||||
help.de = "an diese E-Mail Adresse werden Informationen zu z.B. Änderungen an der Benutzerdatenbank geschickt"
|
||||
bind = "email>to:__INSTALL_DIR__/urlwatch/config.yaml"
|
||||
|
||||
[main.flohmarkt]
|
||||
name.en = "flohmarkt settings"
|
||||
name.de = "flohmarkt Konfiguration"
|
||||
[main.flohmarkt.flohmarkt_initial_setup_url]
|
||||
type = "text"
|
||||
readonly = true
|
||||
ask.en = "initial setup"
|
||||
ask.de = "Initiales Setup"
|
||||
help.en = "open this url to finish your flohmarkt setup"
|
||||
help.de = "öffne die URL um flohmarkt fertig zu konfigurieren"
|
||||
|
||||
#[flohmarkt_setup]
|
||||
# name = "setup"
|
||||
# [flohmarkt_setup.flohmarkt_initial_setup_url]
|
||||
# name = "initial setup url"
|
||||
# type = "string"
|
||||
# ask = "open this url to initially setup flohmarkt"
|
||||
# help = "you can't change this value"
|
||||
|
|
|
@ -776,6 +776,18 @@ flohmarkt_ynh_urlwatch_cron() {
|
|||
--cache /var/www/${app}/urlwatch/cache.file
|
||||
}
|
||||
|
||||
flohmarkt_initialized() {
|
||||
flohmarkt_ynh_local_curl -n -m GET -u admin -p "$password_couchdb_admin" \
|
||||
-l '"initialized":true' \
|
||||
"http://127.0.0.1:5984/${app}/instance_settings"
|
||||
}
|
||||
|
||||
flohmarkt_ynh_get_initialization_key() {
|
||||
flohmarkt_ynh_local_curl -n -m GET -u admin -p "$password_couchdb_admin" \
|
||||
"http://127.0.0.1:5984/${app}/instance_settings" \
|
||||
| jq -r .initialization_key
|
||||
}
|
||||
|
||||
# move files and directories to their new places
|
||||
flohmarkt_ynh_upgrade_path_ynh5() {
|
||||
# flohmarkt and couchdb are already stopped in upgrade script
|
||||
|
|
30
scripts/config
Normal file
30
scripts/config
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /etc/yunohost/apps/$app/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_abort_if_errors
|
||||
|
||||
# my code starts here:
|
||||
|
||||
get__flohmarkt_initial_setup_url(){
|
||||
local init_key="$(flohmarkt_ynh_get_initialization_key)"
|
||||
# TODO: wenn leer, dann etwas anderes zurückgeben
|
||||
if ! [[ -v init_key ]] ||
|
||||
[[ "${init_key}" == 'null' ]] ||
|
||||
[[ -z "${init_key}" ]]
|
||||
then
|
||||
if flohmarkt_initialized; then
|
||||
echo '✅ <b>done already</b>'
|
||||
else
|
||||
echo "<b><font color=\"red\">error:</font></b> couldn't find the initialization key"
|
||||
fi
|
||||
else
|
||||
echo -n "<b><a href=\"https://${domain}/setup/${init_key}\" target=\"_blank\">"
|
||||
echo "https://${domain}/setup/${init_key}</a></b>"
|
||||
fi
|
||||
}
|
||||
|
||||
# https://yunohost.org/en/packaging_config_panels#custom-getter-setter
|
||||
# we're supposed to put this here, to fill variables with values from settings
|
||||
ynh_app_config_run $1
|
Loading…
Add table
Reference in a new issue