1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mumble-web_ynh.git synced 2024-09-03 19:46:16 +02:00

Add config file

This commit is contained in:
ericgaspar 2021-06-05 13:47:20 +02:00
parent 4bfa9f389b
commit 5f84e6fd6f
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 60 additions and 115 deletions

43
conf/config.local.js Normal file
View file

@ -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'

View file

@ -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"
}

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
#=================================================