diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6eafef1..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -budget/budget.db -budget/memory -budget/settings.py -*.pyc diff --git a/README.md b/README.md index fcd4758..cceeb65 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Simple app to manage your collective expenses +I hate money is a web application made to ease shared budget management. It keeps track of who bought what, when, and for whom; and helps to settle the bills. + **Shipped version:** 4.1.5~ynh3 diff --git a/README_fr.md b/README_fr.md index 9e73549..180ff89 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,8 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -Gérez simplement vos dépenses collectives +I hate money is a web application made to ease shared budget management. It keeps track of who bought what, when, and for whom; and helps to settle the bills. + **Version incluse :** 4.1.5~ynh3 diff --git a/conf/nginx.conf b/conf/nginx.conf index e096719..5099cd6 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,10 +3,6 @@ location __PATH__/static/ { alias __PYTHON_VENV_SITE_PACKAGES__/ihatemoney/static/; } location __PATH__/ { - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..30e7422 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +I hate money is a web application made to ease shared budget management. It keeps track of who bought what, when, and for whom; and helps to settle the bills. diff --git a/manifest.json b/manifest.json index 02dc9d3..d171216 100644 --- a/manifest.json +++ b/manifest.json @@ -6,9 +6,8 @@ "en": "Simple app to manage your collective expenses", "fr": "Gérez simplement vos dépenses collectives" }, - "url": "http://ihatemoney.org/", "version": "4.1.5~ynh3", - "license": "MIT", + "url": "http://ihatemoney.org/", "upstream": { "license": "MIT", "website": "https://github.com/spiral-project/ihatemoney", @@ -16,16 +15,21 @@ "code": "https://github.com/spiral-project/ihatemoney", "demo": "https://ihatemoney.org/demo/" }, + "license": "MIT", "maintainer": { "name": "Jocelyn Delalande", "email": "jocelyn@crapouillou.net", "url": "https://jocelyn.delalande.fr" }, "requirements": { - "yunohost": ">= 4.1.0" + "yunohost": ">= 4.3.0" }, "multi_instance": true, - "services": ["nginx", "mysql", "postfix"], + "services": [ + "nginx", + "postfix", + "mysql" + ], "arguments": { "install" : [ { diff --git a/scripts/_common.sh b/scripts/_common.sh index 7ca836a..fad15ea 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -17,7 +17,8 @@ pip_dependencies=( 'gunicorn>=19.3.0' 'PyMySQL>=0.9,<0.10' 'SQLAlchemy<1.4' - 'ihatemoney>=4,<5' + 'ihatemoney==4.1.5' + 'markupsafe==2.0.1' ) ### Constants diff --git a/scripts/backup b/scripts/backup index 030071d..1f7aec4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -33,11 +33,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -50,13 +45,6 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP FAIL2BAN CONFIGURATION -#================================================= - -# ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -# ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" - #================================================= # SPECIFIC BACKUP #================================================= @@ -70,9 +58,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Backing up the MySQL database..." -### (However, things like MySQL dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= diff --git a/scripts/change_url b/scripts/change_url index 2c45789..2ca3679 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -42,6 +42,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" @@ -134,6 +135,7 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=5 +# Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd #================================================= diff --git a/scripts/install b/scripts/install index 6a8713e..05db941 100755 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -156,14 +159,6 @@ for _ in {1..20}; do sleep 1 done -#================================================= -# SETUP FAIL2BAN -#================================================= -# ynh_script_progression --message="Configuring Fail2Ban..." --weight=1 - -# Create a dedicated Fail2Ban config -# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/remove b/scripts/remove index 4685e83..85a39fe 100755 --- a/scripts/remove +++ b/scripts/remove @@ -50,14 +50,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=2 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -75,12 +67,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- ynh_remove_nginx_config #================================================= -# REMOVE FAIL2BAN CONFIGURATION +# REMOVE DEPENDENCIES #================================================= -# ynh_script_progression --message="Removing Fail2ban configuration..." --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=2 -# # Remove the dedicated Fail2Ban config -# ynh_remove_fail2ban_config +# Remove metapackage and its dependencies +ynh_remove_app_dependencies #================================================= # SPECIFIC REMOVE diff --git a/scripts/restore b/scripts/restore index 30d8ce9..d4911c1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -29,7 +32,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -44,7 +46,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -63,25 +65,10 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" -# FIXME: this should be managed by the core in the future -# Here, as a packager, you may have to tweak the ownerhsip/permissions -# such that the appropriate users (e.g. maybe www-data) can access -# files in some cases. -# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - -# this will be treated as a security issue. chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# RESTORE FAIL2BAN CONFIGURATION -#================================================= -# ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1 - -# ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" -# ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" -# ynh_systemd_action --action=restart --service_name=fail2ban - #================================================= # SPECIFIC RESTORATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 5457ea3..f09e760 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,13 +26,8 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) if ynh_compare_current_package_version --comparison le --version "4.1.5~ynh2"; then @@ -49,6 +44,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Restore it if the upgrade fails ynh_restore_upgradebackup } @@ -163,16 +159,9 @@ mails_sender="no-reply@$domain" # Allows to comment some config lines if not using sub path sub_path_only="$(if [[ "$path_url" == "/" ]]; then echo '# ' ; else echo ''; fi)" -ynh_add_config --template ../conf/ihatemoney.cfg --destination "$final_path/ihatemoney.cfg" +ynh_add_config --template="../conf/ihatemoney.cfg" --destination="$final_path/ihatemoney.cfg" chmod 600 "$final_path/ihatemoney.cfg" - -# FIXME: this should be managed by the core in the future -# Here, as a packager, you may have to tweak the ownerhsip/permissions -# such that the appropriate users (e.g. maybe www-data) can access -# files in some cases. -# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - -# this will be treated as a security issue. chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -205,14 +194,6 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l # FIXME: We need to wait for the db to upgrade and gunicorn to restart! sleep 3 -#================================================= -# UPGRADE FAIL2BAN -#================================================= -# ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1 - -# # Create a dedicated Fail2Ban config -# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # RELOAD NGINX #=================================================