diff --git a/README.md b/README.md index a76a1cf..38cf006 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This is a Wallabag v2 package for YunoHost. **NB: Since @jeromelebleu is no longer maintaining this package, I (@lapineige) take over this repository. But I have limited time and experience, so feel free to help !** -**Shipped version:** 2.2.3 +**Shipped version:** 2.3.2 [Wallabag](https://www.wallabag.org/) is a self hostable Read-It-Later application allowing you to not miss any content anymore. Click, save, read it when you can. @@ -56,7 +56,7 @@ Paquet Wallabag v2 pour Yunohost. **NB: Depuis que @jeromelebleu ne maintiens plus ce paquet, je (@lapineige) reprends la charge de ce dépôt. Mais j'ai un temps et une expérience limitées, donc n'hésitez pas à donner un coup de main :) !** -**Version actuelle:** 2.2.3 +**Version actuelle:** 2.3.2 [Wallabag](https://www.wallabag.org/) est une application de lecture différée : elle permet simplement d’archiver une page web en ne conservant que le contenu. Les éléments superflus (menus, publicités, etc.) sont supprimés. diff --git a/check_process b/check_process index 813d5d2..9e25221 100644 --- a/check_process +++ b/check_process @@ -11,6 +11,7 @@ setup_private=0 setup_public=0 upgrade=1 + upgrade=1 from_commit=f75d58cb32c51a0981333ea88974dc3199324e65 backup_restore=1 multi_instance=1 incorrect_path=1 @@ -31,4 +32,8 @@ Level 10=0 ;;; Options Email= -Notification=none \ No newline at end of file +Notification=none +;;; Upgrade options + ; commit=f75d58cb32c51a0981333ea88974dc3199324e65 + name= Previous package version +manifest_arg=domain=DOMAIN&path=PATH&admin=USER& diff --git a/conf/app.src b/conf/app.src index bc60087..9961d0e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://static.wallabag.org/releases/wallabag-release-2.2.3.tar.gz -SOURCE_SUM=13fe5cb7cfc741abee08312f0055e9549e60590daff2fac41be5266f7956d857 +SOURCE_URL=https://static.wallabag.org/releases/wallabag-release-2.3.2.tar.gz +SOURCE_SUM=047a49d48a1199bd1634cab76d4af3dba95096885d4f7814377210fa76fbcc9f SOURCE_FORMAT=tar.gz diff --git a/conf/parameters.yml b/conf/parameters.yml deleted file mode 100644 index 1acb3a7..0000000 --- a/conf/parameters.yml +++ /dev/null @@ -1,50 +0,0 @@ -parameters: - database_driver: pdo_mysql - database_host: localhost - database_port: 3306 - database_name: {DBNAME} - database_user: {DBUSER} - database_password: {DBPASS} - database_path: null - database_table_prefix: null - database_socket: null - database_charset: utf8mb4 - - mailer_transport: smtp - mailer_host: localhost - mailer_user: null - mailer_password: null - - locale: en - - # A secret key that's used to generate certain security-related tokens - secret: {DESKEY} - - # two factor stuff - twofactor_auth: true - twofactor_sender: no-reply@wallabag.org - - # fosuser stuff - fosuser_registration: false - fosuser_confirmation: true - - from_email: no-reply@wallabag.org - - rss_limit: 50 - - # RabbitMQ processing - rabbitmq_host: localhost - rabbitmq_port: 5672 - rabbitmq_user: guest - rabbitmq_password: guest - rabbitmq_prefetch_count: 10 - - # Redis processing - redis_scheme: tcp - redis_host: localhost - redis_port: 6379 - redis_path: null - redis_password: null - - # sites credentials - sites_credentials: {} diff --git a/manifest.json b/manifest.json index 17fe8f9..848621b 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "url": "https://www.wallabag.org", "license": "MIT", - "version": "2.2.3", + "version": "2.3.2-1", "maintainer": { "name": "lapineige", "email": "" diff --git a/scripts/_common.sh b/scripts/_common.sh index 656978d..ffe8244 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,7 @@ # # Package dependencies -PKG_DEPENDENCIES="php5-cli php5-mysql php5-json php5-gd php5-tidy php5-curl php-gettext redis-server" +PKG_DEPENDENCIES="php5-cli php5-mysql php5-json php5-gd php5-tidy php5-curl php-gettext php5-redis" # Execute a command as another user # usage: exec_as USER COMMAND [ARG ...] @@ -36,12 +36,6 @@ QUIET () { # redirect standard output to /dev/null $@ > /dev/null } - -HUMAN_SIZE () { # Transforms a Kb-based size to a human-readable size - human=$(numfmt --to=iec --from-unit=1K $1) - echo $human -} - CHECK_SIZE () { # Check if enough disk space available on backup storage file_to_analyse=$1 backup_size=$(du --summarize "$file_to_analyse" | cut -f1) @@ -55,15 +49,6 @@ CHECK_SIZE () { # Check if enough disk space available on backup storage fi } -CHECK_DOMAINPATH () { # Check domain/path availability - yunohost app checkurl $domain$path_url -a $app -} - -CHECK_FINALPATH () { # Check if destination directory already exists - final_path="/var/www/$app" - test ! -e "$final_path" || ynh_die "This path already contains a folder" -} - # ============= FUTURE YUNOHOST HELPER ============= # Delete a file checksum from the app settings diff --git a/scripts/change_url b/scripts/change_url index 1a2bb6e..42dc935 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,6 +28,7 @@ app=$YNH_APP_INSTANCE_NAME db_name=$(ynh_app_setting_get "$app" db_name) db_pwd=$(ynh_app_setting_get "$app" mysqlpwd) db_user="$db_name" +final_path=$(ynh_app_setting_get "$app" final_path) #================================================= # CHECK PATHS SYNTAX @@ -76,7 +77,7 @@ then # Move #for-subdir comment at the beginning of the line (line not needed for "/" path) ynh_replace_string "\(.*\) #for-subdir" "#for-subdir \1" "$nginx_conf_path" - elif [ "$new_path" != "/" ] && [ "$old_path" = "/" ] ; then + elif [ "$new_path" != "/" ] && [ "$old_path" = "/" ] ; then # Move #for-subdir comment at the end of the line (line needed for "/path" path) ynh_replace_string "#for-subdir\(.*\)" "\1 #for-subdir" "$nginx_conf_path" @@ -87,7 +88,7 @@ then ynh_replace_string "rewrite ^ /" "rewrite ^ $new_path/" "$nginx_conf_path" else # Replace locations starting with old_path - # Look for every possible patterns for location directive(see https://nginx.org/en/docs/http/ngx_http_core_module.html#location) + # Look for every possible patterns for location directive (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location) ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? \(\^\)\?$old_path" "location\1 \3$new_path" "$nginx_conf_path" # Replace path in "rewrite" directive ynh_replace_string "rewrite ^ $old_path" "rewrite ^ $new_path" "$nginx_conf_path" @@ -113,6 +114,9 @@ fi # Configure Wallabag instance URL ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_user" <<< "UPDATE craue_config_setting SET value = 'https://$new_domain$new_path' WHERE name = 'wallabag_url'" +# Change domain name in parameters.yml +ynh_replace_string "domain_name: https://$old_domain$old_path" "domain_name: https://$new_domain$new_path" $final_path/app/config/parameters.yml + # If "Download images locally" option has been enabled in Internal Settings download_images_enabled=$(ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_user" <<< "SELECT value from craue_config_setting WHERE name='download_images_enabled '" | tail -n 1) if [ "$download_images_enabled" = "1" ] ; then diff --git a/scripts/install b/scripts/install index 9474c0c..93fc374 100644 --- a/scripts/install +++ b/scripts/install @@ -31,9 +31,15 @@ admin=$YNH_APP_ARG_ADMIN # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +final_path=/var/www/$app +test ! -e "$final_path" || ynh_die "This path already contains a folder" + path_url=$(ynh_normalize_url_path $path_url) # Check and normalize path -CHECK_DOMAINPATH # Check domain and path availability -CHECK_FINALPATH # Check if destination directory is not already in use + +# Check web path availability +ynh_webpath_available $domain $path_url +# Register (book) web path +ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST @@ -86,11 +92,16 @@ ynh_system_user_create $app # Create a dedicated system user # Copy and set Wallabag dist configuration wb_conf="${TMPDIR}/app/config/parameters.yml" -cp ../conf/parameters.yml "$wb_conf" -ynh_replace_string "{DBNAME}" "${db_name}" "$wb_conf" -ynh_replace_string "{DBUSER}" "${db_user}" "$wb_conf" -ynh_replace_string "{DBPASS}" "${db_pwd}" "$wb_conf" -ynh_replace_string "{DESKEY}" "${deskey}" "$wb_conf" +cp ${TMPDIR}/app/config/parameters.yml.dist $wb_conf + +ynh_replace_string "fosuser_registration: true" "fosuser_registration: false" "$wb_conf" +ynh_replace_string "database_name: wallabag" "database_name: ${db_name}" "$wb_conf" +ynh_replace_string "database_user: root" "database_user: ${db_user}" "$wb_conf" +ynh_replace_string "database_password: ~" "database_password: ${db_pwd}" "$wb_conf" +ynh_replace_string "database_table_prefix: wallabag_" "database_table_prefix: null" "$wb_conf" +ynh_replace_string "secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv" "secret: ${deskey}" "$wb_conf" +ynh_replace_string "domain_name: https://your-wallabag-url-instance.com" "domain_name: https://$domain$path_url" "$wb_conf" + # Restrict rights to Wallabag user only chmod 600 "$wb_conf" diff --git a/scripts/upgrade b/scripts/upgrade index d134c64..6810d90 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,11 +89,15 @@ ynh_system_user_create $app # Create dedicated user if not existing # Copy and set Wallabag dist configuration wb_conf="${TMPDIR}/app/config/parameters.yml" -cp ../conf/parameters.yml "$wb_conf" -ynh_replace_string "{DBNAME}" "${db_name}" "$wb_conf" -ynh_replace_string "{DBUSER}" "${db_user}" "$wb_conf" -ynh_replace_string "{DBPASS}" "${db_pwd}" "$wb_conf" -ynh_replace_string "{DESKEY}" "${deskey}" "$wb_conf" +cp ${TMPDIR}/app/config/parameters.yml.dist $wb_conf + +ynh_replace_string "fosuser_registration: true" "fosuser_registration: false" "$wb_conf" +ynh_replace_string "database_name: wallabag" "database_name: ${db_name}" "$wb_conf" +ynh_replace_string "database_user: root" "database_user: ${db_user}" "$wb_conf" +ynh_replace_string "database_password: ~" "database_password: ${db_pwd}" "$wb_conf" +ynh_replace_string "database_table_prefix: wallabag_" "database_table_prefix: null" "$wb_conf" +ynh_replace_string "secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv" "secret: ${deskey}" "$wb_conf" +ynh_replace_string "domain_name: https://your-wallabag-url-instance.com" "domain_name: https://$domain$path_url" "$wb_conf" # Replace files and set permissions ynh_secure_remove "${final_path}/var/cache" diff --git a/sources/patches/app-00-ldap-auth.patch b/sources/patches/app-00-ldap-auth.patch index f458191..5742009 100644 --- a/sources/patches/app-00-ldap-auth.patch +++ b/sources/patches/app-00-ldap-auth.patch @@ -1,17 +1,20 @@ --- a/app/config/services.yml 2016-05-25 18:09:56.374914445 +0200 +++ b/app/config/services.yml 2016-05-25 18:07:38.775042951 +0200 -@@ -36,3 +36,7 @@ - arguments: ["@session"] +@@ -43,6 +43,10 @@ tags: - { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin } -+ + + yunohost.ldap: + class: Symfony\Component\Ldap\LdapClient + arguments: ["localhost"] ++ + craue_config_cache_provider: + class: Symfony\Component\Cache\Adapter\FilesystemAdapter + public: false --- a/app/config/security.yml 2016-05-25 18:09:46.814645164 +0200 +++ b/app/config/security.yml 2016-05-25 18:07:38.775042951 +0200 -@@ -11,6 +11,14 @@ - entity: { class: WallabagUserBundle:User, property: username } +@@ -13,6 +13,14 @@ + property: username fos_userbundle: id: fos_user.user_provider.username + yunohost_users: @@ -22,11 +25,11 @@ + search_password: + filter: (&(uid={username})(objectClass=posixAccount)) + default_roles: ROLE_USER - + # the main part of the security, where you can set up firewalls # for specific sections of your app -@@ -36,6 +44,9 @@ - +@@ -38,6 +46,9 @@ + secured_area: pattern: ^/ + http_basic_ldap: diff --git a/sources/patches/app-01-logout-success-handler.patch b/sources/patches/app-01-logout-success-handler.patch index a3e75fc..166643d 100644 --- a/sources/patches/app-01-logout-success-handler.patch +++ b/sources/patches/app-01-logout-success-handler.patch @@ -15,12 +15,13 @@ diff --git a/app/config/services.yml b/app/config/services.yml index 8a09fde..ee63e06 100644 --- a/app/config/services.yml +++ b/app/config/services.yml -@@ -37,6 +37,9 @@ services: +@@ -43,6 +43,10 @@ tags: - { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin } - + + yunohost.logout_success_handler: + class: Wallabag\YunoHostBundle\Security\LogoutSuccessHandler ++ + yunohost.ldap: class: Symfony\Component\Ldap\LdapClient