diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..2729a6b
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,55 @@
+---
+name: Bug report
+about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
+
+---
+
+**How to post a meaningful bug report**
+1. *Read this whole template first.*
+2. *Determine if you are on the right place:*
+ - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
+ - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
+ - *When in doubt, post here and we will figure it out together.*
+3. *Delete the italic comments as you write over them below, and remove this guide.*
+---
+
+### Describe the bug
+
+*A clear and concise description of what the bug is.*
+
+### Context
+
+- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
+- YunoHost version: x.x.x
+- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
+- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
+ - If yes, please explain:
+- Using, or trying to install package version/branch:
+- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
+
+### Steps to reproduce
+
+- *If you performed a command from the CLI, the command itself is enough. For example:*
+ ```sh
+ sudo yunohost app install the_app
+ ```
+- *If you used the webadmin, please perform the equivalent command from the CLI first.*
+- *If the error occurs in your browser, explain what you did:*
+ 1. *Go to '...'*
+ 2. *Click on '...'*
+ 3. *Scroll down to '...'*
+ 4. *See error*
+
+### Expected behavior
+
+*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
+
+### Logs
+
+*When an operation fails, YunoHost provides a simple way to share the logs.*
+- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
+- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
+
+*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
+
+*If applicable and useful, add screenshots to help explain your problem.*
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..ef70e18
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,16 @@
+## Problem
+
+- *Description of why you made this PR*
+
+## Solution
+
+- *And how do you fix that problem*
+
+## PR Status
+
+- [ ] Code finished and ready to be reviewed/tested
+- [ ] The fix/enhancement were manually tested (if applicable)
+
+## Automatic tests
+
+Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
diff --git a/README.md b/README.md
index 9b2e103..5e04b90 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Sutom for YunoHost
-[![Integration level](https://dash.yunohost.org/integration/sutom.svg)](https://dash.yunohost.org/appci/app/sutom) ![](https://ci-apps.yunohost.org/ci/badges/sutom.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/sutom.maintain.svg)
+[![Integration level](https://dash.yunohost.org/integration/sutom.svg)](https://dash.yunohost.org/appci/app/sutom) ![Working status](https://ci-apps.yunohost.org/ci/badges/sutom.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/sutom.maintain.svg)
[![Install Sutom with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sutom)
*[Lire ce readme en français.](./README_fr.md)*
@@ -18,30 +18,31 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Jeu de lettres en ligne (et en français) basé sur Wordle. Le jeu se trouve à l'adresse https://sutom.nocle.fr
-**Shipped version:** 1.0.0~ynh2
+**Shipped version:** 1.0.0~ynh3
**Demo:** https://sutom.nocle.fr/
## Screenshots
-![](./doc/screenshots/screenshot.png)
+![Screenshot of Sutom](./doc/screenshots/screenshot.png)
## Documentation and resources
-* Official app website: https://sutom.nocle.fr/
-* Upstream app code repository: https://framagit.org/JonathanMM/sutom
-* YunoHost documentation for this app: https://yunohost.org/app_sutom
-* Report a bug: https://github.com/YunoHost-Apps/sutom_ynh/issues
+* Official app website:
+* Upstream app code repository:
+* YunoHost documentation for this app:
+* Report a bug:
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/sutom_ynh/tree/testing).
To try the testing branch, please proceed like that.
-```
+
+``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/sutom_ynh/tree/testing --debug
or
sudo yunohost app upgrade sutom -u https://github.com/YunoHost-Apps/sutom_ynh/tree/testing --debug
```
-**More info regarding app packaging:** https://yunohost.org/packaging_apps
\ No newline at end of file
+**More info regarding app packaging:**
diff --git a/README_fr.md b/README_fr.md
index c1a4de6..f63b3b2 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -1,10 +1,14 @@
+
+
# Sutom pour YunoHost
-[![Niveau d'intégration](https://dash.yunohost.org/integration/sutom.svg)](https://dash.yunohost.org/appci/app/sutom) ![](https://ci-apps.yunohost.org/ci/badges/sutom.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/sutom.maintain.svg)
+[![Niveau d'intégration](https://dash.yunohost.org/integration/sutom.svg)](https://dash.yunohost.org/appci/app/sutom) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/sutom.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/sutom.maintain.svg)
[![Installer Sutom avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sutom)
*[Read this readme in english.](./README.md)*
-*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Sutom rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@@ -14,30 +18,31 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Jeu de lettres en ligne (et en français) basé sur Wordle. Le jeu se trouve à l'adresse https://sutom.nocle.fr
-**Version incluse :** 1.0.0~ynh2
+**Version incluse :** 1.0.0~ynh3
**Démo :** https://sutom.nocle.fr/
## Captures d'écran
-![](./doc/screenshots/screenshot.png)
+![Capture d'écran de Sutom](./doc/screenshots/screenshot.png)
## Documentations et ressources
-* Site officiel de l'app : https://sutom.nocle.fr/
-* Dépôt de code officiel de l'app : https://framagit.org/JonathanMM/sutom
-* Documentation YunoHost pour cette app : https://yunohost.org/app_sutom
-* Signaler un bug : https://github.com/YunoHost-Apps/sutom_ynh/issues
+* Site officiel de l'app :
+* Dépôt de code officiel de l'app :
+* Documentation YunoHost pour cette app :
+* Signaler un bug :
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/sutom_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
-```
+
+``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/sutom_ynh/tree/testing --debug
ou
sudo yunohost app upgrade sutom -u https://github.com/YunoHost-Apps/sutom_ynh/tree/testing --debug
```
-**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
\ No newline at end of file
+**Plus d'infos sur le packaging d'applications :**
diff --git a/check_process b/check_process
index 4b16641..108685a 100644
--- a/check_process
+++ b/check_process
@@ -11,9 +11,10 @@
setup_private=1
setup_public=1
upgrade=1
- #upgrade=1 from_commit=CommitHash
+ # 1.0.0~ynh1
+ upgrade=1 from_commit=3203df977e8ab92fb24968adcabbcd901ab84785
backup_restore=1
- multi_instance=0
+ multi_instance=1
change_url=1
;;; Options
Email=
diff --git a/conf/app.src b/conf/app.src
index 000fb2b..2731410 100644
--- a/conf/app.src
+++ b/conf/app.src
@@ -1,6 +1,7 @@
-SOURCE_URL=url of app's source
-SOURCE_SUM=sha256 checksum
+SOURCE_URL=https://framagit.org/JonathanMM/sutom/-/archive/05e6dfe28c1ebfebff4f22d99f68b2bbb2127569/sutom-05e6dfe28c1ebfebff4f22d99f68b2bbb2127569.tar.gz
+SOURCE_SUM=7428b08b0ca8c20c75b804e555ac77815d399c73f154b62f4a4d098f3bc53916
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
+SOURCE_FILENAME=
SOURCE_EXTRACT=true
diff --git a/conf/nginx.conf b/conf/nginx.conf
index dd08124..37be152 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -1,5 +1,5 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
-location ^~ __PATH__/ {
+location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__/;
proxy_redirect off;
@@ -12,8 +12,8 @@ location ^~ __PATH__/ {
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
+ more_clear_input_headers 'Accept-Encoding';
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
- more_clear_input_headers 'Accept-Encoding';
}
diff --git a/conf/systemd.service b/conf/systemd.service
index 6e0b5c8..7dab18b 100644
--- a/conf/systemd.service
+++ b/conf/systemd.service
@@ -6,10 +6,11 @@ After=network.target
Type=simple
User=__APP__
Group=__APP__
-WorkingDirectory=__FINALPATH__
-Environment="PATH=__ENV_PATH__"
+WorkingDirectory=__FINALPATH__/
+Environment="__YNH_NODE_LOAD_PATH__"
+Environment="SUTOM_PORT=__PORT__"
Environment="NODE_ENV=production"
-ExecStart=__YNH_NPM__ start
+ExecStart=__YNH_NPM__ run start:prod
Restart=always
# Sandboxing options to harden security
diff --git a/manifest.json b/manifest.json
index 365872d..0da77b7 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
"en": "Wordle-based online word game",
"fr": "Jeu de lettres en ligne basé sur Wordle"
},
- "version": "1.0.0~ynh2",
+ "version": "1.0.0~ynh3",
"url": "https://sutom.nocle.fr/",
"upstream": {
"license": "MIT",
@@ -22,12 +22,12 @@
"requirements": {
"yunohost": ">= 4.3.0"
},
- "multi_instance": false,
+ "multi_instance": true,
"services": [
"nginx"
],
"arguments": {
- "install" : [
+ "install": [
{
"name": "domain",
"type": "domain"
@@ -41,10 +41,6 @@
{
"name": "is_public",
"type": "boolean",
- "help": {
- "en": "If enabled, Sutom will be accessible by people who do not have an account. This can be changed later via the webadmin.",
- "fr": "Si cette case est cochée, Sutom sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
- },
"default": true
}
]
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 2e3ba04..b818f0f 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -4,8 +4,6 @@
# COMMON VARIABLES
#=================================================
-version_commit=05e6dfe28c1ebfebff4f22d99f68b2bbb2127569
-
nodejs_version=16
#=================================================
diff --git a/scripts/backup b/scripts/backup
index fb3c925..65e96c1 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
- ### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
diff --git a/scripts/change_url b/scripts/change_url
index 234969d..034d1af 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -28,6 +28,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
+
+# Add settings here as needed by your application
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
@@ -38,6 +40,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
+ ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
diff --git a/scripts/install b/scripts/install
index b2d77c4..e5da697 100755
--- a/scripts/install
+++ b/scripts/install
@@ -14,8 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
- ### Remove this function if there's nothing to clean before calling the remove script.
- true
+ ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@@ -57,7 +56,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
-port=$(ynh_find_port --port=4000)
+port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
@@ -83,12 +82,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
-
-git clone https://framagit.org/JonathanMM/sutom "$final_path" --quiet
-
-pushd "$final_path"
- git reset --hard --quiet $version_commit
-popd
+ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
@@ -109,8 +103,9 @@ ynh_script_progression --message="Building Sutom... (this will take some time an
pushd "$final_path"
ynh_use_nodejs
- ynh_exec_warn_less npm i -g npm
- ynh_exec_warn_less npm install --production
+ ynh_exec_warn_less ynh_exec_as $app NODE_ENV=production $ynh_node_load_PATH $ynh_npm install --production
+ ynh_exec_warn_less ynh_exec_as $app NODE_ENV=production $ynh_node_load_PATH ./node_modules/.bin/tsc
+ ln -sf $final_path/public/js/mots/listeMotsProposables.js $final_path/public/js/mots/listeMotsProposables.9.D.js
popd
#=================================================
@@ -118,11 +113,11 @@ popd
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
-env_path="$PATH"
-
# Create a dedicated systemd config
ynh_add_systemd_config
+#=================================================
+# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@@ -146,6 +141,8 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
+ # Everyone can access the app.
+ # The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
diff --git a/scripts/remove b/scripts/remove
index 4bc3575..42707a2 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -41,13 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
-#=================================================
-# REMOVE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Removing dependencies..." --weight=1
-
-ynh_remove_nodejs
-
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@@ -64,6 +57,13 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
+#=================================================
+# REMOVE DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Removing dependencies..." --weight=1
+
+ynh_remove_nodejs
+
#=================================================
# GENERIC FINALIZATION
#=================================================
diff --git a/scripts/restore b/scripts/restore
index ea78772..2dac620 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
- #### Remove this function if there's nothing to clean before calling the remove script.
- true
+ ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@@ -37,14 +36,15 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
-test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
+test ! -d $final_path \
+ || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
-ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
+ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@@ -72,7 +72,7 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=6
-# Install Nodejs
+# Define and install dependencies
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index 7b754e7..ffdba45 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -35,6 +35,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
+ ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@@ -79,11 +80,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
- #ynh_setup_source --dest_dir="$final_path"
- pushd $final_path
- git fetch
- #git checkout master
- git reset --hard --quiet $version_commit
+ ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
@@ -103,9 +100,10 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10
-# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
+#=================================================
+# SPECIFIC UPGRADE
#==============================================
# INSTALL SUTOM
#==============================================
@@ -113,8 +111,9 @@ ynh_script_progression --message="Building Sutom... (this will take some time an
pushd "$final_path"
ynh_use_nodejs
- ynh_exec_warn_less npm i -g npm
- ynh_exec_warn_less npm install --production
+ ynh_exec_warn_less ynh_exec_as $app NODE_ENV=production $ynh_node_load_PATH $ynh_npm install --production
+ ynh_exec_warn_less ynh_exec_as $app NODE_ENV=production $ynh_node_load_PATH ./node_modules/.bin/tsc
+ ln -sf $final_path/public/js/mots/listeMotsProposables.js $final_path/public/js/mots/listeMotsProposables.9.D.js
popd
#=================================================
@@ -122,8 +121,6 @@ popd
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
-env_path="$PATH"
-
# Create a dedicated systemd config
ynh_add_systemd_config
diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore
deleted file mode 100644
index 783a4ae..0000000
--- a/sources/extra_files/app/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*~
-*.sw[op]
diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore
deleted file mode 100644
index 783a4ae..0000000
--- a/sources/patches/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*~
-*.sw[op]