From 099c2e9137533591db77d58e45e119a4be1c1436 Mon Sep 17 00:00:00 2001 From: Mateusz <2871798+orhtej2@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:22:25 +0100 Subject: [PATCH] Release ready! (#5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update .gitignore * Fix permissions on $install_dir. * Fixed usages of `npm` * Fix change_url (#2) * Fix restore and change_url * Auto-update README --------- Co-authored-by: yunohost-bot * Actually fix restore (#3) * Fix linter errors (#4) * Fixed nginx.conf * Fuck off linter * Fixed usages of `sed` * Auto-update README * Bump version just for good measure. * Auto-update README * Fix description --------- Co-authored-by: yunohost-bot Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> --------- Co-authored-by: yunohost-bot Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> --- .gitignore | 38 +++++++++++++++++ README.md | 8 ++-- README_fr.md | 6 +-- conf/nginx.conf | 4 +- doc/DESCRIPTION.md | 2 +- manifest.toml | 8 ++-- scripts/change_url | 7 +++- scripts/config | 101 --------------------------------------------- scripts/install | 18 ++++---- scripts/restore | 6 +++ scripts/upgrade | 14 +++---- 11 files changed, 80 insertions(+), 132 deletions(-) delete mode 100644 scripts/config diff --git a/.gitignore b/.gitignore index 3da51e8..2f68c02 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,40 @@ +# Created by https://www.toptal.com/developers/gitignore/api/macos +# Edit at https://www.toptal.com/developers/gitignore?templates=macos + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +# End of https://www.toptal.com/developers/gitignore/api/macos + *~ *.sw[op] diff --git a/README.md b/README.md index 645d2dc..9700129 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -16,9 +16,9 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Design and prototyping platform meant for cross-domain teams. Non dependent on operating systems, Penpot is web based and works with open standards (SVG). Penpot invites designers all over the world to fall in love with open source while getting developers excited about the design process in return. +Design and prototyping platform meant for cross-domain teams. Non dependent on operating systems, web based and works with open standards (SVG). Penpot invites designers all over the world to fall in love with open source while getting developers excited about the design process in return. -**Shipped version:** 1.19.3~ynh1 +**Shipped version:** 1.19.3~ynh2 ## Screenshots @@ -45,4 +45,4 @@ or sudo yunohost app upgrade penpot -u https://github.com/YunoHost-Apps/penpot_ynh/tree/testing --debug ``` -**More info regarding app packaging:** +**More info regarding app packaging:** \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 8dbcb54..d35a05c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,5 +1,5 @@ @@ -16,9 +16,9 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -Design and prototyping platform meant for cross-domain teams. Non dependent on operating systems, Penpot is web based and works with open standards (SVG). Penpot invites designers all over the world to fall in love with open source while getting developers excited about the design process in return. +Design and prototyping platform meant for cross-domain teams. Non dependent on operating systems, web based and works with open standards (SVG). Penpot invites designers all over the world to fall in love with open source while getting developers excited about the design process in return. -**Version incluse :** 1.19.3~ynh1 +**Version incluse :** 1.19.3~ynh2 ## Captures d’écran diff --git a/conf/nginx.conf b/conf/nginx.conf index 8facb26..2935687 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -97,11 +97,11 @@ location / { more_set_headers "X-Cache-Status: $upstream_cache_status"; } - location ~* \.(js|css).*$ { + location ~* ^/.*\.(js|css).*$ { more_set_headers "Cache-Control: 'max-age=86400'"; # 24 hours } - location ~* \.(html).*$ { + location ~* ^/.*\.(html).*$ { more_set_headers "Cache-Control: 'no-cache, max-age=0'"; } diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index f127be7..74d81bb 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1 +1 @@ -Design and prototyping platform meant for cross-domain teams. Non dependent on operating systems, Penpot is web based and works with open standards (SVG). Penpot invites designers all over the world to fall in love with open source while getting developers excited about the design process in return. \ No newline at end of file +Design and prototyping platform meant for cross-domain teams. Non dependent on operating systems, web based and works with open standards (SVG). Penpot invites designers all over the world to fall in love with open source while getting developers excited about the design process in return. \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index f805de8..f10f09c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -3,10 +3,10 @@ packaging_format = 2 id = "penpot" name = "Penpot" -description.en = "Penpot - The Open-Source design and prototyping platform" -description.fr = "Penpot - La plateforme de conception et de prototypage open-source" +description.en = "Design and prototyping platform" +description.fr = "Plateforme de conception et de prototypage" -version = "1.19.3~ynh1" +version = "1.19.3~ynh2" maintainers = ["orhtej2"] @@ -21,7 +21,7 @@ code = "https://github.com/penpot/penpot" [integration] yunohost = '>= 11.2' architectures = ["amd64", "arm64"] -multi_instance = true +multi_instance = true ldap = false sso = false disk = "50M" diff --git a/scripts/change_url b/scripts/change_url index 1998d1e..56c9b45 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,7 +14,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app-backend --action="stop" +ynh_systemd_action --service_name=$app-exporter --action="stop" #================================================= # MODIFY URL IN NGINX CONF @@ -34,7 +35,9 @@ ynh_change_url_nginx_config #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app-backend --action="start" --log_path="/var/log/$app/$app-backend.log" --line_match="welcome to penpot" + +ynh_systemd_action --service_name=$app-exporter --action="start" --log_path="/var/log/$app/$app-exporter.log" --line_match="redis connection established" #================================================= # END OF SCRIPT diff --git a/scripts/config b/scripts/config deleted file mode 100644 index 29f78f8..0000000 --- a/scripts/config +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -# In simple cases, you don't need a config script. - -# With a simple config_panel.toml, you can write in the app settings, in the -# upstream config file or replace complete files (logo ...) and restart services. - -# The config scripts allows you to go further, to handle specific cases -# (validation of several interdependent fields, specific getter/setter for a value, -# display dynamic informations or choices, pre-loading of config type .cube... ). - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source /usr/share/yunohost/helpers - -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir) - -#================================================= -# SPECIFIC GETTERS FOR TOML SHORT KEY -#================================================= - -get__amount() { - # Here we can imagine to have an API call to stripe to know the amount of donation during a month - local amount=200 - - # It's possible to change some properties of the question by overriding it: - if [ "$amount" -gt 100 ]; then - cat << EOF -style: success -value: $amount -ask: - en: A lot of donation this month: **$amount €** -EOF - else - cat << EOF -style: danger -value: $amount -ask: - en: Not so much donation this month: $amount € -EOF - fi -} - -get__prices() { - local prices - prices="$(grep "DONATION\['" "$install_dir/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')" - if [ "$prices" == "," ]; then - # Return YNH_NULL if you prefer to not return a value at all. - echo YNH_NULL - else - echo "$prices" - fi -} - - -#================================================= -# SPECIFIC VALIDATORS FOR TOML SHORT KEYS -#================================================= -validate__publishable_key() { - - # We can imagine here we test if the key is really a publishable key - (is_secret_key "$publishable_key") && - echo 'This key seems to be a secret key' -} - -#================================================= -# SPECIFIC SETTERS FOR TOML SHORT KEYS -#================================================= -set__prices() { - - #--------------------------------------------- - # IMPORTANT: setters are triggered only if a change is detected - #--------------------------------------------- - for price in $(echo "$prices" | sed "s/,/ /"); do - frequency=$(echo "$price" | cut -d/ -f1) - currency=$(echo "$price" | cut -d/ -f2) - price_id=$(echo "$price" | cut -d/ -f3) - sed "d/DONATION\['$frequency'\]\['$currency'\]" "$install_dir/settings.py" - - echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$install_dir/settings.py" - done - - #--------------------------------------------- - # IMPORTANT: to be able to upgrade properly, you have to save the value in settings too - #--------------------------------------------- - ynh_app_setting_set --app="$app" --key=prices --value="$prices" -} - -#================================================= -# GENERIC FINALIZATION -#================================================= -ynh_app_config_run "$1" diff --git a/scripts/install b/scripts/install index d6ca80d..8dad00d 100644 --- a/scripts/install +++ b/scripts/install @@ -8,6 +8,8 @@ source _common.sh source /usr/share/yunohost/helpers + + redis_db=$(ynh_redis_get_free_db) secret_key=$(ynh_string_random --length=40) main_domain=$(yunohost domain list --output-as plain | grep -A1 -e '#main' | tail -n 1) @@ -54,7 +56,7 @@ ynh_script_progression --message="Setting up source files..." ynh_setup_source --dest_dir="$install_dir/build" chown -R $app:www-data "$install_dir" -chmod -R 755 "$install_dir" +chmod -R o-rwx "$install_dir" #================================================= # INSTALL APP @@ -66,19 +68,19 @@ pushd $install_dir/build/frontend # ynh_exec_warn_less ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME clojure -J-Xms100M -J-Xmx800M -J-XX:+UseSerialGC -M:dev:shadow-cljs release main --config-merge "{:release-version \"${current_hash}\"}" - ynh_exec_as $app $ynh_node_load_PATH npm exec gulp build - ynh_exec_as $app $ynh_node_load_PATH npm exec gulp dist:clean - ynh_exec_as $app $ynh_node_load_PATH npm exec gulp dist:copy + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp build + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp dist:clean + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp dist:copy - sed -i -re "s/\%version\%/$version/g" ./target/dist/index.html; - sed -i -re "s/\%buildDate\%/$build_date/g" ./target/dist/index.html; + ynh_replace_string --match_string="%version%" --replace_string="$version" --target_file="$install_dir/build/frontend/target/dist/index.html" + ynh_replace_string --match_string="%buildDate%" --replace_string="$build_date" --target_file="$install_dir/build/frontend/target/dist/index.html" echo "$version" > target/version.txt; popd mkdir -p $install_dir/frontend mv $install_dir/build/frontend/target/dist/* $install_dir/frontend chown -R $app:www-data $install_dir/frontend -chmod -R 755 $install_dir/frontend +chmod -R 750 $install_dir/frontend ynh_script_progression --message="Building backend..." --weight=5 @@ -112,7 +114,7 @@ pushd $install_dir/build/exporter cp yarn.lock target/ cp package.json target/ - sed -i -re "s/\%version\%/$version/g" ./target/app.js + ynh_replace_string --match_string="%version%" --replace_string="$version" --target_file="$install_dir/build/exporter/target/app.js" popd mkdir -p $install_dir/exporter diff --git a/scripts/restore b/scripts/restore index e68669e..5897951 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,11 +13,17 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= + +ynh_script_progression --message="Restoring NodeJS..." --weight=2 +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_restore_file --origin_path="$install_dir" chown -R $app:$app "$install_dir" +chown $app:www-data "$install_dir" +chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir/frontend" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bee1b89..ad0a23f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,8 +58,8 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/build" + chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" - chmod -R 755 "$install_dir" ynh_script_progression --message="Building frontend..." --weight=5 @@ -68,12 +68,12 @@ then # ynh_exec_warn_less ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME clojure -J-Xms100M -J-Xmx800M -J-XX:+UseSerialGC -M:dev:shadow-cljs release main --config-merge "{:release-version \"${current_hash}\"}" - ynh_exec_as $app $ynh_node_load_PATH npm exec gulp build - ynh_exec_as $app $ynh_node_load_PATH npm exec gulp dist:clean - ynh_exec_as $app $ynh_node_load_PATH npm exec gulp dist:copy + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp build + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp dist:clean + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp dist:copy - sed -i -re "s/\%version\%/$version/g" ./target/dist/index.html; - sed -i -re "s/\%buildDate\%/$build_date/g" ./target/dist/index.html; + ynh_replace_string --match_string="%version%" --replace_string="$version" --target_file="$install_dir/build/frontend/target/dist/index.html" + ynh_replace_string --match_string="%buildDate%" --replace_string="$build_date" --target_file="$install_dir/build/frontend/target/dist/index.html" echo "$version" > target/version.txt; popd @@ -116,7 +116,7 @@ then cp yarn.lock target/ cp package.json target/ - sed -i -re "s/\%version\%/$version/g" ./target/app.js + ynh_replace_string --match_string="%version%" --replace_string="$version" --target_file="$install_dir/build/exporter/target/app.js" popd ynh_secure_remove --file=$install_dir/exporter