mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
Add actions and config-panel
This commit is contained in:
parent
229e330719
commit
21a002970b
8 changed files with 602 additions and 2 deletions
33
actions.json
Normal file
33
actions.json
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
[{
|
||||||
|
"id": "add_remove_abiword",
|
||||||
|
"name": "Install/remove abiword",
|
||||||
|
"command": "/bin/bash scripts/actions/add_remove_abiword",
|
||||||
|
"user": "root",
|
||||||
|
"accepted_return_codes": [0],
|
||||||
|
"description": {
|
||||||
|
"en": "Install or remove abiword.",
|
||||||
|
"fr": "Installe ou supprime abiword."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "add_remove_libreoffice",
|
||||||
|
"name": "Install/remove libreoffice",
|
||||||
|
"command": "/bin/bash scripts/actions/add_remove_libreoffice",
|
||||||
|
"user": "root",
|
||||||
|
"accepted_return_codes": [0],
|
||||||
|
"description": {
|
||||||
|
"en": "Install or remove libreoffice.",
|
||||||
|
"fr": "Installe ou supprime libreoffice."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "list_all_pads",
|
||||||
|
"name": "List all existing pads",
|
||||||
|
"command": "/bin/bash scripts/actions/list_all_pads",
|
||||||
|
"user": "root",
|
||||||
|
"accepted_return_codes": [0],
|
||||||
|
"description": {
|
||||||
|
"en": "List all existing pads.",
|
||||||
|
"fr": "Liste tout les pads existants."
|
||||||
|
}
|
||||||
|
}]
|
87
config_panel.json
Normal file
87
config_panel.json
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
{
|
||||||
|
"name": "Etherpad configuration panel",
|
||||||
|
"version": "0.1",
|
||||||
|
"panel": [{
|
||||||
|
"name": "Etherpad configuration",
|
||||||
|
"id": "main",
|
||||||
|
"sections": [{
|
||||||
|
"name": "Export",
|
||||||
|
"id": "export",
|
||||||
|
"options": [{
|
||||||
|
"name": "Use abiword (~260Mo) or libreoffice (~400Mo) (more stable) to expand export possibilities (pdf, doc) ?",
|
||||||
|
"help": "We can't use a choices field for now. In the meantime please choose between one of this values:<br>none, abiword, libreoffice.",
|
||||||
|
"id": "export",
|
||||||
|
"type": "text",
|
||||||
|
"//": "\"choices\" : [\"none\", \"abiword\", \"libreoffice\"]",
|
||||||
|
"default" : "none"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Default pad configuration",
|
||||||
|
"id": "pad_configuration",
|
||||||
|
"options": [{
|
||||||
|
"name": "Hide authorship colors ?",
|
||||||
|
"id": "pad_config_nocolors",
|
||||||
|
"type": "bool",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Show line numbers ?",
|
||||||
|
"id": "pad_config_showlinenumbers",
|
||||||
|
"type": "bool",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Show chat and users ?",
|
||||||
|
"id": "pad_config_chatandusers",
|
||||||
|
"type": "bool",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Always show chat ?",
|
||||||
|
"id": "pad_config_alwaysshowchat",
|
||||||
|
"type": "bool",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Show markdown syntax ?",
|
||||||
|
"id": "pad_config_show_markdown",
|
||||||
|
"type": "bool",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Page view ?",
|
||||||
|
"id": "pad_config_pageview",
|
||||||
|
"type": "bool",
|
||||||
|
"default": false
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mypads configuration",
|
||||||
|
"id": "mypads_configuration",
|
||||||
|
"options": [{
|
||||||
|
"name": "Enable Mypads plugin ?",
|
||||||
|
"id": "mypads",
|
||||||
|
"type": "bool",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Use ldap with Mypads ?",
|
||||||
|
"id": "useldap",
|
||||||
|
"type": "bool",
|
||||||
|
"default": true
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Public access",
|
||||||
|
"id": "is_public",
|
||||||
|
"options": [{
|
||||||
|
"name": "Is it a public website ?",
|
||||||
|
"id": "is_public",
|
||||||
|
"type": "bool",
|
||||||
|
"default": true
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
94
scripts/actions/add_remove_abiword
Executable file
94
scripts/actions/add_remove_abiword
Executable file
|
@ -0,0 +1,94 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
app=$YNH_APP_ID
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF ARGUMENTS ARE CORRECT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF AN ACTION HAS TO BE DONE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Check the dependencies of the meta packages of etherpad_mypads with apt-cache
|
||||||
|
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword
|
||||||
|
then
|
||||||
|
# abiword is already a dependence of etherpad_mypads.
|
||||||
|
# abiword should be removed.
|
||||||
|
abiword=0
|
||||||
|
ynh_print_info "Abiword will be removed." >&2
|
||||||
|
else
|
||||||
|
# abiword isn't a dependence of etherpad_mypads.
|
||||||
|
# abiword should be installed.
|
||||||
|
ynh_print_info "Abiword will be installed." >&2
|
||||||
|
abiword=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer
|
||||||
|
then
|
||||||
|
# libreoffice is already a dependence of etherpad_mypads.
|
||||||
|
# Keep it
|
||||||
|
libreoffice=1
|
||||||
|
else
|
||||||
|
# libreoffice isn't a dependence of etherpad_mypads.
|
||||||
|
# Do not add it
|
||||||
|
libreoffice=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC ACTION
|
||||||
|
#=================================================
|
||||||
|
# INSTALL OR REMOVE ABIWORD
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Load common variables, and especially abiword dependencies.
|
||||||
|
source scripts/_variables
|
||||||
|
|
||||||
|
dependencies=""
|
||||||
|
if [ $abiword -eq 1 ]
|
||||||
|
then
|
||||||
|
# Add abiword dependencies if abiword has to be installed
|
||||||
|
dependencies="$dependencies $abiword_app_depencencies"
|
||||||
|
fi
|
||||||
|
if [ $libreoffice -eq 1 ]
|
||||||
|
then
|
||||||
|
# Add libreoffice dependencies if libreoffice is already installed to keep it as a dependence.
|
||||||
|
dependencies="$dependencies $libreoffice_app_dependencies"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rebuild the meta package and install the new dependencies
|
||||||
|
( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it.
|
||||||
|
ynh_install_app_dependencies $dependencies)
|
||||||
|
|
||||||
|
# Remove all unused dependencies
|
||||||
|
ynh_package_autopurge
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SET THE DEFAULT EXPORT APP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ $abiword -eq 1 ]
|
||||||
|
then
|
||||||
|
# Set abiword as default export app
|
||||||
|
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
|
||||||
|
elif [ $libreoffice -eq 1 ]
|
||||||
|
then
|
||||||
|
# Set libreoffice as default export app
|
||||||
|
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice"
|
||||||
|
else
|
||||||
|
# Remove any export app
|
||||||
|
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none"
|
||||||
|
fi
|
94
scripts/actions/add_remove_libreoffice
Executable file
94
scripts/actions/add_remove_libreoffice
Executable file
|
@ -0,0 +1,94 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
app=$YNH_APP_ID
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF ARGUMENTS ARE CORRECT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF AN ACTION HAS TO BE DONE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Check the dependencies of the meta packages of etherpad_mypads with apt-cache
|
||||||
|
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer
|
||||||
|
then
|
||||||
|
# libreoffice is already a dependence of etherpad_mypads.
|
||||||
|
# libreoffice should be removed.
|
||||||
|
libreoffice=0
|
||||||
|
ynh_print_info "Libreoffice writer will be removed." >&2
|
||||||
|
else
|
||||||
|
# libreoffice isn't a dependence of etherpad_mypads.
|
||||||
|
# libreoffice should be installed.
|
||||||
|
ynh_print_info "Libreoffice writer will be installed." >&2
|
||||||
|
libreoffice=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword
|
||||||
|
then
|
||||||
|
# abiword is already a dependence of etherpad_mypads.
|
||||||
|
# Keep it
|
||||||
|
abiword=1
|
||||||
|
else
|
||||||
|
# abiword isn't a dependence of etherpad_mypads.
|
||||||
|
# Do not add it
|
||||||
|
abiword=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC ACTION
|
||||||
|
#=================================================
|
||||||
|
# INSTALL OR REMOVE LIBREOFFICE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Load common variables, and especially libreoffice dependencies.
|
||||||
|
source scripts/_variables
|
||||||
|
|
||||||
|
dependencies=""
|
||||||
|
if [ $libreoffice -eq 1 ]
|
||||||
|
then
|
||||||
|
# Add libreoffice dependencies if libreoffice has to be installed
|
||||||
|
dependencies="$dependencies $libreoffice_app_dependencies"
|
||||||
|
fi
|
||||||
|
if [ $abiword -eq 1 ]
|
||||||
|
then
|
||||||
|
# Add abiword dependencies if abiword is already installed to keep it as a dependence.
|
||||||
|
dependencies="$dependencies $abiword_app_depencencies"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rebuild the meta package and install the new dependencies
|
||||||
|
( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it.
|
||||||
|
ynh_install_app_dependencies $dependencies)
|
||||||
|
|
||||||
|
# Remove all unused dependencies
|
||||||
|
ynh_package_autopurge
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SET THE DEFAULT EXPORT APP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ $libreoffice -eq 1 ]
|
||||||
|
then
|
||||||
|
# Set libreoffice as default export app
|
||||||
|
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice"
|
||||||
|
elif [ $abiword -eq 1 ]
|
||||||
|
then
|
||||||
|
# Set abiword as default export app
|
||||||
|
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
|
||||||
|
else
|
||||||
|
# Remove any export app
|
||||||
|
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none"
|
||||||
|
fi
|
35
scripts/actions/list_all_pads
Executable file
35
scripts/actions/list_all_pads
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
app=$YNH_APP_ID
|
||||||
|
|
||||||
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF ARGUMENTS ARE CORRECT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK IF AN ACTION HAS TO BE DONE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC ACTION
|
||||||
|
#=================================================
|
||||||
|
# LIST ALL PADS FROM THE DATABASE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
mysql -u $db_name -p$db_pwd $db_name --silent -e 'select distinct substring(store.key,5,locate(":",store.key,5)-5) as "pads" from store where store.key like "pad:%"' | sed 's/^/>> /g' >&2
|
257
scripts/config
Normal file
257
scripts/config
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC STARTING
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
# Load common variables for all scripts.
|
||||||
|
source _variables
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
app=$YNH_APP_ID
|
||||||
|
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC CODE
|
||||||
|
#=================================================
|
||||||
|
# DECLARE GENERIC FUNCTION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
config_file="$final_path/settings.json"
|
||||||
|
|
||||||
|
get_config_value() {
|
||||||
|
option_name="$1"
|
||||||
|
# Get the value of this option in the config file
|
||||||
|
grep "\"$option_name\" *:" "$config_file" | cut -d':' -f2 | sed s'/ //g' | cut -d',' -f1
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD VALUES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Load the real value from the app config or elsewhere.
|
||||||
|
# Then get the value from the form.
|
||||||
|
# If the form has a value for a variable, take the value from the form,
|
||||||
|
# Otherwise, keep the value from the app config.
|
||||||
|
|
||||||
|
# Export
|
||||||
|
old_export="$(ynh_app_setting_get $app export)"
|
||||||
|
export="${YNH_CONFIG_MAIN_EXPORT_EXPORT:-$old_export}"
|
||||||
|
|
||||||
|
# padOptions noColors
|
||||||
|
old_pad_config_nocolors="$(get_config_value noColors)"
|
||||||
|
pad_config_nocolors="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_NOCOLORS:-$old_pad_config_nocolors}"
|
||||||
|
# padOptions showLineNumbers
|
||||||
|
old_pad_config_showlinenumbers="$(get_config_value showLineNumbers)"
|
||||||
|
pad_config_showlinenumbers="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOWLINENUMBERS:-$old_pad_config_showlinenumbers}"
|
||||||
|
# padOptions chatAndUsers
|
||||||
|
old_pad_config_chatandusers="$(get_config_value chatAndUsers)"
|
||||||
|
pad_config_chatandusers="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_CHATANDUSERS:-$old_pad_config_chatandusers}"
|
||||||
|
# padOptions alwaysShowChat
|
||||||
|
old_pad_config_alwaysshowchat="$(get_config_value alwaysShowChat)"
|
||||||
|
pad_config_alwaysshowchat="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT:-$old_pad_config_alwaysshowchat}"
|
||||||
|
# Plugin option ep_markdown_default
|
||||||
|
old_pad_config_show_markdown="$(get_config_value ep_markdown_default)"
|
||||||
|
pad_config_show_markdown="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN:-$old_pad_config_show_markdown}"
|
||||||
|
# Plugin option ep_page_view_default
|
||||||
|
old_pad_config_pageview="$(get_config_value ep_page_view_default)"
|
||||||
|
pad_config_pageview="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_PAGEVIEW:-$old_pad_config_pageview}"
|
||||||
|
|
||||||
|
# Mypads
|
||||||
|
if [ -d $final_path/node_modules/ep_mypads ]
|
||||||
|
then
|
||||||
|
old_mypads=true
|
||||||
|
else
|
||||||
|
old_mypads=false
|
||||||
|
fi
|
||||||
|
mypads="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS:-$old_mypads}"
|
||||||
|
# Ldap for Mypads
|
||||||
|
if grep -q "//noldap" $config_file
|
||||||
|
then
|
||||||
|
old_useldap=false
|
||||||
|
else
|
||||||
|
old_useldap=true
|
||||||
|
fi
|
||||||
|
useldap="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP:-$old_useldap}"
|
||||||
|
|
||||||
|
# is_public
|
||||||
|
old_is_public="$(ynh_app_setting_get $app is_public)"
|
||||||
|
if [ $old_is_public -eq 1 ]
|
||||||
|
then
|
||||||
|
old_is_public=true
|
||||||
|
else
|
||||||
|
old_is_public=false
|
||||||
|
fi
|
||||||
|
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
show_config() {
|
||||||
|
# here you are supposed to read some config file/database/other then print the values
|
||||||
|
# echo "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value"
|
||||||
|
|
||||||
|
echo "YNH_CONFIG_MAIN_EXPORT_EXPORT=$export"
|
||||||
|
|
||||||
|
echo "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_NOCOLORS=$pad_config_nocolors"
|
||||||
|
echo "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOWLINENUMBERS=$pad_config_showlinenumbers"
|
||||||
|
echo "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_CHATANDUSERS=$pad_config_chatandusers"
|
||||||
|
echo "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT=$pad_config_alwaysshowchat"
|
||||||
|
echo "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN=$pad_config_show_markdown"
|
||||||
|
echo "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_PAGEVIEW=$pad_config_pageview"
|
||||||
|
|
||||||
|
echo "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS=$mypads"
|
||||||
|
echo "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP=$useldap"
|
||||||
|
|
||||||
|
echo "YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC=$is_public"
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MODIFY THE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
apply_config() {
|
||||||
|
restart_etherpad=0
|
||||||
|
|
||||||
|
# Change configuration if needed
|
||||||
|
# padOptions noColors
|
||||||
|
if [ "$pad_config_nocolors" != "$old_pad_config_nocolors" ]
|
||||||
|
then
|
||||||
|
ynh_replace_string "\(\"noColors\" *: \).*," "\1$pad_config_nocolors," "$config_file"
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# padOptions showLineNumbers
|
||||||
|
if [ "$pad_config_showlinenumbers" != "$old_pad_config_showlinenumbers" ]
|
||||||
|
then
|
||||||
|
ynh_replace_string "\(\"showLineNumbers\" *: \).*," "\1$pad_config_showlinenumbers," "$config_file"
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# padOptions chatAndUsers
|
||||||
|
if [ "$pad_config_chatandusers" != "$old_pad_config_chatandusers" ]
|
||||||
|
then
|
||||||
|
ynh_replace_string "\(\"chatAndUsers\" *: \).*," "\1$pad_config_chatandusers," "$config_file"
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# padOptions alwaysShowChat
|
||||||
|
if [ "$pad_config_alwaysshowchat" != "$old_pad_config_alwaysshowchat" ]
|
||||||
|
then
|
||||||
|
ynh_replace_string "\(\"alwaysShowChat\" *: \).*," "\1$pad_config_alwaysshowchat," "$config_file"
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Plugin option ep_markdown_default
|
||||||
|
if [ "$pad_config_show_markdown" != "$old_pad_config_show_markdown" ]
|
||||||
|
then
|
||||||
|
ynh_replace_string "\(\"ep_markdown_default\" *: \).*," "\1$pad_config_show_markdown," "$config_file"
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Plugin option ep_page_view_default
|
||||||
|
if [ "$pad_config_pageview" != "$old_pad_config_pageview" ]
|
||||||
|
then
|
||||||
|
ynh_replace_string "\(\"ep_page_view_default\" *: \).*," "\1$pad_config_pageview," "$config_file"
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Export
|
||||||
|
if [ "$export" != "$old_export" ]
|
||||||
|
then
|
||||||
|
if [ "$export" = "abiword" ]
|
||||||
|
then
|
||||||
|
# if abiword isn't installed, call the action add_remove_abiword.
|
||||||
|
if ! which abiword > /dev/null
|
||||||
|
then
|
||||||
|
yunohost app action run $app add_remove_abiword
|
||||||
|
fi
|
||||||
|
ynh_replace_string "\(\"abiword\" *: \).*," "\1\"$(which abiword)\"," "$config_file"
|
||||||
|
ynh_replace_string "\(\"soffice\" *: \).*," "\1null," "$config_file"
|
||||||
|
elif [ "$export" = "libreoffice" ]
|
||||||
|
then
|
||||||
|
# if libreoffice isn't installed, call the action add_remove_libreoffice.
|
||||||
|
if ! which soffice > /dev/null
|
||||||
|
then
|
||||||
|
yunohost app action run $app add_remove_libreoffice
|
||||||
|
fi
|
||||||
|
ynh_replace_string "\(\"abiword\" *: \).*," "\1null," "$config_file"
|
||||||
|
ynh_replace_string "\(\"soffice\" *: \).*," "\1\"$(which soffice)\"," "$config_file"
|
||||||
|
else
|
||||||
|
ynh_replace_string "\(\"abiword\" *: \).*," "\1null," "$config_file"
|
||||||
|
ynh_replace_string "\(\"soffice\" *: \).*," "\1null," "$config_file"
|
||||||
|
fi
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mypads
|
||||||
|
if [ "$mypads" != "$old_mypads" ]
|
||||||
|
then
|
||||||
|
ynh_use_nodejs
|
||||||
|
pushd "$final_path"
|
||||||
|
if [ "$mypads" = "true" ]
|
||||||
|
then
|
||||||
|
npm install ep_mypads@${mypads_version}
|
||||||
|
else
|
||||||
|
npm uninstall ep_mypads
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
chown -R $app: $final_path/node_modules
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ldap for Mypads
|
||||||
|
if [ "$useldap" != "$old_useldap" ]
|
||||||
|
then
|
||||||
|
if [ "$useldap" = "true" ]
|
||||||
|
then
|
||||||
|
ynh_replace_string "//noldap\(.*\)" "\1 //useldap" "$final_path/settings.json"
|
||||||
|
else
|
||||||
|
ynh_replace_string "\(.*\) //useldap" "//noldap\1" "$final_path/settings.json"
|
||||||
|
fi
|
||||||
|
restart_etherpad=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ $restart_etherpad -eq 1 ]
|
||||||
|
then
|
||||||
|
# Wait for etherpad to be fully started
|
||||||
|
ynh_check_starting "You can access your Etherpad instance at" "/var/log/$app/etherpad.log" "120"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Change public accessibility
|
||||||
|
if [ "$is_public" = "true" ]
|
||||||
|
then
|
||||||
|
is_public=1
|
||||||
|
else
|
||||||
|
is_public=0
|
||||||
|
fi
|
||||||
|
if [ $is_public -eq 1 ]; then
|
||||||
|
ynh_app_setting_set $app skipped_uris "/"
|
||||||
|
else
|
||||||
|
ynh_app_setting_set $app skipped_uris "/admin" # etherpad admin page doesn't support SSO...
|
||||||
|
fi
|
||||||
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
yunohost app ssowatconf
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
show) show_config;;
|
||||||
|
apply) apply_config;;
|
||||||
|
esac
|
|
@ -186,7 +186,7 @@ ynh_replace_string "__LANGUAGE__" "$language" "$final_path/settings.json"
|
||||||
# Use ldap for mypads
|
# Use ldap for mypads
|
||||||
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
|
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_replace_string "//noldap" "" "$final_path/settings.json"
|
ynh_replace_string "//noldap\(.*\)" "\1 //useldap" "$final_path/settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_store_file_checksum "$final_path/settings.json" # Store config file checksum
|
ynh_store_file_checksum "$final_path/settings.json" # Store config file checksum
|
||||||
|
|
|
@ -201,7 +201,7 @@ ynh_replace_string "__LANGUAGE__" "$language" "$final_path/settings.json"
|
||||||
# Use ldap for mypads
|
# Use ldap for mypads
|
||||||
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
|
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_replace_string "//noldap" "" "$final_path/settings.json"
|
ynh_replace_string "//noldap\(.*\)" "\1 //useldap" "$final_path/settings.json"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_store_file_checksum "$final_path/settings.json" # Recalculate and store the config file checksum into the app settings
|
ynh_store_file_checksum "$final_path/settings.json" # Recalculate and store the config file checksum into the app settings
|
||||||
|
|
Loading…
Add table
Reference in a new issue