diff --git a/check_process b/check_process index 7e9587d..8da872d 100644 --- a/check_process +++ b/check_process @@ -1,9 +1,9 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="john" (USER) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + path="/path" + admin="john" + is_public=1 ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/conf/nginx.conf b/conf/nginx.conf index e68d709..f137e5a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,3 +1,4 @@ +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { proxy_pass http://127.0.0.1:__PORT__/; diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..f75cea7 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +Droppy is a self-hosted file storage server with a web interface and capabilities to edit files and view media directly in the browser. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..b2dc61d --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Droppy est un serveur de stockage de fichiers auto-hébergé avec une interface Web et des capacités pour éditer des fichiers et afficher des médias directement dans le navigateur. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..05a3567 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,4 @@ +## Configuration + +How to configure this app: a JSON configuration file with SSH. `/var/www/droppy/config/config.json`. +Shared files are stored in the following directory: `/home/yunohost.app/droppy/files` diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..9dc803c --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,4 @@ +## Configuration + +Comment configurer cette application : un fichier de configuration `/var/www/droppy/config/config.json` en SSH. +Les fichiers partagés sont stockés dans le répertoire suivant : `/home/yunohost.app/droppy/files/` diff --git a/doc/screenshots/Ziv79rJ.png b/doc/screenshots/Ziv79rJ.png new file mode 100644 index 0000000..ba4dc9a Binary files /dev/null and b/doc/screenshots/Ziv79rJ.png differ diff --git a/manifest.json b/manifest.json index 8b8fc4c..45aed83 100644 --- a/manifest.json +++ b/manifest.json @@ -8,12 +8,20 @@ }, "version": "12.2.0~ynh6", "url": "https://github.com/silverwind/droppy", + "upstream": { + "license": "BSD-2-Clause", + "website": "https://github.com/silverwind/droppy", + "demo": "https://demo.example.com", + "admindoc": "https://yunohost.org/packaging_apps", + "userdoc": "https://yunohost.org/apps", + "code": "https://github.com/silverwind/droppy" + }, "license": "BSD-2-Clause", "maintainer": { "name": "eric_G" }, "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.2.4" }, "multi_instance": false, "services": [ diff --git a/scripts/backup b/scripts/backup index 43b5bd2..cd48850 100644 --- a/scripts/backup +++ b/scripts/backup @@ -28,6 +28,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -52,7 +53,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP DATADIR DIRECTORY #================================================= -ynh_backup --src_path="/home/yunohost.app/$app" +ynh_backup --src_path="$data_path" #================================================= # BACKUP SYSTEMD diff --git a/scripts/install b/scripts/install index 99536a1..233bc09 100644 --- a/scripts/install +++ b/scripts/install @@ -76,6 +76,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -99,10 +103,10 @@ ynh_system_user_create --username=$app --home_dir=$final_path #============================================== ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=26 -pushd "$final_path" || ynh_die +pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_npm install -popd || ynh_die +popd #================================================= # CREATE DIRECTORY FOR DATA AND CONFIG @@ -110,16 +114,17 @@ popd || ynh_die ynh_script_progression --message="Creating the data directory..." --weight=1 # Define app's data directory -data_path="/home/yunohost.app/${app}" +data_path=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=data_path --value=$data_path # Create datadir folder mkdir -p $data_path - -# Create config folder mkdir -p $final_path/config # Give permission to the datadir -chown -R $app: "$data_path" +chmod 750 "$data_path" +chmod -R o-rwx "$data_path" +chown -R $app:www-data "$data_path" #================================================= # SETUP SYSTEMD @@ -127,7 +132,6 @@ chown -R $app: "$data_path" ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" ynh_add_systemd_config @@ -137,18 +141,8 @@ ynh_add_systemd_config ynh_script_progression --message="Modifying a config file..." --weight=1 ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." --weight=1 - -# Set permissions to app files -chown -R $app: $final_path -chmod 755 $final_path chmod 600 $final_path/config/config.json +chown $app:$app $final_path/config/config.json #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/remove b/scripts/remove index 92f6166..aa7454a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # STANDARD REMOVE @@ -59,7 +60,7 @@ ynh_secure_remove --file="$final_path" # REMOVE DATADIR DIRECTORY #================================================= -ynh_secure_remove --file="/home/yunohost.app/$app" +ynh_secure_remove --file="$data_path" #================================================= # REMOVE NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 5276b01..e9cc1d9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,14 +29,13 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " @@ -64,14 +63,9 @@ ynh_script_progression --message="Restoring $app main directory..." --weight=20 ynh_restore_file --origin_path="$final_path" -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." - -# Restore permissions on app files -chown -R $app:$app $final_path -chmod 755 $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # SPECIFIC RESTORATION @@ -92,12 +86,15 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet #================================================= -# RESTORE VARIOUS FILES +# RESTORE THE DATA DIRECTORY #================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file "/home/yunohost.app/$app" -chown -R $app: "/home/yunohost.app/$app" -chmod 600 $final_path/config/config.json +ynh_restore_file --origin_path="$data_path" --not_mandatory + +chmod 750 "$data_path" +chmod -R o-rwx "$data_path" +chown -R $app:www-data "$data_path" #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index 66866c6..f6841e4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,6 +86,10 @@ then ynh_setup_source --dest_dir=$final_path fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -103,43 +107,27 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=2 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= -# SPECIFIC UPGRADE -#============================================== # INSTALL DROPPY -#============================================== +#================================================= + if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=25 - pushd "$final_path" || ynh_die + pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_npm install - popd || ynh_die + popd fi -#================================================= -# CREATE DIRECTORY FOR DATA AND CONFIG -#================================================= -ynh_script_progression --message="Creating the data directory..." --weight=1 - -# Define app's data directory -data_path="/home/yunohost.app/${app}" - -# Create datadir folder -mkdir -p $data_path - -# Create config folder -mkdir -p $final_path/config - -# Give permission to the datadir -chown -R $app:$app "$data_path" - #================================================= # MODIFY A CONFIG FILE #================================================= ynh_script_progression --message="Modifying a config file..." --weight=2 ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config/config.json" +chmod 600 $final_path/config/config.json +chown $app:$app $final_path/config/config.json #================================================= # SETUP SYSTEMD @@ -147,23 +135,10 @@ ynh_add_config --template="../conf/config.json.example" --destination="$final_pa ynh_script_progression --message="Configuring a systemd service..." --weight=2 ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." --weight=2 - -# Set permissions on app files -chown -R $app:$app $final_path -chmod 755 $final_path -chmod 600 $final_path/config/config.json - #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================