1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wallabag2_ynh.git synced 2024-10-01 13:35:06 +02:00
* Fix hook (#206)

* Auto-update READMEs

* fix hook

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Update manifest.toml (#208)

* Update manifest.toml

* Auto-update READMEs

* Add parameters.yml (#209)

* Add parameters.yml

* Update upgrade

* Update change_url

* Function (#210)

* Add parameters.yml

* Update upgrade

* add function

* fix: add time for php script to run a 'long sync' with an application (#213)

* Auto-update READMEs

* [autopatch] Automatic patch attempt for helpers 2.1 (#214)

* Testing (#207)

* Fix hook (#206)

* Auto-update READMEs

* fix hook

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Update manifest.toml (#208)

* Update manifest.toml

* Auto-update READMEs

* Add parameters.yml (#209)

* Add parameters.yml

* Update upgrade

* Update change_url

* Function (#210)

* Add parameters.yml

* Update upgrade

* add function

---------

Co-authored-by: Kayou <pierre@kayou.io>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Auto-update READMEs

* [autopatch] Automatic patch attempt for helpers 2.1

* cleaning

---------

Co-authored-by: eric_G <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: Kayou <pierre@kayou.io>
Co-authored-by: Yunohost-Bot <>

* Auto-update READMEs

* Update manifest.toml

* Auto-update READMEs

---------

Co-authored-by: Kayou <pierre@kayou.io>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Gofannon <17145502+Gofannon@users.noreply.github.com>
Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com>
This commit is contained in:
eric_G 2024-09-09 22:24:42 +02:00 committed by GitHub
parent 773f319b2f
commit b9769d3c00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 141 additions and 234 deletions

View file

@ -6,4 +6,5 @@
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)
- [Baca README dalam bahasa bahasa Indonesia](README_id.md)
- [Прочитать README на русский](README_ru.md)
- [阅读中文(简体)的 README](README_zh_Hans.md)

View file

@ -22,7 +22,7 @@ It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps
Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html).
**Shipped version:** 2.5.4~ynh4
**Shipped version:** 2.5.4~ynh5
**Demo:** <https://demo.yunohost.org/wallabag/>

View file

@ -22,7 +22,7 @@ It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps
Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html).
**Versión actual:** 2.5.4~ynh4
**Versión actual:** 2.5.4~ynh5
**Demo:** <https://demo.yunohost.org/wallabag/>

View file

@ -22,7 +22,7 @@ It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps
Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html).
**Paketatutako bertsioa:** 2.5.4~ynh4
**Paketatutako bertsioa:** 2.5.4~ynh5
**Demoa:** <https://demo.yunohost.org/wallabag/>

View file

@ -22,7 +22,7 @@ Sont disponibles une interface web, des add-ons pour navigateurs (Firefox/Chrome
La mise à niveau depuis le paquet YunoHost de [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) demande une opération manuelle, c'est pourquoi un nouveau paquet est fournit. Pour le processus de migration, merci de vous référer à [la documentation officiel de Wallabag](https://doc.wallabag.org/fr/user/import/wallabagv1.html).
**Version incluse:** 2.5.4~ynh4
**Version incluse:** 2.5.4~ynh5
**Démo:** <https://demo.yunohost.org/wallabag/>

View file

@ -22,7 +22,7 @@ It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps
Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html).
**Versión proporcionada:** 2.5.4~ynh4
**Versión proporcionada:** 2.5.4~ynh5
**Demo:** <https://demo.yunohost.org/wallabag/>

View file

@ -22,7 +22,7 @@ It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps
Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html).
**Versi terkirim:** 2.5.4~ynh4
**Versi terkirim:** 2.5.4~ynh5
**Demo:** <https://demo.yunohost.org/wallabag/>
@ -34,7 +34,7 @@ Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallaba
- Website aplikasi resmi: <https://www.wallabag.org>
- Dokumentasi admin resmi: <https://doc.wallabag.org/en/>
- Repositori kode aplikasi hulu: <https://github.com/wallabag/wallabag>
- Depot kode aplikasi hulu: <https://github.com/wallabag/wallabag>
- Gudang YunoHost: <https://apps.yunohost.org/app/wallabag2>
- Laporkan bug: <https://github.com/YunoHost-Apps/wallabag2_ynh/issues>

53
README_ru.md Normal file
View file

@ -0,0 +1,53 @@
<!--
Важно: этот README был автоматически сгенерирован <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Он НЕ ДОЛЖЕН редактироваться вручную.
-->
# Wallabag для YunoHost
[![Уровень интеграции](https://dash.yunohost.org/integration/wallabag2.svg)](https://ci-apps.yunohost.org/ci/apps/wallabag2/) ![Состояние работы](https://ci-apps.yunohost.org/ci/badges/wallabag2.status.svg) ![Состояние сопровождения](https://ci-apps.yunohost.org/ci/badges/wallabag2.maintain.svg)
[![Установите Wallabag с YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wallabag2)
*[Прочтите этот README на других языках.](./ALL_README.md)*
> *Этот пакет позволяет Вам установить Wallabag быстро и просто на YunoHost-сервер.*
> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.*
## Обзор
Wallabag is a self hostable Read-It-Later application allowing you to not miss any content anymore. Click, save, read it when you can.
It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps (Android/iOS/Windows Phone) and even on e-reader (PocketBook/Kobo).
Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html).
**Поставляемая версия:** 2.5.4~ynh5
**Демо-версия:** <https://demo.yunohost.org/wallabag/>
## Снимки экрана
![Снимок экрана Wallabag](./doc/screenshots/screenshot1.webp)
## Документация и ресурсы
- Официальный веб-сайт приложения: <https://www.wallabag.org>
- Официальная документация администратора: <https://doc.wallabag.org/en/>
- Репозиторий кода главной ветки приложения: <https://github.com/wallabag/wallabag>
- Магазин YunoHost: <https://apps.yunohost.org/app/wallabag2>
- Сообщите об ошибке: <https://github.com/YunoHost-Apps/wallabag2_ynh/issues>
## Информация для разработчиков
Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing).
Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing --debug
или
sudo yunohost app upgrade wallabag2 -u https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing --debug
```
**Больше информации о пакетировании приложений:** <https://yunohost.org/packaging_apps>

View file

@ -22,7 +22,7 @@ It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps
Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html).
**分发版本:** 2.5.4~ynh4
**分发版本:** 2.5.4~ynh5
**演示:** <https://demo.yunohost.org/wallabag/>

View file

@ -1,4 +0,0 @@
; Additional php.ini defines, specific to this pool of workers.
php_admin_value[upload_max_filesize] = 50M
php_admin_value[post_max_size] = 50M

View file

@ -9,7 +9,7 @@ location __PATH__/ {
fastcgi_read_timeout 60m;
client_max_body_size 50M;
try_files $uri @__NAME__;
try_files $uri @__APP__;
location ~ ^__PATH__/app\.php(/|$) {
include fastcgi_params;
@ -17,7 +17,7 @@ location __PATH__/ {
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
fastcgi_intercept_errors on;
}
@ -31,6 +31,6 @@ location __PATH__/ {
include conf.d/yunohost_panel.conf.inc;
}
location @__NAME__ {
location @__APP__ {
rewrite ^ __PATH__/app.php/$is_args$args;
}

View file

@ -7,7 +7,7 @@ name = "Wallabag"
description.en = "Save and classify articles. Read them later"
description.fr = "Enregistrez et classez les articles. Lisez-les plus tard"
version = "2.5.4~ynh4"
version = "2.5.4~ynh5"
maintainers = ["lapineige"]
@ -21,7 +21,8 @@ cpe = "cpe:2.3:a:wallabag:wallabag"
fund = "https://liberapay.com/wallabag"
[integration]
yunohost = ">= 11.2"
yunohost = ">= 11.2.29"
helpers_version = "2.1"
architectures = "all"
multi_instance = true
ldap = true
@ -56,6 +57,7 @@ ram.runtime = "50M"
[resources.system_user]
[resources.install_dir]
group = "www-data:r-x"
[resources.permissions]
main.url = "/"

View file

@ -1,19 +1,11 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
# Define a function to execute commands with `php_exec`
php_exec() {
(cd "$install_dir" && ynh_exec_as "$app" \
php${phpversion} "$install_dir/bin/console" --no-interaction --env=prod "$@")
(cd "$install_dir" && ynh_exec_as_app \
php${php_version} "$install_dir/bin/console" --no-interaction --env=prod "$@")
}
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -8,42 +8,39 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
# Clean cache files before backup (saved some disk space)
ynh_secure_remove --file=$install_dir/var/cache/prod
ynh_safe_rm $install_dir/var/cache/prod
ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"
#=================================================
# BACKUP THE SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup "/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_print_info "Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
ynh_mysql_dump_db > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -10,35 +10,35 @@ source /usr/share/yunohost/helpers
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config
ynh_config_change_url_nginx
#=================================================
# UPDATE CONFIGURATION
#=================================================
ynh_script_progression --message="Updating wallabag configuration..."
ynh_script_progression "Updating wallabag configuration..."
# Configure Wallabag instance URL
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \
ynh_mysql_db_shell \
<<< "UPDATE internal_setting SET value = 'https://$new_domain$new_path' WHERE name = 'wallabag_url'"
# Change domain name in parameters.yml
ynh_replace_string --target_file="$install_dir/app/config/parameters.yml" --match_string="domain_name: .*" --replace_string="domain_name: https://$new_domain$new_path"
ynh_replace --file="$install_dir/app/config/parameters.yml" --match="domain_name: .*" --replace="domain_name: https://$new_domain$new_path"
# If "Download images locally" option has been enabled in Internal Settings
download_images_enabled=$(ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \
download_images_enabled=$(ynh_mysql_db_shell \
<<< "SELECT value from internal_setting WHERE name='download_images_enabled '" | tail -n 1)
if [ "$download_images_enabled" = "1" ]; then
ynh_print_info --message="Updating images URL; this operation may take a while..."
ynh_print_info "Updating images URL; this operation may take a while..."
# Query/replace the domain/path in every entry.content in mysql database
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \
ynh_mysql_db_shell \
<<< "UPDATE entry SET content = REPLACE(content, '$old_domain$old_path', '$new_domain$new_path');"
fi
# Clear assets cache
ynh_secure_remove --file="$install_dir/var/cache"
ynh_safe_rm "$install_dir/var/cache"
mkdir "$install_dir/var/cache"
chown "$app:www-data" "$install_dir/var/cache"
@ -46,4 +46,4 @@ chown "$app:www-data" "$install_dir/var/cache"
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last
ynh_script_progression "Change of URL completed for $app"

View file

@ -13,23 +13,21 @@ source /usr/share/yunohost/helpers
# Generate random DES key & password
deskey=$(ynh_string_random --length=24)
ynh_app_setting_set --app="$app" --key="deskey" --value="$deskey"
ynh_app_setting_set --key="deskey" --value="$deskey"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=6
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
# Create log dir/file FIXME: is it useless?
# Create log dir/file is it useless?
mkdir -p "$install_dir/var/logs/"
touch "$install_dir/var/logs/prod.log"
# Set permissions to app files
chown -R "$app:www-data" "$install_dir"
# Restrict rights to Wallabag user only
if [ -e "$install_dir/var/cache/prod/appProdProjectContainer.php" ]; then
chmod 700 "$install_dir/var/cache/prod/appProdProjectContainer.php"
@ -38,12 +36,9 @@ fi
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
ynh_script_progression "Adding $app's configuration files..."
ynh_add_config --template="parameters.yml" --destination="$install_dir/app/config/parameters.yml"
chmod 600 "$install_dir/app/config/parameters.yml"
chown "$app:$app" "$install_dir/app/config/parameters.yml"
ynh_config_add --template="parameters.yml" --destination="$install_dir/app/config/parameters.yml"
# Install dependencies and Wallabag
php_exec wallabag:install
@ -60,38 +55,34 @@ done
php_exec fos:user:promote --super "$admin"
# Configure Wallabag instance URL
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \
<<< "UPDATE internal_setting SET value = 'https://$domain$path' WHERE name = 'wallabag_url'"
# Set permissions to app files
chown -R "$app:www-data" "$install_dir"
ynh_mysql_db_shell <<< "UPDATE internal_setting SET value = 'https://$domain$path' WHERE name = 'wallabag_url'"
#=================================================
# SETUP HOOKS
#=================================================
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_create"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_delete"
ynh_replace --match="__APP__" --replace="$app" --file="../hooks/post_user_create"
ynh_replace --match="__APP__" --replace="$app" --file="../hooks/post_user_delete"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
# Use logrotate to manage application logfile(s)
ynh_use_logrotate --logfile="$install_dir/var/logs/prod.log"
ynh_config_add_logrotate "$install_dir/var/logs/prod.log"
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP "<HOST>"' --max_retry=5
ynh_config_add_fail2ban --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP "<HOST>"'
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression "Installation of $app completed"

View file

@ -10,22 +10,22 @@ source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
ynh_script_progression "Removing system configurations related to $app..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
ynh_config_remove_logrotate
# Remove the dedicated NGINX config
ynh_remove_nginx_config
ynh_config_remove_nginx
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
ynh_config_remove_phpfpm
# Remove the dedicated Fail2Ban config
ynh_remove_fail2ban_config
ynh_config_remove_fail2ban
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"

View file

@ -11,13 +11,11 @@ source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"
ynh_restore "$install_dir"
# Set permissions to app files
chown -R "$app:www-data" "$install_dir"
# Restrict rights to Wallabag user only
if [ -e "$install_dir/var/cache/prod/appProdProjectContainer.php" ]; then
chmod 700 "$install_dir/var/cache/prod/appProdProjectContainer.php"
@ -26,36 +24,36 @@ fi
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_script_progression "Restoring the MySQL database..."
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
ynh_mysql_db_shell < ./db.sql
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore "/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban
ynh_restore "/etc/fail2ban/jail.d/$app.conf"
ynh_restore "/etc/fail2ban/filter.d/$app.conf"
ynh_systemctl --action=restart --service=fail2ban
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_script_progression "Reloading NGINX web server and $app's service..."
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
ynh_systemctl --service="php$php_version-fpm" --action=reload
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression "Restoration completed for $app"

View file

@ -10,18 +10,16 @@ source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=6
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="app/config/parameters.yml var/logs web/assets/images"
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="app/config/parameters.yml var/logs web/assets/images"
# Create log dir/file FIXME: is it useless?
# Create log dir/file is it useless?
mkdir -p "$install_dir/var/logs/"
touch "$install_dir/var/logs/prod.log"
# Set permissions to app files
chown -R "$app:www-data" "$install_dir"
# Restrict rights to Wallabag user only
if [ -e "$install_dir/var/cache/prod/appProdProjectContainer.php" ]; then
chmod 700 "$install_dir/var/cache/prod/appProdProjectContainer.php"
@ -30,41 +28,40 @@ fi
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Reconfiguring $app..." --weight=1
ynh_script_progression "Reconfiguring $app..."
# Upgrade database and clear the cache
php_exec doctrine:migrations:migrate
php_exec cache:clear
# Configure Wallabag instance URL
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \
<<< "UPDATE internal_setting SET value = 'https://$domain$path' WHERE name = 'wallabag_url'"
ynh_mysql_db_shell <<< "UPDATE internal_setting SET value = 'https://$domain$path' WHERE name = 'wallabag_url'"
#=================================================
# SETUP HOOKS
#=================================================
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_create"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_delete"
ynh_replace --match="__APP__" --replace="$app" --file="../hooks/post_user_create"
ynh_replace --match="__APP__" --replace="$app" --file="../hooks/post_user_delete"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_config_add_nginx
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_config_add_phpfpm
ynh_use_logrotate --non-append --logfile="$install_dir/var/logs/prod.log"
ynh_config_add_logrotate "$install_dir/var/logs/prod.log"
# Add fail2ban config
ynh_add_fail2ban_config --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP "<HOST>"' --max_retry=5 # same as install config
ynh_config_add_fail2ban --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP "<HOST>"' # same as install config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"

View file

@ -1,46 +0,0 @@
diff --git a/app/config/security.yml b/app/config/security.yml
index 02afc9ea..5a3f7a34 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -13,6 +13,14 @@ security:
property: username
fos_userbundle:
id: fos_user.user_provider.username_email
+ yunohost_users:
+ ldap:
+ service: yunohost.ldap
+ base_dn: ou=users,dc=yunohost,dc=org
+ search_dn:
+ 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
@@ -38,6 +46,9 @@ security:
secured_area:
pattern: ^/
+ http_basic_ldap:
+ service: yunohost.ldap
+ dn_string: "uid={username},ou=users,dc=yunohost,dc=org"
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
diff --git a/app/config/services.yml b/app/config/services.yml
index 7b85d846..f23961c5 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -43,6 +43,10 @@ services:
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
--
2.17.1

View file

@ -1,63 +0,0 @@
diff --git a/app/config/security.yml b/app/config/security.yml
index 5a3f7a34..1720e741 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -62,7 +62,7 @@ security:
logout:
path: /logout
- target: /
+ success_handler: yunohost.logout_success_handler
access_control:
- { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY }
diff --git a/app/config/services.yml b/app/config/services.yml
index f23961c5..f266e6d1 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -43,6 +43,10 @@ services:
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
arguments: ["localhost"]
diff --git a/src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php b/src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php
new file mode 100644
index 00000000..b3268243
--- /dev/null
+++ b/src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Wallabag\YunoHostBundle\Security;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RedirectResponse;
+use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
+
+/**
+ * Redirects to the SSO logout URL in case of a successful logout.
+ *
+ * @see http://api.symfony.com/3.1/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.html
+ */
+class LogoutSuccessHandler implements LogoutSuccessHandlerInterface
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function onLogoutSuccess(Request $request)
+ {
+ // Retrieve the current SSO logout URL
+ $main_domain = exec('cat /etc/yunohost/current_host');
+ $url = 'https://' . $main_domain . '/yunohost/sso/?action=logout';
+
+ return new RedirectResponse($url);
+ }
+}
--
2.17.1

View file

@ -1,11 +0,0 @@
--- a/vendor/friendsofsymfony/oauth-server-bundle/Storage/OAuthStorage.php 2016-02-22 13:57:55.000000000 +0000
+++ b/vendor/friendsofsymfony/oauth-server-bundle/Storage/OAuthStorage.php 2017-04-13 17:16:06.298501506 +0000
@@ -170,7 +170,7 @@
if (null !== $user) {
$encoder = $this->encoderFactory->getEncoder($user);
- if ($encoder->isPasswordValid($user->getPassword(), $password, $user->getSalt())) {
+ if (true) {
return array(
'data' => $user,
);