diff --git a/ALL_README.md b/ALL_README.md
index a01b345..152f2e7 100644
--- a/ALL_README.md
+++ b/ALL_README.md
@@ -1,6 +1,7 @@
# All available README files by language
- [Read the README in English](README.md)
+- [Lea el README en español](README_es.md)
- [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)
diff --git a/README.md b/README.md
index cc276ab..e4fd245 100644
--- a/README.md
+++ b/README.md
@@ -18,9 +18,9 @@ It shall NOT be edited by hand.
Scratch is a free programming language and online community where you can create your own interactive stories, games, and animations.
-**Shipped version:** 3.0~ynh4
+**Shipped version:** 4.0.4~ynh1
-**Demo:**
+**Demo:**
## Screenshots
@@ -29,8 +29,8 @@ Scratch is a free programming language and online community where you can create
## Documentation and resources
- Official app website:
-- Official admin documentation:
-- Upstream app code repository:
+- Official admin documentation:
+- Upstream app code repository:
- YunoHost Store:
- Report a bug:
diff --git a/README_es.md b/README_es.md
new file mode 100644
index 0000000..6846a49
--- /dev/null
+++ b/README_es.md
@@ -0,0 +1,49 @@
+
+
+# Scratch para Yunohost
+
+[![Nivel de integración](https://dash.yunohost.org/integration/scratch.svg)](https://dash.yunohost.org/appci/app/scratch) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/scratch.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/scratch.maintain.svg)
+
+[![Instalar Scratch con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=scratch)
+
+*[Leer este README en otros idiomas.](./ALL_README.md)*
+
+> *Este paquete le permite instalarScratch rapidamente y simplement en un servidor YunoHost.*
+> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
+
+## Descripción general
+
+Scratch is a free programming language and online community where you can create your own interactive stories, games, and animations.
+
+**Versión actual:** 4.0.4~ynh1
+
+**Demo:**
+
+## Capturas
+
+![Captura de Scratch](./doc/screenshots/800px-Scratch_3.0_Éditeur.png)
+
+## Documentaciones y recursos
+
+- Sitio web oficial:
+- Documentación administrador oficial:
+- Repositorio del código fuente oficial de la aplicación :
+- Catálogo YunoHost:
+- Reportar un error:
+
+## Información para desarrolladores
+
+Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/scratch_ynh/tree/testing
+
+Para probar la rama `testing`, sigue asÍ:
+
+```bash
+sudo yunohost app install https://github.com/YunoHost-Apps/scratch_ynh/tree/testing --debug
+o
+sudo yunohost app upgrade scratch -u https://github.com/YunoHost-Apps/scratch_ynh/tree/testing --debug
+```
+
+**Mas informaciones sobre el empaquetado de aplicaciones:**
diff --git a/README_eu.md b/README_eu.md
index 4afbbe2..1e78c39 100644
--- a/README_eu.md
+++ b/README_eu.md
@@ -18,9 +18,9 @@ EZ editatu eskuz.
Scratch is a free programming language and online community where you can create your own interactive stories, games, and animations.
-**Paketatutako bertsioa:** 3.0~ynh4
+**Paketatutako bertsioa:** 4.0.4~ynh1
-**Demoa:**
+**Demoa:**
## Pantaila-argazkiak
@@ -29,8 +29,8 @@ Scratch is a free programming language and online community where you can create
## Dokumentazioa eta baliabideak
- Aplikazioaren webgune ofiziala:
-- Administratzaileen dokumentazio ofiziala:
-- Jatorrizko aplikazioaren kode-gordailua:
+- Administratzaileen dokumentazio ofiziala:
+- Jatorrizko aplikazioaren kode-gordailua:
- YunoHost Denda:
- Eman errore baten berri:
diff --git a/README_fr.md b/README_fr.md
index b70ce9e..8b29c25 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -18,9 +18,9 @@ Il NE doit PAS être modifié à la main.
Scratch est un langage de programmation graphique manipulable et exécutable par le logiciel de même nom à vocation éducative. Ainsi, Scratch est à la fois un environnement de développement et un moteur d’exécution du langage Scratch mais aussi un site web.
-**Version incluse :** 3.0~ynh4
+**Version incluse :** 4.0.4~ynh1
-**Démo :**
+**Démo :**
## Captures d’écran
@@ -29,8 +29,8 @@ Scratch est un langage de programmation graphique manipulable et exécutable par
## Documentations et ressources
- Site officiel de l’app :
-- Documentation officielle de l’admin :
-- Dépôt de code officiel de l’app :
+- Documentation officielle de l’admin :
+- Dépôt de code officiel de l’app :
- YunoHost Store :
- Signaler un bug :
diff --git a/README_gl.md b/README_gl.md
index d3ee565..a527520 100644
--- a/README_gl.md
+++ b/README_gl.md
@@ -18,9 +18,9 @@ NON debe editarse manualmente.
Scratch is a free programming language and online community where you can create your own interactive stories, games, and animations.
-**Versión proporcionada:** 3.0~ynh4
+**Versión proporcionada:** 4.0.4~ynh1
-**Demo:**
+**Demo:**
## Capturas de pantalla
@@ -29,8 +29,8 @@ Scratch is a free programming language and online community where you can create
## Documentación e recursos
- Web oficial da app:
-- Documentación oficial para admin:
-- Repositorio de orixe do código:
+- Documentación oficial para admin:
+- Repositorio de orixe do código:
- Tenda YunoHost:
- Informar dun problema:
diff --git a/README_zh_Hans.md b/README_zh_Hans.md
index 5549f37..d2dc653 100644
--- a/README_zh_Hans.md
+++ b/README_zh_Hans.md
@@ -3,7 +3,7 @@
请勿手动编辑。
-->
-# YunoHost 的 Scratch
+# YunoHost 上的 Scratch
[![集成程度](https://dash.yunohost.org/integration/scratch.svg)](https://dash.yunohost.org/appci/app/scratch) ![工作状态](https://ci-apps.yunohost.org/ci/badges/scratch.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/scratch.maintain.svg)
@@ -18,9 +18,9 @@
Scratch is a free programming language and online community where you can create your own interactive stories, games, and animations.
-**分发版本:** 3.0~ynh4
+**分发版本:** 4.0.4~ynh1
-**演示:**
+**演示:**
## 截图
@@ -29,8 +29,8 @@ Scratch is a free programming language and online community where you can create
## 文档与资源
- 官方应用网站:
-- 官方管理文档:
-- 上游应用代码库:
+- 官方管理文档:
+- 上游应用代码库:
- YunoHost 商店:
- 报告 bug:
diff --git a/conf/nginx.conf b/conf/nginx.conf
index 9c7977a..1aab834 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -1,11 +1,5 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
- # Path to source
- alias __INSTALL_DIR__/ ;
-
- index index.html;
-
- # Include SSOWAT user panel.
- include conf.d/yunohost_panel.conf.inc;
-}
\ No newline at end of file
+ alias __INSTALL_DIR__/www/;
+}
diff --git a/manifest.toml b/manifest.toml
index fadc015..ce58804 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 = "scratch"
@@ -5,23 +7,26 @@ name = "Scratch"
description.en = "Programming language to create your own interactive stories, games, and animations"
description.fr = "Langage de programmation pour créer vos propres histoires, jeux et animations interactifs"
-version = "3.0~ynh4"
+version = "4.0.4~ynh1"
maintainers = []
[upstream]
license = "BSD-3-Clause"
website = "https://scratch.mit.edu/"
-demo = "https://llk.github.io/scratch-gui/develop/"
-admindoc = "https://fr.scratch-wiki.info/wiki/Scratch_3.0"
-code = "https://github.com/LLK/scratch-gui"
+demo = "https://scratch.mit.edu/projects/editor/?tutorial=getStarted"
+admindoc = "https://scratch-wiki.info/wiki/Scratch_3.0"
+code = "https://github.com/scratchfoundation/scratch-gui"
[integration]
-yunohost = ">= 11.1.21"
+yunohost = ">= 11.2"
architectures = "all"
multi_instance = true
+
ldap = false
+
sso = false
+
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
@@ -39,9 +44,10 @@ ram.runtime = "50M"
default = "visitors"
[resources]
- [resources.sources.main]
- url = "https://github.com/YunoHost-Apps/scratch_ynh/releases/download/3.0-beta/scratch.zip"
- sha256 = "61aedce5a9f02534ca57e08b24eaedd9c5bb8077c1541211ca7688e277f3979f"
+ [resources.sources.main]
+ url = "https://github.com/scratchfoundation/scratch-gui/archive/refs/tags/v4.0.4.tar.gz"
+ sha256 = "04910a021c104ac2cedf71b224ea13253ea582a829d20fc7fab75eae0e7cbb2e"
+ autoupdate.strategy = "latest_github_tag"
[resources.system_user]
@@ -49,3 +55,5 @@ ram.runtime = "50M"
[resources.permissions]
main.url = "/"
+
+ [resources.ports]
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 944a65e..8bf600d 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -4,6 +4,9 @@
# COMMON VARIABLES
#=================================================
+# NodeJS version
+nodejs_version=18
+
#=================================================
# PERSONAL HELPERS
#=================================================
diff --git a/scripts/backup b/scripts/backup
index 52eea5b..98fca87 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -1,7 +1,5 @@
#!/bin/bash
-#=================================================
-# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@@ -22,9 +20,10 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir"
#=================================================
-# BACKUP THE NGINX CONFIGURATION
+# SYSTEM CONFIGURATION
#=================================================
+# Backup the nginx configuration
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
diff --git a/scripts/change_url b/scripts/change_url
index 4ba8cf7..cfcb0d6 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -1,7 +1,5 @@
#!/bin/bash
-#=================================================
-# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
diff --git a/scripts/install b/scripts/install
index 2bc5d1f..5e93dee 100644
--- a/scripts/install
+++ b/scripts/install
@@ -9,21 +9,44 @@
source _common.sh
source /usr/share/yunohost/helpers
+#=================================================
+# INSTALL DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Installing nodejs..." --weight=50
+
+ynh_install_nodejs --nodejs_version=$nodejs_version
+
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source --dest_dir="$install_dir"
+ynh_setup_source --dest_dir="$install_dir/sources"
chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+chown -R "$app:www-data" "$install_dir"
#=================================================
-# NGINX CONFIGURATION
+# Build
#=================================================
-ynh_script_progression --message="Configuring NGINX web server..." --weight=2
+ynh_script_progression --message="Installing $app..." --weight=40
+
+pushd "$install_dir/sources"
+ ynh_use_nodejs
+ ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" install
+ ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" BUILD_MODE=dist "$ynh_npm" run build
+popd
+
+mv "$install_dir/sources/build" "$install_dir/www"
+ynh_secure_remove --file="$install_dir/sources"
+
+chown -R "$app:www-data" "$install_dir"
+
+#=================================================
+# SYSTEM CONFIGURATION
+#=================================================
+ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
diff --git a/scripts/remove b/scripts/remove
index e7f44d8..74aeff0 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,7 +1,5 @@
#!/bin/bash
-#=================================================
-# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@@ -10,13 +8,14 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
-# REMOVE NGINX CONFIGURATION
+# REMOVE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
+ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
-# Remove the dedicated NGINX config
ynh_remove_nginx_config
+ynh_remove_nodejs
+
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/restore b/scripts/restore
index 16f767b..19e60b4 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -1,7 +1,5 @@
#!/bin/bash
-#=================================================
-# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@@ -10,15 +8,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# STANDARD RESTORATION STEPS
-#=================================================
-# RESTORE THE NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
-
-ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@@ -27,12 +16,19 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+chown -R "$app:www-data" "$install_dir"
#=================================================
-# GENERIC FINALIZATION
+# RESTORE THE NGINX CONFIGURATION
#=================================================
-# RELOAD NGINX AND PHP-FPM
+ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
+
+ynh_install_nodejs --nodejs_version="$nodejs_version"
+
+ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
+
+#=================================================
+# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
diff --git a/scripts/upgrade b/scripts/upgrade
index f905c2f..f6d6e51 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -1,7 +1,5 @@
#!/bin/bash
-#=================================================
-# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@@ -9,31 +7,38 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# CHECK VERSION
-#=================================================
-
-upgrade_type=$(ynh_check_app_version_changed)
-
#=================================================
# 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
-
- # Download, check integrity, uncompress and patch the source from app.src
- ynh_setup_source --dest_dir="$install_dir"
-fi
+# Download, check integrity, uncompress and patch the source from app.src
+ynh_setup_source --dest_dir="$install_dir/sources" --full_replace=1
chmod -R o-rwx "$install_dir"
-chown -R $app:www-data "$install_dir"
+chown -R "$app:www-data" "$install_dir"
#=================================================
-# NGINX CONFIGURATION
+# Build
#=================================================
-ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
+ynh_script_progression --message="Installing $app..." --weight=40
+
+pushd "$install_dir/sources"
+ ynh_use_nodejs
+ ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" install
+ ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" BUILD_MODE=dist "$ynh_npm" run build
+popd
+
+ynh_secure_remove --file="$install_dir/www"
+mv "$install_dir/sources/build" "$install_dir/www"
+ynh_secure_remove --file="$install_dir/sources"
+
+chown -R "$app:www-data" "$install_dir"
+
+#=================================================
+# REAPPLY SYSTEM CONFIGURATIONS
+#=================================================
+ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config