diff --git a/conf/nginx.conf b/conf/nginx.conf index e693a5d..860493d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,18 +1,9 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __INSTALL_DIR__/; - - try_files $uri $uri/ /; - - index index.html index.htm; + proxy_pass http://127.0.0.1:__PORT__; + client_max_body_size 20M; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } - -location ~* ^/(api|dav|\.well-known)/ { - proxy_pass http://127.0.0.1:__PORT__; - client_max_body_size 20M; -} diff --git a/manifest.toml b/manifest.toml index 54587c6..510d1df 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "vikunja" @@ -5,7 +7,7 @@ name = "Vikunja" description.en = "Self-hosted To-Do list application" description.fr = "Application de liste de tâches auto-hébergée" -version = "0.22.1~ynh1" +version = "0.23.0~ynh1" maintainers = [] @@ -49,30 +51,23 @@ ram.runtime = "50M" [resources] [resources.sources] - [resources.sources.back] - arm64.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-arm64-full.zip" + [resources.sources.main] + arm64.url = "https://dl.vikunja.io/vikunja/0.23.0/vikunja-v0.23.0-linux-arm64-full.zip" arm64.sha256 = "50a1670c0fde858c1cd7bc72cc670c4011a688a20b07ee62fab11bcca3eab01e" - amd64.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-amd64-full.zip" + amd64.url = "https://dl.vikunja.io/vikunja/0.23.0/vikunja-v0.23.0-linux-amd64-full.zip" amd64.sha256 = "c3e21ca5ccace3f9eaa423bab8c1cfc3e7de15d5c593db0aa6e4dbd9883469e6" - armhf.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-arm-7-full.zip" + armhf.url = "https://dl.vikunja.io/vikunja/0.23.0/vikunja-v0.23.0-linux-arm-7-full.zip" armhf.sha256 = "72f50404df57d75060bdd0d162e12cba20269a0def7b38993e1b61c4cf3d69d2" - i386.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-386-full.zip" + i386.url = "https://dl.vikunja.io/vikunja/0.23.0/vikunja-v0.23.0-linux-386-full.zip" i386.sha256 = "de1e271b6d3fe6024b790b95c1bf946a415598b31192638ef85589cd2c35f996" in_subdir = false format = "zip" - autoupdate.upstream = "https://kolaente.dev/vikunja/vikunja" + autoupdate.strategy = "latest_gitea_release" autoupdate.asset.amd64 = "tarball" autoupdate.asset.i386 = "tarball" autoupdate.asset.arm64 = "tarball" autoupdate.asset.armhf = "tarball" - - [resources.sources.front] - url = "https://dl.vikunja.io/frontend/vikunja-frontend-0.22.1.zip" - sha256 = "8e4145eacb9c2d95a95a43dca2f4dd0fd30ec8934f4562017caf77f3c5f9a277" - in_subdir = false - format = "zip" - [resources.ports] diff --git a/scripts/backup b/scripts/backup index 64e1a14..a9ec4d0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -21,9 +21,6 @@ ynh_print_info --message="Declaring files to be backed up..." # Frontend ynh_backup --src_path="$install_dir" -# Backend -ynh_backup --src_path="$backend_path" - #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/change_url b/scripts/change_url index a639a04..b3ee07d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -40,9 +40,9 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 domain="$new_domain" path="$new_path" -ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml" +ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config.yml" -chmod 600 "$backend_path/config.yml" +chmod 600 "$install_dir/config.yml" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 30293fd..40c0991 100644 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,6 @@ source /usr/share/yunohost/helpers timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) redis_db=$(ynh_redis_get_free_db) -backend_path=/opt/$app set_motd="" enable_registration="true" @@ -32,7 +31,6 @@ maxitemsperpage=50 # STORE SETTINGS FROM MANIFEST #================================================= -ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration ynh_app_setting_set --app=$app --key=enable_linksharing --value=$enable_linksharing @@ -44,31 +42,29 @@ ynh_app_setting_set --app=$app --key=maxavatarsize --value=$maxavatarsize ynh_app_setting_set --app=$app --key=maxitemsperpage --value=$maxitemsperpage #================================================= -# INSTALL FRONTEND +# INSTALL BACKEND #================================================= -ynh_script_progression --message="Setting up frontend..." --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --source_id="front" +ynh_setup_source --dest_dir="$install_dir" +executable="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" +ln -s "$executable" "$install_dir/vikunja" + +chmod +x "$install_dir/vikunja" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# INSTALL BACKEND +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Setting up backend..." --weight=1 +ynh_script_progression --message="Adding a configuration file..." --weight=1 -# Download, check integrity, uncompress and patch the source from app.src -mkdir -p "$backend_path" -mkdir -p "$backend_path/files" -tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id="back" -back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" -cp "$back" "$backend_path/vikunja" +ynh_add_config --template="config.yml" --destination="$install_dir/config.yml" -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" +chmod 400 "$install_dir/config.yml" +chown "$app:$app" "$install_dir/config.yml" #================================================= # SYSTEM CONFIGURATION @@ -81,23 +77,13 @@ ynh_add_systemd_config yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log" -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="config.yml" --destination="$backend_path/config.yml" - -chmod 400 "$backend_path/config.yml" -chown $app:$app "$backend_path/config.yml" - #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 +ynh_script_progression --message="Starting $app's systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="server started on" +ynh_systemd_action --service_name="$app" --action=start --log_path=systemd #--line_match="server started on" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 0e09476..e63c3ec 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SYSTEMD SERVICE +# REMOVE SYSTEMD SERVICE #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 @@ -28,9 +28,6 @@ ynh_remove_systemd_config ynh_redis_remove_db "$redis_db" -# Remove backend -ynh_secure_remove --file="$backend_path" - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 8e89323..84e0014 100644 --- a/scripts/restore +++ b/scripts/restore @@ -16,14 +16,9 @@ ynh_script_progression --message="Restoring $app main directory..." --weight=4 # Frontend ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" -# Backend -ynh_restore_file --origin_path="$backend_path" -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 0ed8ea6..d67d740 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,71 +17,65 @@ timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) redis_db=$(ynh_redis_get_free_db) -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If backend_path doesn't exist, create it -if [ -z "${backend_path:-}" ]; then - backend_path=/opt/$app - ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path -fi - if [ -z "${set_motd:-}" ]; then set_motd="" - ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd + ynh_app_setting_set --app="$app" --key="set_motd" --value="$set_motd" fi if [ -z "${enable_registration:-}" ]; then enable_registration="true" - ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration + ynh_app_setting_set --app="$app" --key="enable_registration" --value="$enable_registration" fi if [ -z "${enable_linksharing:-}" ]; then enable_linksharing="true" - ynh_app_setting_set --app=$app --key=enable_linksharing --value=$enable_linksharing + ynh_app_setting_set --app="$app" --key="enable_linksharing" --value="$enable_linksharing" fi if [ -z "${enable_taskattachments:-}" ]; then enable_taskattachments="true" - ynh_app_setting_set --app=$app --key=enable_taskattachments --value=$enable_taskattachments + ynh_app_setting_set --app="$app" --key="enable_taskattachments" --value="$enable_taskattachments" fi if [ -z "${enable_taskcomments:-}" ]; then enable_taskcomments="true" - ynh_app_setting_set --app=$app --key=enable_taskcomments --value=$enable_taskcomments + ynh_app_setting_set --app="$app" --key="enable_taskcomments" --value="$enable_taskcomments" fi if [ -z "${enable_emailreminders:-}" ]; then enable_emailreminders="true" - ynh_app_setting_set --app=$app --key=enable_emailreminders --value=$enable_emailreminders + ynh_app_setting_set --app="$app" --key="enable_emailreminders" --value="$enable_emailreminders" fi if [ -z "${enable_userdeletion:-}" ]; then enable_userdeletion="true" - ynh_app_setting_set --app=$app --key=enable_userdeletion --value=$enable_userdeletion + ynh_app_setting_set --app="$app" --key="enable_userdeletion" --value="$enable_userdeletion" fi if [ -z "${maxavatarsize:-}" ]; then maxavatarsize=1024 - ynh_app_setting_set --app=$app --key=maxavatarsize --value=$maxavatarsize + ynh_app_setting_set --app="$app" --key="maxavatarsize" --value="$maxavatarsize" fi if [ -z "${maxitemsperpage:-}" ]; then maxitemsperpage=50 - ynh_app_setting_set --app=$app --key=maxitemsperpage --value=$maxitemsperpage + ynh_app_setting_set --app="$app" --key="maxitemsperpage" --value="$maxitemsperpage" fi if [ -z "${language:-}" ]; then language="en" - ynh_app_setting_set --app=$app --key=language --value=$language + ynh_app_setting_set --app="$app" --key="language" --value="$language" +fi + +if ynh_compare_current_package_version --comparison lt --version "0.23.0~ynh1"; then + mv "$backend_path/config.yml" "$install_dir/config.yml" + ynh_secure_remove "$backend_path" + ynh_app_setting_delete --app="$app" --key="backend_path" fi #================================================= @@ -96,36 +90,27 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=5 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=5 +# Frontend +ynh_setup_source --dest_dir="$install_dir" +executable="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" +ln -s "$executable" "$install_dir/vikunja" - # Frontend - ynh_setup_source --dest_dir="$install_dir" --source_id="front" - - # Backend - mkdir -p "$backend_path/files" - tempdir="$(mktemp -d)" - ynh_setup_source --dest_dir=$tempdir --source_id="back" - back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" - cp "$back" "$backend_path/vikunja" -fi +chmod +x "$install_dir/vikunja" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" #================================================= # UPGRADE A CONFIGURATION #================================================= ynh_script_progression --message="Upgrading a configuration file..." --weight=1 -ynh_add_config --template="config.yml" --destination="$backend_path/config.yml" +ynh_add_config --template="config.yml" --destination="$install_dir/config.yml" -chmod 400 "$backend_path/config.yml" -chown $app:$app "$backend_path/config.yml" +chmod 400 "$install_dir/config.yml" +chown $app:$app "$install_dir/config.yml" #================================================= # NGINX CONFIGURATION diff --git a/tests.toml b/tests.toml index 98df2e1..11b0f90 100644 --- a/tests.toml +++ b/tests.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 [default]