1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cryptpad_ynh.git synced 2024-09-03 18:26:14 +02:00

Use and edit upstream config.js

More custom tuning:
- no analytics communication
- no donate button
This commit is contained in:
Jimmy Monin 2017-08-01 22:19:08 +02:00
parent b207d5aa5e
commit 04aa2b2866
2 changed files with 31 additions and 6 deletions

View file

@ -128,9 +128,20 @@ popd
# CONFIGURE SERVER.JS
#=================================================
sudo mv ../conf/config.js $final_path/config.js
ynh_replace_string "__PORT__" "$port" "$final_path/config.js"
ynh_replace_string "__URL__" "$domain$path_url" "$final_path/config.js"
# Copy default configuration file
sudo mv "$final_path/config.example.js" "$final_path/config.js"
# Set service port
ynh_replace_string "httpPort: 3000" "httpPort: $port" "$final_path/config.js"
# Tune CSP to allow for YunoHost tile
ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config.js"
# Remove donate button
ynh_replace_string "removeDonateButton: false" "removeDonateButton: true" "$final_path/config.js"
# Disable analytics unsolicited communications
ynh_replace_string "adminEmail: 'i.did.not.read.my.config@cryptpad.fr'" "adminEmail: false" "$final_path/config.js"
# Store file checksum to detected user modifications on upgrade
ynh_store_file_checksum "$final_path/config.js"
#=================================================
# SET FILES OWNERSHIP

View file

@ -108,9 +108,23 @@ popd
# CONFIGURE SERVER.JS
#=================================================
sudo mv ../conf/config.js $final_path/config.js
ynh_replace_string "__URL__" "$path_url" "$final_path/config.js"
ynh_replace_string "__PORT__" "$port" "$final_path/config.js"
# Backup configuration file if changed
ynh_backup_if_checksum_is_different "$final_path/config.js"
# Copy default configuration file
sudo mv "$final_path/config.example.js" "$final_path/config.js"
# Set service port
ynh_replace_string "httpPort: 3000" "httpPort: $port" "$final_path/config.js"
# Tune CSP to allow for YunoHost tile
ynh_replace_string "\"script-src 'self'\"" "\"script-src 'self' 'unsafe-eval'\"" "$final_path/config.js"
# Remove donate button
ynh_replace_string "removeDonateButton: false" "removeDonateButton: true" "$final_path/config.js"
# Disable analytics unsolicited communications
ynh_replace_string "adminEmail: 'i.did.not.read.my.config@cryptpad.fr'" "adminEmail: false" "$final_path/config.js"
# Store file checksum to detected user modifications on upgrade
ynh_store_file_checksum "$final_path/config.js"
#=================================================
# SET FILES OWNERSHIP