jwe_ynh 2.0.0~ynh1 — paquet YunoHost initial (format v2, helpers 2.1)

This commit is contained in:
sucupira
2026-07-19 19:58:37 -04:00
commit 4869e6463c
17 changed files with 517 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
# Configuration de JWE — générée par YunoHost.
# Ce fichier est régénéré à chaque mise à jour ou changement d'URL :
# les valeurs proviennent des réglages d'installation de l'app.
HOST=127.0.0.1
PORT=__PORT__
ORIGIN=https://__DOMAIN__
# Optionnel : URL d'un style tileserver-gl auto-hébergé (vide = style OpenFreeMap par défaut)
PUBLIC_TILES_URL=__TILES_URL__
# Optionnel : token client Mapillary pour le mode street « An lari a »
PUBLIC_MAPILLARY_TOKEN=__MAPILLARY_TOKEN__
+12
View File
@@ -0,0 +1,12 @@
location / {
proxy_pass http://127.0.0.1:__PORT__;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_redirect off;
client_max_body_size 10M;
}
+50
View File
@@ -0,0 +1,50 @@
[Unit]
Description=JWE — jeu de géolocalisation OKI
After=network.target
[Service]
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__INSTALL_DIR__/app
Environment="PATH=__PATH_WITH_NODEJS__"
EnvironmentFile=__INSTALL_DIR__/app/.env
ExecStart=__NODEJS_DIR__/node build
Restart=on-failure
StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit
# Sandboxing options to harden security
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
RestrictNamespaces=yes
RestrictRealtime=yes
DevicePolicy=closed
ProtectClock=yes
ProtectHostname=yes
ProtectProc=invisible
ProtectSystem=full
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
LockPersonality=yes
SystemCallArchitectures=native
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged
# Denying access to capabilities that should not be relevant for webapps
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
[Install]
WantedBy=multi-user.target
+17
View File
@@ -0,0 +1,17 @@
### Configuration
The app configuration lives in `/var/www/__APP__/app/.env` (regenerated on upgrade and URL change):
- `PUBLIC_MAPILLARY_TOKEN` — Mapillary client token for the street mode *An lari a*. Get a free token on <https://www.mapillary.com/dashboard/developers>. Without it, the other 4 modes work normally.
- `PUBLIC_TILES_URL` — optional URL of a self-hosted tileserver-gl `style.json`. Empty = default OpenFreeMap style. See the [deployment guide](https://labola.o-k-i.net/ORGANISATION-KA-INTERNATIONALE/JWE/src/branch/master/docs/deploiement.md) for hosting your own OSM tiles.
After editing the file manually, restart the service: `systemctl restart __APP__`.
### Logs and service
- Service: `systemctl status __APP__`
- Logs: `/var/log/__APP__/__APP__.log` or `journalctl -u __APP__`
### Adding places to the game corpus
The location corpus is embedded in the build: adding places (see `docs/contribution.md` upstream) requires pushing to the upstream repository, then upgrading the app (`yunohost app upgrade __APP__`).
+17
View File
@@ -0,0 +1,17 @@
### Configuration
La configuration de l'app se trouve dans `/var/www/__APP__/app/.env` (régénéré à chaque mise à jour ou changement d'URL) :
- `PUBLIC_MAPILLARY_TOKEN` — token client Mapillary pour le mode street *An lari a*. Token gratuit obtenu sur <https://www.mapillary.com/dashboard/developers>. Sans lui, les 4 autres modes fonctionnent normalement.
- `PUBLIC_TILES_URL` — URL optionnelle d'un `style.json` tileserver-gl auto-hébergé. Vide = style OpenFreeMap par défaut. Voir le [guide de déploiement](https://labola.o-k-i.net/ORGANISATION-KA-INTERNATIONALE/JWE/src/branch/master/docs/deploiement.md) pour héberger vos propres tiles OSM.
Après une modification manuelle du fichier, redémarrer le service : `systemctl restart __APP__`.
### Logs et service
- Service : `systemctl status __APP__`
- Logs : `/var/log/__APP__/__APP__.log` ou `journalctl -u __APP__`
### Ajouter des lieux au corpus
Le corpus de lieux est embarqué dans le build : l'ajout de lieux (voir `docs/contribution.md` upstream) demande de pousser sur le dépôt upstream, puis de mettre à jour l'app (`yunohost app upgrade __APP__`).
+8
View File
@@ -0,0 +1,8 @@
JWE is a sovereign, GeoGuessr-like geolocation game focused on four overseas regions: **Guadeloupe, Martinique, Guyane and La Réunion**. The player sees a photo of a place — or navigates a street in the Mapillary viewer (*An lari a* mode) — and drops a pin on a map to guess the municipality, then discovers an educational Wikipedia/Wikidata factsheet… or a call for contributions when the place is undocumented (*Pwen blindé*).
### Features
- **Sovereign**: no Google, no Mapbox — MapLibre + free tiles, Wikipedia/Wikidata, self-hostable on a small server. (Documented exception: the *An lari a* street mode uses the Mapillary viewer, CC BY-SA 4.0 images, free client token.)
- **Ethical**: no accounts, no leaderboard, no dopaminergic mechanics.
- **Bilingual**: French / Creole.
- **5 game modes**: Konnèt moniman, Kote mwen ye ?, Défi 5 rounds, Aprann (explore), An lari a (street-level Mapillary).
+8
View File
@@ -0,0 +1,8 @@
JWE est un jeu de géolocalisation souverain, dans l'esprit de GeoGuessr, centré sur 4 régions : **Guadeloupe, Martinique, Guyane, La Réunion**. Le joueur voit une photo unique d'un lieu — ou navigue dans une rue en visionneuse Mapillary (mode *An lari a*) — et place un marqueur sur une carte pour deviner la commune — puis découvre une fiche éducative Wikipédia/Wikidata… ou un appel à contribution quand le lieu n'y est pas documenté (*Pwen blindé*).
### Fonctionnalités
- **Souverain** : zéro Google, zéro Mapbox — MapLibre + tiles libres, Wikipédia/Wikidata, auto-hébergeable sur un petit serveur. (Exception documentée : le mode street *An lari a* utilise la visionneuse Mapillary, images CC BY-SA 4.0, token client gratuit.)
- **Éthique** : pas de comptes, pas de leaderboard, pas de mécanique dopaminergique.
- **Bilingue** : français / créole.
- **5 modes de jeu** : Konnèt moniman, Kote mwen ye ?, Défi 5 rounds, Aprann (explorer), An lari a (street-level Mapillary).
+3
View File
@@ -0,0 +1,3 @@
JWE is installed and available at https://__DOMAIN__
If you did not provide a Mapillary token, the street mode « An lari a » will show as unavailable — the 4 other modes work. You can add the token later in `/var/www/__APP__/app/.env` (then `systemctl restart __APP__`).
+3
View File
@@ -0,0 +1,3 @@
JWE est installé et accessible sur https://__DOMAIN__
Si vous n'avez pas fourni de token Mapillary, le mode street « An lari a » affichera un message d'indisponibilité — les 4 autres modes fonctionnent. Vous pouvez ajouter le token plus tard dans `/var/www/__APP__/app/.env` (puis `systemctl restart __APP__`).
+79
View File
@@ -0,0 +1,79 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "jwe"
name = "JWE"
description.en = "Geolocation game (GeoGuessr-like) featuring Guadeloupe, Martinique, Guyane and La Réunion"
description.fr = "Jeu de géolocalisation (type GeoGuessr) : Guadeloupe, Martinique, Guyane et La Réunion"
version = "2.0.0~ynh1"
maintainers = []
[upstream]
license = "MIT"
website = "https://jwe.o-k-i.net"
code = "https://labola.o-k-i.net/ORGANISATION-KA-INTERNATIONALE/JWE"
admindoc = "https://labola.o-k-i.net/ORGANISATION-KA-INTERNATIONALE/JWE/src/branch/master/docs/deploiement.md"
fund = "https://liberapay.com/OKI/donate/"
[integration]
yunohost = ">= 12.1"
helpers_version = "2.1"
architectures = "all"
multi_instance = true
ldap = "not_relevant"
sso = "not_relevant"
disk = "500M"
ram.build = "800M"
ram.runtime = "150M"
[install]
[install.domain]
type = "domain"
full_domain = true
[install.init_main_permission]
type = "group"
default = "visitors"
[install.mapillary_token]
ask.en = "Mapillary client token"
ask.fr = "Token client Mapillary"
help.en = "Free client token from https://www.mapillary.com/dashboard/developers — only needed for the street mode « An lari a ». Leave empty to disable that mode."
help.fr = "Token client gratuit obtenu sur https://www.mapillary.com/dashboard/developers — requis uniquement pour le mode street « An lari a ». Laisser vide pour désactiver ce mode."
type = "string"
optional = true
[install.tiles_url]
ask.en = "Custom map style URL"
ask.fr = "URL de style cartographique personnalisée"
help.en = "Leave empty to use the default style (OpenFreeMap). Provide a style.json URL to use a self-hosted tileserver-gl instead."
help.fr = "Laisser vide pour utiliser le style par défaut (OpenFreeMap). Indiquer l'URL d'un style.json pour utiliser un tileserver-gl auto-hébergé."
type = "url"
optional = true
[resources]
[resources.sources.main]
url = "https://labola.o-k-i.net/ORGANISATION-KA-INTERNATIONALE/JWE/archive/v2.0.0.tar.gz"
sha256 = "1fd35ed6ffbcba1db6f2d1665df0543e8bb23ecdcf4b49f418746dc03fe8e8f0"
autoupdate.strategy = "latest_forgejo_tag"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.ports]
[resources.apt]
packages = "ca-certificates"
[resources.nodejs]
version = "20"
Executable
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
ynh_print_info "Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup "$install_dir"
#=================================================
# BACKUP SYSTEM CONFIGURATION
#=================================================
# Backup the NGINX configuration
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# Backup the systemd service unit
ynh_backup "/etc/systemd/system/$app.service"
# Backup the logrotate configuration
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression "Updating NGINX web server configuration..."
# this will most likely adjust NGINX config correctly
ynh_config_change_url_nginx
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression "Updating $app's configuration files..."
# $domain contient désormais le nouveau domaine (ORIGIN)
ynh_config_add --template="env" --destination="$install_dir/app/.env"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start" --wait_until="Listening" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Change of URL completed for $app"
+64
View File
@@ -0,0 +1,64 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Setting up source files..."
ynh_setup_source --dest_dir="$install_dir"
chown -R "$app:$app" "$install_dir"
#=================================================
# BUILD THE APP
#=================================================
ynh_script_progression "Building $app (this may take a few minutes)..."
pushd "$install_dir/app"
ynh_hide_warnings ynh_exec_as_app npm ci
ynh_hide_warnings ynh_exec_as_app npm run build
ynh_hide_warnings ynh_exec_as_app npm prune --omit=dev
popd
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
ynh_script_progression "Adding $app's configuration files..."
ynh_config_add --template="env" --destination="$install_dir/app/.env"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config using the conf/nginx.conf template
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add "$app" --description="Jeu de géolocalisation OKI" --log="/var/log/$app/$app.log"
# Use logrotate to manage application logfile(s)
mkdir -p "/var/log/$app"
chown -R "$app:$app" "/var/log/$app"
ynh_config_add_logrotate
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start" --wait_until="Listening" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Installation of $app completed"
Executable
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Removing system configurations related to $app..."
ynh_config_remove_logrotate
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status "$app" >/dev/null; then
yunohost service remove "$app"
fi
ynh_config_remove_systemd
ynh_config_remove_nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Removal of $app completed"
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir"
chown -R "$app:$app" "$install_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/systemd/system/$app.service"
systemctl enable "$app.service" --quiet
yunohost service add "$app" --description="Jeu de géolocalisation OKI" --log="/var/log/$app/$app.log"
mkdir -p "/var/log/$app"
chown -R "$app:$app" "/var/log/$app"
ynh_restore "/etc/logrotate.d/$app"
#=================================================
# RELOAD NGINX AND START THE APP SERVICE
#=================================================
ynh_script_progression "Reloading NGINX web server and $app's service..."
ynh_systemctl --service="$app" --action="start" --wait_until="Listening" --log_path="/var/log/$app/$app.log"
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Restoration completed for $app"
+68
View File
@@ -0,0 +1,68 @@
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir" --full_replace
chown -R "$app:$app" "$install_dir"
#=================================================
# RE-BUILD THE APP
#=================================================
ynh_script_progression "Building $app (this may take a few minutes)..."
pushd "$install_dir/app"
ynh_hide_warnings ynh_exec_as_app npm ci
ynh_hide_warnings ynh_exec_as_app npm run build
ynh_hide_warnings ynh_exec_as_app npm prune --omit=dev
popd
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression "Updating $app's configuration files..."
ynh_config_add --template="env" --destination="$install_dir/app/.env"
#=================================================
# REAPPLY SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
ynh_config_add_nginx
ynh_config_add_systemd
yunohost service add "$app" --description="Jeu de géolocalisation OKI" --log="/var/log/$app/$app.log"
mkdir -p "/var/log/$app"
chown -R "$app:$app" "/var/log/$app"
ynh_config_add_logrotate
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start" --wait_until="Listening" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"
+22
View File
@@ -0,0 +1,22 @@
test_format = 1.0
[default]
# ------------
# Checks to run
# ------------
[default.checks]
install = 1
remove = 1
upgrade = 1
backup_restore = 1
change_url = 1
multi_instance = 1
port_already_use = 1
# ------------
# Install args
# ------------
# Les questions mapillary_token et tiles_url sont optionnelles :
# aucune valeur à fournir pour les tests.