From 559ceddb2f540cc1841d743826d2c01d0720f5dc Mon Sep 17 00:00:00 2001 From: navanchauhan Date: Thu, 19 Jan 2023 19:00:05 -0700 Subject: [PATCH] apply fixes fr --- conf/amd64.src | 4 ++-- conf/app.src | 4 ++-- conf/systemd.service | 4 ++++ manifest.json | 10 +--------- scripts/install | 8 ++++---- scripts/upgrade | 27 +++++++++++++++++++-------- 6 files changed, 32 insertions(+), 25 deletions(-) diff --git a/conf/amd64.src b/conf/amd64.src index 13d7501..3bb1270 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/knadh/listmonk/releases/download/v2.2.0/listmonk_2.2.0_linux_amd64.tar.gz -SOURCE_SUM=c2bdccd073d768d2b8dfbfad6469c5b41cf39b44a20c263cbaebf15876463709 +SOURCE_URL=https://github.com/knadh/listmonk/releases/download/v2.2.0/listmonk_2.3.0_linux_amd64.tar.gz +SOURCE_SUM=4ad9ff7a04e13c9f8609c705e4850046ae8a3c9a03b0c4ac04e3c1d1c8fe8b7a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false diff --git a/conf/app.src b/conf/app.src index af92853..0d741d0 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/knadh/listmonk/archive/refs/tags/v2.2.0.tar.gz -SOURCE_SUM=e3f1cc89972cafaab78cda38be54ab3fc115fd7846e2e7dae1b19fff002e1c77 +SOURCE_URL=https://github.com/knadh/listmonk/archive/refs/tags/v2.3.0.tar.gz +SOURCE_SUM=54cab80ca16dbf58ce40b7fc1ae88a9f8ed4c9d9a54387a77b1a90cb4dba3404 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/systemd.service b/conf/systemd.service index a5fcd31..bbac47a 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,12 +1,16 @@ [Unit] Description=Listmonk: newsletter and mailing list manager Documentation=https://listmonk.app/docs/ +ConditionPathExists=__FINALPATH__/config.toml +After=network.target [Service] Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ +ExecStartPre=/usr/bin/mkdir -p "__FINALPATH__/uploads" +ExecStartPre=__FINALPATH__/listmonk --config __FINALPATH__/config.toml --upgrade --yes ExecStart=__FINALPATH__/listmonk Restart=always diff --git a/manifest.json b/manifest.json index 9541a8d..67de8e1 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Newsletter and mailing list manager", "fr": "Manager de newsletter et mailing list" }, - "version": "2.2.0~ynh1", + "version": "2.3.0~ynh3", "url": "https://listmonk.app/", "upstream": { "license": "AGPL-3.0-only", @@ -38,14 +38,6 @@ "name": "is_public", "type": "boolean", "default": true - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "password", - "type": "password" } ] } diff --git a/scripts/install b/scripts/install index 28325fa..81d5a7b 100755 --- a/scripts/install +++ b/scripts/install @@ -28,8 +28,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC -admin=$YNH_APP_ARG_ADMIN -password=$YNH_APP_ARG_PASSWORD +admin="" +password="" app=$YNH_APP_INSTANCE_NAME @@ -209,12 +209,12 @@ then fi # Only the admin can access the admin panel of the app (if the app has an admin panel) -ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --auth_header=false +ynh_permission_create --permission="admin" --url="/admin" --additional_urls="/admin /api" --allowed=$admin --auth_header=false # Everyone can access the API part # We don't want to display the tile in the SSO so we put --show_tile="false" # And we don't want the YunoHost admin to be able to remove visitors group to this permission, so we put --protected="true" -ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" +ynh_permission_create --permission="api" --url="/public" --additional_urls="/api/public" --allowed="visitors" --show_tile="false" --protected="true" #================================================= # RELOAD NGINX diff --git a/scripts/upgrade b/scripts/upgrade index 8f4f7e7..34494fa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,12 +70,23 @@ fi if ! ynh_permission_exists --permission="admin"; then # Create the required permissions - ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --auth_header=false + ynh_permission_create --permission="admin" --url="/admin" --additional_urls="/admin /api" --allowed=$admin --auth_header=false fi # Create a permission if needed if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" + ynh_permission_create --permission="api" --url="/public" --additional_urls="/api/public" --allowed="visitors" --show_tile="false" --protected="true" +fi + +if ynh_compare_current_package_version --comparison le --version 2.3.0~ynh3 +then + mkdir -p "$final_path/uploads" + + ynh_permission_delete --permission="admin" + ynh_permission_delete --permission="api" + + ynh_permission_create --permission="admin" --url="/admin" --additional_urls="/admin /api" --allowed=$admin --auth_header=false + ynh_permission_create --permission="api" --url="/public" --additional_urls="/api/public" --allowed="visitors" --show_tile="false" --protected="true" fi #================================================= @@ -97,7 +108,7 @@ then # Download, check integrity, uncompress and patch the source from app.src if [ $YNH_ARCH == "armhf" ] || [ $YNH_ARCH == "arm64" ] then - ynh_setup_source --dest_dir="$final_path/build" --keep="$final_path/config.toml" + ynh_setup_source --dest_dir="$final_path/build" --keep="$final_path/config.toml uploads" # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Install Yarn @@ -117,7 +128,7 @@ then ynh_remove_nodejs ynh_secure_remove --file="$final_path/build" else - ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH --keep="$final_path/config.toml" + ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH --keep="$final_path/config.toml uploads" fi fi @@ -144,12 +155,12 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # UPDATE A CONFIG FILE #================================================= -# ynh_script_progression --message="Updating a configuration file..." --time --weight=1 +ynh_script_progression --message="Updating a configuration file..." --time --weight=1 -# ynh_add_config --template="../conf/config.toml" --destination="$final_path/config.toml" +ynh_add_config --template="../conf/config.toml" --destination="$final_path/config.toml" -# chmod 400 "$final_path/config.toml" -# chown $app:$app "$final_path/config.toml" +chmod 400 "$final_path/config.toml" +chown $app:$app "$final_path/config.toml" #================================================= # DATABASE CONFIGURATION