diff --git a/conf/config.local.js b/conf/config.local.js new file mode 100644 index 0000000..0644d96 --- /dev/null +++ b/conf/config.local.js @@ -0,0 +1,43 @@ +// You can overwrite the default configuration values set in [config.js] here. +// There should never be any required changes to this file and you can always +// simply copy it over when updating to a new version. + +let config = window.mumbleWebConfig // eslint-disable-line no-unused-vars + +// E.g. changing default address and theme: +// config.defaults.address = 'voice.example.com' +// config.defaults.theme = 'MetroMumbleDark' + + +// Which fields to show on the Connect to Server dialog +// config.connectDialog.address : 'true' +// config.connectDialog.port : 'true' +// config.connectDialog.token : 'true' +// config.connectDialog.username : 'true' +// config.connectDialog.password : 'true' +// config.connectDialog.channelName : 'false' + +// Default values for user settings +// You can see your current value by typing `localStorage.getItem('mumble.$setting')` in the web console. +// config.settings.voiceMode : 'vad' // one of 'cont' (Continuous), 'ptt' (Push-to-Talk), 'vad' (Voice Activity Detection) +// config.settings.pttKey : 'ctrl + shift' +// config.settings.vadLevel : '0.3' +// config.settings.toolbarVertical : 'false' +// config.settings.showAvatars : 'always' // one of 'always', 'own_channel', 'linked_channel', 'minimal_only', 'never' +// config.settings.userCountInChannelName : 'false' +// config.settings.audioBitrate : '40000' // bits per second +// config.settings.samplesPerPacket : '960' + +// Default values (can be changed by passing a query parameter of the same name) +// Connect Dialog +// config.defaults.address': window.location.hostname, +// config.defaults.port : '443' +// config.defaults.token : '' +// config.defaults.username': '' +// config.defaults.password': '', +// config.defaults.joinDialog : 'false' // replace whole dialog with single "Join Conference" button +// config.defaults.matrix : 'false' // enable Matrix Widget support (mostly auto-detected; implies 'joinDialog') +// config.defaults.avatarurl : '' // download and set the user's Mumble avatar to the image at this URL + +// General +// config.defaults.theme : 'MetroMumbleLight' diff --git a/scripts/_common.sh b/scripts/_common.sh index 4bf5b18..76ecdb8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -21,65 +21,3 @@ nodejs_version=12 #================================================= # FUTURE OFFICIAL HELPERS #================================================= - -# Send an email to inform the administrator -# -# usage: ynh_send_readme_to_admin app_message [recipients] -# | arg: app_message - The message to send to the administrator. -# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root -# example: "root admin@domain" -# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you -# example: "root admin@domain user1 user2" -ynh_send_readme_to_admin() { - local app_message="${1:-...No specific information...}" - local recipients="${2:-root}" - - # Retrieve the email of users - find_mails () { - local list_mails="$1" - local mail - local recipients=" " - # Read each mail in argument - for mail in $list_mails - do - # Keep root or a real email address as it is - if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" - then - recipients="$recipients $mail" - else - # But replace an user name without a domain after by its email - if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) - then - recipients="$recipients $mail" - fi - fi - done - echo "$recipients" - } - recipients=$(find_mails "$recipients") - - local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!" - - local mail_message="This is an automated message from your beloved YunoHost server. - -Specific information for the application $app. - -$app_message - ---- -Automatic diagnosis data from YunoHost - -$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" - - # Define binary to use for mail command - if [ -e /usr/bin/bsd-mailx ] - then - local mail_bin=/usr/bin/bsd-mailx - else - local mail_bin=/usr/bin/mail.mailutils - fi - - # Send the email to the recipients - echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" -} - diff --git a/scripts/install b/scripts/install index 8ce8a61..5a75620 100644 --- a/scripts/install +++ b/scripts/install @@ -93,9 +93,19 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="../conf/config.local.js" --destination="$final_path/dist/config.local.js" + +chmod 400 "$final_path/dist/config.local.js" +chown $app "$final_path/dist/config.local.js" + #================================================= # SPECIFIC SETUP #================================================= @@ -126,7 +136,6 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -# Add Mumble as a YunoHost service yunohost service add $app --description="Mumble web interface" --log="/var/log/$app/$app.log" #================================================= @@ -134,7 +143,7 @@ yunohost service add $app --description="Mumble web interface" --log="/var/log/$ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action=restart --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" #================================================= # SETUP SSOWAT @@ -154,27 +163,6 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload -#================================================= -# SEND README TO ADMIN -#================================================= - -# message=" -# Port : $port -# Password to join server: $server_password -# SuperUser Password : $su_passwd -# Welcome text : $welcometext -# Root channel (your Mumble server name): $registername -# Final path (where to find your files) : $final_path -# Mumble configuration file : $final_path/mumble-server.ini - -# Note about config file: this package will regenerate the config file on upgrade. -# If you changed it manually and upgrade Mumble, you'll find a backup in $final_path. - -# Are you facing an issue, want to improve this app or say thank you? -# Please open a new issue in this project: https://github.com/YunoHost-Apps/mumbleserver_ynh -# " -# ynh_send_readme_to_admin "$message" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 05719af..0c935ee 100644 --- a/scripts/restore +++ b/scripts/restore @@ -93,7 +93,7 @@ systemctl enable "$app.service" --quiet #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index b99c3d7..fb38f80 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,10 +83,10 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$final_path" --keep="$final_path/dist/config.local.js" fi chmod 750 "$final_path" @@ -106,8 +106,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=1 -# Install Mumble Debian package via apt -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs --nodejs_version=$nodejs_version @@ -134,7 +133,7 @@ yunohost service add $app --description="Mumble web interface" --log="/var/log/$ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # RELOAD NGINX @@ -143,29 +142,6 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload -#================================================= -# SEND README TO ADMIN -#================================================= - -# message=" -# Mumble server was updated! - -# Port : $port -# Password to join server: $server_password -# SuperUser Password : $su_passwd -# Welcome text : $welcometext -# Root channel (your mumble server name): $registername -# Final path (where to find your files) : $final_path -# Mumble configuration file : $final_path/mumble-server.ini - -# Note about config file: this package will regenerate the config file on upgrade. -# If you changed it manually and upgrade mumble, you'll find a backup in $final_path. - -# Are you facing an issue, want to improve this app or say thank you? -# Please open a new issue in this project: https://github.com/YunoHost-Apps/mumbleserver_ynh -# " -# ynh_send_readme_to_admin "$message" - #================================================= # END OF SCRIPT #=================================================