Compare commits

...
Author SHA1 Message Date
ietm64 ac7648f9fe Passage v1.3.0-beta
Build & Push Images / build (web) (push) Successful in 2m14s
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 44s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 1m0s
Build & Push Images / build (brain) (push) Successful in 1m37s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 3m15s
Build & Push Images / build-switcher (push) Successful in 23s
Build & Push Images / build (core) (push) Successful in 4m22s
2026-10-17 15:47:14 +02:00
ietm64 d9a90f8412 Accès tablette : vérification du pare-feu sous Linux (ufw, firewalld)
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 43s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 48s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 51s
- Choix de l'accès au pare-feu selon le système (HostNetworkAccessConfig) :
  Windows (PowerShell, UAC), Linux, sinon pas de diagnostic.
- Linux, sans droits root : ufw détecté via /etc/ufw/ufw.conf, firewalld via
  systemctl ; firewalld dit si le port est ouvert (firewall-cmd
  --query-port). Règles ufw illisibles sans root : port « inconnu », jamais
  de faux « prêt ».
- Vérification du réseau : état du pare-feu Linux et commande exacte à lancer
  sur la machine (sudo ufw allow <port>/tcp, ou firewall-cmd), avec bouton
  « Copier ». Pas d'autorisation en un clic (serveur sans écran).
- Le diagnostic reçoit le port réglé de l'accès distant.

Vérifié : core clean verify (1228 tests, dont lecture de ufw.conf,
interprétation de firewall-cmd et verdicts Linux), web build + 342 vitest,
lint sans erreur.
À redéployer : core + web (mode bureau ; aucune migration).
2026-10-17 15:41:50 +02:00
ietm64 2e9632de49 Mobile et tablette : arborescence en navigation par niveaux
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 41s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 47s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 49s
Avant : sur téléphone, toucher un arc ouvrait sa page et refermait le volet ;
pour voir chapitres et scènes il fallait viser une flèche de 12 px.

- En mode tiroir (< 1024 px), un niveau à la fois : toucher un nœud qui a
  des enfants entre dedans sans quitter le volet, bouton « retour » vers le
  niveau parent ; seule une feuille (scène, page…) navigue et ferme le volet.
- En-tête de niveau : titre, « Ouvrir la fiche » et actions de création du
  nœud (« Nouveau chapitre », « Nouvelle scène », « Nouvelle page »…).
- Lignes de 48 px minimum, titres sur deux lignes au plus, compteur
  d'éléments, pastilles de readiness conservées ; glisser-déposer réservé à
  l'ordinateur ; volet de 400 px sur tablette.
- Le volet rouvert montre le niveau de la page courante (élément surligné) ;
  l'accueil de la section n'est pas pris pour la page courante.
- Campagnes et Lore (panneau Templates gardé à la racine). Ordinateur
  inchangé : arbre classique.

Vérifié : web build + 342 vitest (logique de navigation testée), lint sans
erreur, e2e 80/80 dont le parcours mobile hub → scène réécrit pour les
niveaux, essais au doigt à 375 et 768 px (campagne et Lore).
À redéployer : web.
2026-10-17 15:34:41 +02:00
ietm64 fbb1956e17 Accès tablette : détection des pare-feu tiers (Bitdefender, Norton…)
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 46s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 59s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 1m4s
Constat terrain : avec Bitdefender, la règle Windows était en place et la
vérification affichait « prêt » alors que le pare-feu de l'antivirus
filtrait encore les connexions de la tablette.

- Lecture du Centre de sécurité Windows (SecurityCenter2/FirewallProduct) :
  les pare-feu tiers déclarés sont remontés avec le diagnostic.
- Vérification du réseau : plus de « tout est prêt » trompeur quand un pare-feu
  tiers est présent — avertissement nommant le logiciel, consigne (réseau
  domestique, mode furtif désactivé, règle entrante pour DM Loremind) et lien
  vers la doc.

Vérifié : core clean verify (1221 tests, dont la lecture réelle sur Windows
qui remonte bien « Bitdefender Pare-feu »), web build + 337 vitest, lint sans
erreur.
À redéployer : core + web (mode bureau ; aucune migration).
2026-10-17 15:08:12 +02:00
ietm64 8c6b642975 Accès tablette : vérification du réseau et autorisation pare-feu en un clic
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 42s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 51s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 1m33s
Build & Push Images / build (brain) (push) Successful in 1m39s
Build & Push Images / build (web) (push) Successful in 2m3s
Build & Push Images / build-switcher (push) Successful in 25s
Build & Push Images / build (core) (push) Successful in 4m13s
Constat terrain : le téléphone chargeait sans fin — le pare-feu Windows
n'avait aucune règle pour DM Loremind (la fenêtre d'autorisation n'apparaît
pas toujours) et le Wi-Fi était classé « Public » par défaut.

- Bloc « Vérification du réseau » dans Paramètres > Accès depuis une
  tablette : lit le type des réseaux connectés et les règles entrantes du
  pare-feu visant l'appli (PowerShell, lecture seule, sans droits admin).
- Bouton « Autoriser dans le pare-feu » : confirmation administrateur
  Windows (UAC), règle limitée aux réseaux privés, blocages éventuels de
  l'appli retirés ; résultat affiché (appliqué / annulé / échec).
- Réseau classé « Public » : explication + bouton « Ouvrir les réglages
  réseau » (le profil réseau reste un choix de l'utilisateur).
- Textes et doc corrigés (fin de la consigne trompeuse « réseaux privés
  uniquement ») ; section « La tablette charge sans fin » avec la commande
  manuelle de secours.

Vérifié : core clean verify (1219 tests, dont une vraie lecture du système
sur Windows), web build + 337 vitest, lint sans erreur, bloc vérifié en mode
bureau isolé.
À redéployer : core + web (mode bureau ; aucune migration).
2026-10-17 14:41:54 +02:00
31 changed files with 1757 additions and 68 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ from app.infrastructure.ollama_model_installer import ensure_ollama_embedding_mo
app = FastAPI( app = FastAPI(
title="LoreMind Brain", title="LoreMind Brain",
description="Backend IA pour la génération de contenu narratif.", description="Backend IA pour la génération de contenu narratif.",
version="1.0.3", version="1.3.0-beta",
) )
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
+1 -1
View File
@@ -14,7 +14,7 @@
<groupId>com.loremind</groupId> <groupId>com.loremind</groupId>
<artifactId>loremind-core</artifactId> <artifactId>loremind-core</artifactId>
<version>1.0.3</version> <version>1.3.0-beta</version>
<name>LoreMind Core</name> <name>LoreMind Core</name>
<description>Backend Core - Architecture Hexagonale</description> <description>Backend Core - Architecture Hexagonale</description>
@@ -0,0 +1,104 @@
package com.loremind.application.remoteaccess;
import com.loremind.domain.remoteaccess.NetworkSnapshot;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
/**
* Verdict « une tablette peut-elle joindre ce PC ? », calculé à partir des faits lus sur
* le système. Logique pure (testable sans Windows).
*
* @param supported vérification possible (Windows)
* @param ready rien ne bloque côté PC
* @param publicNetworks réseaux connectés classés « Public » que le pare-feu ne laisse pas passer
* @param firewallAllowed une règle active autorise l'application sur les réseaux privés
* @param firewallBlocked une règle active BLOQUE l'application (ex. « Annuler » dans la fenêtre Windows)
* @param thirdPartyFirewalls pare-feu tiers présents : leurs réglages ne sont pas lisibles, donc {@code ready}
* ne peut pas être garanti — le front avertit l'utilisateur de les régler lui-même
* @param program exécutable concerné
* @param platform {@code windows} ou {@code linux}
* @param linuxFirewall Linux : pare-feu actif ({@code ufw}, {@code firewalld}, {@code none})
* @param portOpen Linux : port autorisé ({@code null} = invérifiable sans droits administrateur)
* @param fixCommand Linux : commande à lancer pour ouvrir le port, ou {@code null}
*/
public record NetworkReadiness(
boolean supported,
boolean ready,
List<String> publicNetworks,
boolean firewallAllowed,
boolean firewallBlocked,
List<String> thirdPartyFirewalls,
String program,
String platform,
String linuxFirewall,
Boolean portOpen,
String fixCommand
) {
static final String PUBLIC = "Public";
static final String PRIVATE = "Private";
public static NetworkReadiness evaluate(NetworkSnapshot snapshot) {
if (snapshot == null || !snapshot.supported()) {
return new NetworkReadiness(false, false, List.of(), false, false, List.of(), null, null, null, null, null);
}
if (NetworkSnapshot.LINUX.equals(snapshot.platform())) {
return evaluateLinux(snapshot);
}
List<NetworkSnapshot.FirewallRule> rules = snapshot.rules() == null ? List.of() : snapshot.rules();
boolean allowedPrivate = covers(rules, "Allow", PRIVATE);
boolean blockedPrivate = covers(rules, "Block", PRIVATE);
boolean publicOpen = covers(rules, "Allow", PUBLIC) && !covers(rules, "Block", PUBLIC);
List<String> publicNetworks = (snapshot.networks() == null ? List.<NetworkSnapshot.Network>of() : snapshot.networks())
.stream()
.filter(n -> PUBLIC.equalsIgnoreCase(n.category()))
.map(n -> n.name() != null && !n.name().isBlank() ? n.name() : n.alias())
.toList();
// Un réseau public n'est un obstacle que si le pare-feu ne l'ouvre pas explicitement.
List<String> blockingPublic = publicOpen ? List.of() : publicNetworks;
// « ready » ne porte que sur ce qui est lisible (Windows) ; un pare-feu tiers est signalé à part.
boolean ready = allowedPrivate && !blockedPrivate && blockingPublic.isEmpty();
List<String> thirdParty = snapshot.thirdPartyFirewalls() == null ? List.of() : snapshot.thirdPartyFirewalls();
return new NetworkReadiness(true, ready, blockingPublic, allowedPrivate, blockedPrivate, thirdParty,
snapshot.program(), NetworkSnapshot.WINDOWS, null, null, null);
}
/**
* Linux : prêt si aucun pare-feu (ufw, firewalld) n'est actif, ou si le port est ouvert.
* Port invérifiable (ufw sans droits root) : pas prêt, mais pas en erreur — le front
* affiche la commande « au cas où ».
*/
private static NetworkReadiness evaluateLinux(NetworkSnapshot s) {
String fw = s.linuxFirewall() == null ? "none" : s.linuxFirewall();
boolean ready = "none".equals(fw) || Boolean.TRUE.equals(s.portOpen());
return new NetworkReadiness(true, ready, List.of(), false, false, List.of(), null,
NetworkSnapshot.LINUX, fw, s.portOpen(), ready ? null : linuxCommand(fw, s.port()));
}
static String linuxCommand(String firewall, int port) {
return switch (firewall) {
case "ufw" -> "sudo ufw allow " + port + "/tcp";
case "firewalld" -> "sudo firewall-cmd --permanent --add-port=" + port + "/tcp && sudo firewall-cmd --reload";
default -> null;
};
}
/** Une règle ACTIVE de cette action couvre-t-elle ce profil (« Any » couvre tout) ? */
private static boolean covers(List<NetworkSnapshot.FirewallRule> rules, String action, String profile) {
return rules.stream()
.filter(r -> action.equalsIgnoreCase(r.action()) && "True".equalsIgnoreCase(r.enabled()))
.anyMatch(r -> profiles(r.profile()).stream().anyMatch(p -> p.equals("any") || p.equals(profile.toLowerCase(Locale.ROOT))));
}
private static List<String> profiles(String raw) {
if (raw == null) return List.of();
return Arrays.stream(raw.split(","))
.map(s -> s.trim().toLowerCase(Locale.ROOT))
.filter(s -> !s.isEmpty())
.toList();
}
}
@@ -216,6 +216,11 @@ public class RemoteAccessService {
return deviceRepository.deleteById(deviceId); return deviceRepository.deleteById(deviceId);
} }
/** Port réseau réglé (ouvert ou non) : celui que le pare-feu doit laisser passer. */
public synchronized int configuredPort() {
return currentConfig().port();
}
/** Port du connecteur réseau ouvert, ou -1 (pour le filtre : qui vient « de l'extérieur » ?). */ /** Port du connecteur réseau ouvert, ou -1 (pour le filtre : qui vient « de l'extérieur » ?). */
public int lanPort() { public int lanPort() {
return lanConnector.runningPort(); return lanConnector.runningPort();
@@ -0,0 +1,53 @@
package com.loremind.domain.remoteaccess;
import java.util.List;
/**
* Faits bruts sur la machine hôte, lus par le système (pas d'interprétation ici) :
* réseaux connectés avec leur catégorie Windows, et règles ENTRANTES du pare-feu qui
* visent l'exécutable de l'application.
*
* @param supported vérification possible sur ce système (Windows uniquement)
* @param program exécutable visé par les règles (DM Loremind.exe en bureau)
* @param networks réseaux connectés
* @param rules règles entrantes du pare-feu pour ce programme
* @param thirdPartyFirewalls pare-feu tiers déclarés à Windows (Bitdefender, Norton…) : ils filtrent
* EN PLUS du pare-feu Windows, avec leurs propres règles, illisibles d'ici
* @param platform {@code windows} ou {@code linux}
* @param linuxFirewall Linux : pare-feu actif détecté ({@code ufw}, {@code firewalld}, {@code none})
* @param port port réseau de l'accès distant (Linux : port à ouvrir)
* @param portOpen Linux : port autorisé par le pare-feu ; {@code null} = impossible à savoir sans
* droits administrateur (ex. règles ufw illisibles)
*/
public record NetworkSnapshot(boolean supported, String program, List<Network> networks, List<FirewallRule> rules,
List<String> thirdPartyFirewalls, String platform, String linuxFirewall,
int port, Boolean portOpen) {
public static final String WINDOWS = "windows";
public static final String LINUX = "linux";
/** Instantané Windows (réseaux, règles du pare-feu, pare-feu tiers). */
public NetworkSnapshot(boolean supported, String program, List<Network> networks, List<FirewallRule> rules,
List<String> thirdPartyFirewalls) {
this(supported, program, networks, rules, thirdPartyFirewalls, WINDOWS, null, 0, null);
}
/** Instantané Linux : pare-feu actif et état du port quand il est lisible. */
public static NetworkSnapshot linux(String linuxFirewall, int port, Boolean portOpen) {
return new NetworkSnapshot(true, null, List.of(), List.of(), List.of(), LINUX, linuxFirewall, port, portOpen);
}
/** Catégorie Windows : {@code Public}, {@code Private} ou {@code DomainAuthenticated}. */
public record Network(String name, String alias, String category) {}
/**
* @param action {@code Allow} ou {@code Block}
* @param profile profils couverts : {@code Any}, ou liste comme {@code Private, Public}
* @param enabled {@code True} / {@code False}
*/
public record FirewallRule(String action, String profile, String enabled) {}
public static NetworkSnapshot unsupported() {
return new NetworkSnapshot(false, null, List.of(), List.of(), List.of());
}
}
@@ -0,0 +1,26 @@
package com.loremind.domain.remoteaccess.ports;
import com.loremind.domain.remoteaccess.NetworkSnapshot;
/**
* Port vers le système hôte pour que l'accès distant fonctionne vraiment : sans règle
* de pare-feu, ou sur un réseau classé « Public », Windows jette en silence les requêtes
* de la tablette (elle charge sans fin).
*/
public interface HostNetworkAccess {
/** Résultat de la demande d'autorisation dans le pare-feu. */
enum FirewallFixOutcome { APPLIED, CANCELLED, FAILED, UNSUPPORTED }
/** Lecture seule, sans droits administrateur. {@code port} : port réseau de l'accès distant. */
NetworkSnapshot inspect(int port);
/**
* Autorise l'application en entrée sur les réseaux privés. Passe par la confirmation
* administrateur du système (UAC) : bloque jusqu'à la réponse de l'utilisateur.
*/
FirewallFixOutcome allowThroughFirewall();
/** Ouvre la page des réglages réseau du système (pour passer un Wi-Fi en « Privé »). */
void openNetworkSettings();
}
@@ -0,0 +1,34 @@
package com.loremind.infrastructure.desktop;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loremind.domain.remoteaccess.NetworkSnapshot;
import com.loremind.domain.remoteaccess.ports.HostNetworkAccess;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import java.util.Locale;
/**
* Mode bureau : choisit l'accès au pare-feu selon le système — Windows (PowerShell, UAC),
* Linux (ufw / firewalld, lecture sans root), sinon rien à vérifier (macOS…).
*/
@Configuration
@Profile("local")
public class HostNetworkAccessConfig {
@Bean
public HostNetworkAccess hostNetworkAccess(ObjectMapper objectMapper) {
String os = System.getProperty("os.name", "").toLowerCase(Locale.ROOT);
if (os.startsWith("windows")) return new WindowsHostNetworkAccess(objectMapper);
if (os.contains("linux")) return new LinuxHostNetworkAccess();
return new UnsupportedHostNetworkAccess();
}
/** Système sans vérification prise en charge : le front n'affiche pas de diagnostic. */
static final class UnsupportedHostNetworkAccess implements HostNetworkAccess {
@Override public NetworkSnapshot inspect(int port) { return NetworkSnapshot.unsupported(); }
@Override public FirewallFixOutcome allowThroughFirewall() { return FirewallFixOutcome.UNSUPPORTED; }
@Override public void openNetworkSettings() { /* rien à ouvrir */ }
}
}
@@ -0,0 +1,120 @@
package com.loremind.infrastructure.desktop;
import com.loremind.domain.remoteaccess.NetworkSnapshot;
import com.loremind.domain.remoteaccess.ports.HostNetworkAccess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
/**
* Pare-feu sous Linux (Debian, Ubuntu, Fedora…) pour l'accès distant, SANS droits root.
* <p>
* Ce qu'on peut savoir sans root : quel pare-feu est actif — {@code ufw} via
* {@code /etc/ufw/ufw.conf} (lisible par tous), {@code firewalld} via {@code systemctl} — et,
* pour firewalld seulement, si le port est ouvert ({@code firewall-cmd --query-port}, autorisé
* aux utilisateurs). Les règles d'ufw ne se lisent qu'en root : l'état du port reste alors
* inconnu et le front affiche la commande à lancer. Pas d'autorisation en un clic : sur un
* serveur sans écran, aucune fenêtre ne peut demander le mot de passe administrateur.
* <p>
* Choisie au démarrage par {@code HostNetworkAccessConfig} sous Linux.
*/
public class LinuxHostNetworkAccess implements HostNetworkAccess {
private static final Logger log = LoggerFactory.getLogger(LinuxHostNetworkAccess.class);
private static final long COMMAND_TIMEOUT_S = 10;
static final String UFW = "ufw";
static final String FIREWALLD = "firewalld";
static final String NONE = "none";
private final Path ufwConf;
public LinuxHostNetworkAccess() {
this(Path.of("/etc/ufw/ufw.conf"));
}
LinuxHostNetworkAccess(Path ufwConf) {
this.ufwConf = ufwConf;
}
@Override
public NetworkSnapshot inspect(int port) {
if (ufwEnabled(readQuietly(ufwConf))) {
// Règles d'ufw illisibles sans root : état du port inconnu.
return NetworkSnapshot.linux(UFW, port, null);
}
if ("active".equals(run(List.of("systemctl", "is-active", FIREWALLD)).output().trim())) {
return NetworkSnapshot.linux(FIREWALLD, port, firewalldPortOpen(port));
}
return NetworkSnapshot.linux(NONE, port, null);
}
@Override
public FirewallFixOutcome allowThroughFirewall() {
return FirewallFixOutcome.UNSUPPORTED;
}
@Override
public void openNetworkSettings() {
// Pas de réglage réseau « Public / Privé » à basculer sous Linux.
}
/** {@code firewall-cmd --query-port} : « yes » (0) / « no » (1) ; autre = inconnu. */
private Boolean firewalldPortOpen(int port) {
Result r = run(List.of("firewall-cmd", "--query-port=" + port + "/tcp"));
return interpretQuery(r.exitCode(), r.output());
}
static Boolean interpretQuery(int exitCode, String output) {
String out = output == null ? "" : output.trim().toLowerCase(Locale.ROOT);
if (exitCode == 0 && out.startsWith("yes")) return true;
if (exitCode == 1 && out.startsWith("no")) return false;
return null;
}
/** {@code ENABLED=yes} dans ufw.conf (guillemets et casse tolérés). */
static boolean ufwEnabled(String conf) {
if (conf == null) return false;
return conf.lines()
.map(String::trim)
.filter(l -> !l.startsWith("#"))
.map(l -> l.replace("\"", "").replace("'", "").replace(" ", ""))
.anyMatch(l -> l.equalsIgnoreCase("ENABLED=yes"));
}
private static String readQuietly(Path file) {
try {
return Files.isReadable(file) ? Files.readString(file, StandardCharsets.UTF_8) : null;
} catch (IOException e) {
return null;
}
}
private record Result(int exitCode, String output) {}
/** Commande système sans shell (pas d'interprétation), avec délai ; absente → code -1. */
private static Result run(List<String> command) {
try {
Process p = new ProcessBuilder(command).redirectErrorStream(true).start();
p.getOutputStream().close();
if (!p.waitFor(COMMAND_TIMEOUT_S, TimeUnit.SECONDS)) {
p.destroyForcibly();
return new Result(-1, "");
}
return new Result(p.exitValue(), new String(p.getInputStream().readAllBytes(), StandardCharsets.UTF_8));
} catch (IOException e) {
log.debug("Commande {} indisponible : {}", command.get(0), e.getMessage());
return new Result(-1, "");
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return new Result(-1, "");
}
}
}
@@ -0,0 +1,215 @@
package com.loremind.infrastructure.desktop;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loremind.domain.remoteaccess.NetworkSnapshot;
import com.loremind.domain.remoteaccess.ports.HostNetworkAccess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
/**
* Accès au réseau et au pare-feu de Windows pour l'accès distant (mode bureau).
* <p>
* Lecture via PowerShell, sans droits administrateur. L'autorisation dans le pare-feu
* passe par {@code Start-Process -Verb RunAs} : Windows affiche sa confirmation
* administrateur (UAC) et l'utilisateur garde la main. La règle créée n'ouvre DM Loremind
* qu'aux réseaux PRIVÉS ; un Wi-Fi classé « Public » reste à basculer par l'utilisateur
* (réglage système, jamais modifié par l'application).
* <p>
* Les scripts sont passés en {@code -EncodedCommand} (UTF-16LE base64) : aucun problème de
* guillemets ni d'accents. Le seul paramètre variable est le chemin de l'exécutable,
* fourni par le système (pas par l'utilisateur), et échappé pour une chaîne PowerShell.
* <p>
* Choisie au démarrage par {@code HostNetworkAccessConfig} sous Windows.
*/
public class WindowsHostNetworkAccess implements HostNetworkAccess {
private static final Logger log = LoggerFactory.getLogger(WindowsHostNetworkAccess.class);
static final String RULE_NAME = "DM Loremind (accès tablette)";
private static final long INSPECT_TIMEOUT_S = 20;
/** Le temps pour l'utilisateur de lire et de répondre à la fenêtre UAC. */
private static final long ELEVATION_TIMEOUT_S = 180;
/** Code Windows ERROR_CANCELLED : l'utilisateur a refusé la confirmation administrateur. */
private static final int EXIT_CANCELLED = 1223;
private final ObjectMapper objectMapper;
public WindowsHostNetworkAccess(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
@Override
public NetworkSnapshot inspect(int port) {
String program = currentProgram();
if (!isWindows() || program == null) return NetworkSnapshot.unsupported();
try {
String json = runPowerShell(inspectScript(program), INSPECT_TIMEOUT_S).output();
return parseSnapshot(objectMapper, program, json);
} catch (IOException | RuntimeException e) {
log.warn("Accès distant : lecture du réseau / pare-feu impossible : {}", e.getMessage());
return NetworkSnapshot.unsupported();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return NetworkSnapshot.unsupported();
}
}
@Override
public FirewallFixOutcome allowThroughFirewall() {
String program = currentProgram();
if (!isWindows() || program == null) return FirewallFixOutcome.UNSUPPORTED;
String outer = "try {\n"
+ " $p = Start-Process -FilePath 'powershell.exe' -Verb RunAs -WindowStyle Hidden -Wait -PassThru "
+ "-ArgumentList @('-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-EncodedCommand','"
+ encode(allowScript(program)) + "')\n"
+ " exit $p.ExitCode\n"
+ "} catch { exit " + EXIT_CANCELLED + " }\n";
try {
int exit = runPowerShell(outer, ELEVATION_TIMEOUT_S).exitCode();
FirewallFixOutcome outcome = exit == 0 ? FirewallFixOutcome.APPLIED
: exit == EXIT_CANCELLED ? FirewallFixOutcome.CANCELLED : FirewallFixOutcome.FAILED;
log.info("Accès distant : autorisation pare-feu → {}", outcome);
return outcome;
} catch (IOException | RuntimeException e) {
log.warn("Accès distant : autorisation pare-feu impossible : {}", e.getMessage());
return FirewallFixOutcome.FAILED;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return FirewallFixOutcome.FAILED;
}
}
@Override
public void openNetworkSettings() {
if (!isWindows()) return;
try {
// « État du réseau » : le réseau connecté et son bouton « Propriétés » (type de profil).
new ProcessBuilder("cmd", "/c", "start", "", "ms-settings:network-status").start();
} catch (IOException e) {
log.warn("Ouverture des réglages réseau impossible : {}", e.getMessage());
}
}
// --- Scripts --------------------------------------------------------------------------
/** Réseaux connectés + règles entrantes visant ce programme (chemins avec %VARIABLES% compris). */
static String inspectScript(String program) {
return "$ErrorActionPreference = 'SilentlyContinue'\n"
// Sortie en UTF-8 : sinon la page de codes de la console abîme les noms de réseau accentués.
+ "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8\n"
+ "$p = '" + psQuote(program) + "'\n"
+ "$nets =@(Get-NetConnectionProfile | ForEach-Object { [pscustomobject]@{ name = $_.Name; "
+ "alias = $_.InterfaceAlias; category = $_.NetworkCategory.ToString() } })\n"
+ "$rules = @(Get-NetFirewallApplicationFilter | Where-Object { $_.Program -and "
+ "([Environment]::ExpandEnvironmentVariables($_.Program) -ieq $p) } | Get-NetFirewallRule | "
+ "Where-Object { $_.Direction.ToString() -eq 'Inbound' } | ForEach-Object { [pscustomobject]@{ "
+ "action = $_.Action.ToString(); profile = $_.Profile.ToString(); enabled = $_.Enabled.ToString() } })\n"
// Pare-feu TIERS déclarés au Centre de sécurité (le pare-feu Windows n'y figure pas) :
// ils filtrent en plus de Windows, avec des règles qu'on ne peut pas lire.
+ "$fw = @(Get-CimInstance -Namespace root/SecurityCenter2 -ClassName FirewallProduct | "
+ "ForEach-Object { $_.displayName } | Where-Object { $_ -and $_ -notmatch 'Windows' })\n"
+ "[pscustomobject]@{ networks = $nets; rules = $rules; thirdPartyFirewalls = $fw } | "
+ "ConvertTo-Json -Depth 4 -Compress\n";
}
/**
* Exécuté ÉLEVÉ : retire les blocages entrants visant CE programme (créés par un « Annuler »
* dans la fenêtre du pare-feu, ils l'emporteraient sur toute autorisation), remplace notre
* propre règle si elle existe, puis autorise sur les réseaux privés uniquement.
*/
static String allowScript(String program) {
String name = psQuote(RULE_NAME);
return "try {\n"
+ " $p = '" + psQuote(program) + "'\n"
+ " Get-NetFirewallApplicationFilter | Where-Object { $_.Program -and "
+ "([Environment]::ExpandEnvironmentVariables($_.Program) -ieq $p) } | Get-NetFirewallRule | "
+ "Where-Object { $_.Direction.ToString() -eq 'Inbound' -and $_.Action.ToString() -eq 'Block' } | "
+ "Remove-NetFirewallRule\n"
+ " Get-NetFirewallRule -DisplayName '" + name + "' -ErrorAction SilentlyContinue | Remove-NetFirewallRule\n"
+ " New-NetFirewallRule -DisplayName '" + name + "' -Direction Inbound -Program $p -Action Allow "
+ "-Profile Private -ErrorAction Stop | Out-Null\n"
+ " exit 0\n"
+ "} catch { exit 2 }\n";
}
static NetworkSnapshot parseSnapshot(ObjectMapper mapper, String program, String json) throws IOException {
JsonNode root = mapper.readTree(json == null || json.isBlank() ? "{}" : json.trim());
List<NetworkSnapshot.Network> networks = new ArrayList<>();
for (JsonNode n : array(root.path("networks"))) {
networks.add(new NetworkSnapshot.Network(text(n, "name"), text(n, "alias"), text(n, "category")));
}
List<NetworkSnapshot.FirewallRule> rules = new ArrayList<>();
for (JsonNode r : array(root.path("rules"))) {
rules.add(new NetworkSnapshot.FirewallRule(text(r, "action"), text(r, "profile"), text(r, "enabled")));
}
List<String> thirdParty = new ArrayList<>();
for (JsonNode f : array(root.path("thirdPartyFirewalls"))) {
if (f.isTextual() && !f.asText().isBlank()) thirdParty.add(f.asText());
}
return new NetworkSnapshot(true, program, networks, rules, thirdParty);
}
/** ConvertTo-Json écrit un objet seul (pas un tableau) quand la liste n'a qu'un élément. */
private static Iterable<JsonNode> array(JsonNode node) {
if (node == null || node.isMissingNode() || node.isNull()) return List.of();
return node.isArray() ? node : List.of(node);
}
private static String text(JsonNode node, String field) {
JsonNode v = node.get(field);
return v == null || v.isNull() ? null : v.asText();
}
static String psQuote(String value) {
return value.replace("'", "''");
}
static String encode(String script) {
return Base64.getEncoder().encodeToString(script.getBytes(StandardCharsets.UTF_16LE));
}
// --- Exécution ------------------------------------------------------------------------
private record Result(int exitCode, String output) {}
private static Result runPowerShell(String script, long timeoutSeconds) throws IOException, InterruptedException {
Process process = new ProcessBuilder("powershell.exe", "-NoProfile", "-NonInteractive",
"-ExecutionPolicy", "Bypass", "-EncodedCommand", encode(script))
.redirectError(ProcessBuilder.Redirect.DISCARD)
.start();
process.getOutputStream().close();
// Lecture en parallèle : un tampon de sortie plein bloquerait le processus avant sa fin.
CompletableFuture<String> output = CompletableFuture.supplyAsync(() -> {
try (InputStream out = process.getInputStream()) {
return new String(out.readAllBytes(), StandardCharsets.UTF_8);
} catch (IOException e) {
return "";
}
});
if (!process.waitFor(timeoutSeconds, TimeUnit.SECONDS)) {
process.destroyForcibly();
throw new IOException("PowerShell n'a pas répondu en " + timeoutSeconds + " s");
}
return new Result(process.exitValue(), output.join());
}
private static boolean isWindows() {
return System.getProperty("os.name", "").toLowerCase(Locale.ROOT).startsWith("windows");
}
/** Exécutable du processus courant : DM Loremind.exe en bureau (java.exe en développement). */
private static String currentProgram() {
return ProcessHandle.current().info().command().orElse(null);
}
}
@@ -1,8 +1,10 @@
package com.loremind.infrastructure.web.controller; package com.loremind.infrastructure.web.controller;
import com.loremind.application.remoteaccess.NetworkReadiness;
import com.loremind.application.remoteaccess.PairingCode; import com.loremind.application.remoteaccess.PairingCode;
import com.loremind.application.remoteaccess.RemoteAccessService; import com.loremind.application.remoteaccess.RemoteAccessService;
import com.loremind.application.remoteaccess.RemoteAccessStatus; import com.loremind.application.remoteaccess.RemoteAccessStatus;
import com.loremind.domain.remoteaccess.ports.HostNetworkAccess;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@@ -29,13 +31,18 @@ import java.util.Map;
public class RemoteAccessAdminController { public class RemoteAccessAdminController {
private final RemoteAccessService remoteAccessService; private final RemoteAccessService remoteAccessService;
private final HostNetworkAccess hostNetworkAccess;
public RemoteAccessAdminController(RemoteAccessService remoteAccessService) { public RemoteAccessAdminController(RemoteAccessService remoteAccessService, HostNetworkAccess hostNetworkAccess) {
this.remoteAccessService = remoteAccessService; this.remoteAccessService = remoteAccessService;
this.hostNetworkAccess = hostNetworkAccess;
} }
public record ConfigureRequest(boolean enabled, int port) {} public record ConfigureRequest(boolean enabled, int port) {}
/** Réponse du bouton « Autoriser dans le pare-feu » : ce qui s'est passé + le nouvel état. */
public record FirewallFixResponse(HostNetworkAccess.FirewallFixOutcome outcome, NetworkReadiness readiness) {}
@GetMapping @GetMapping
public RemoteAccessStatus status() { public RemoteAccessStatus status() {
return remoteAccessService.status(); return remoteAccessService.status();
@@ -51,6 +58,26 @@ public class RemoteAccessAdminController {
return remoteAccessService.newPairingCode(); return remoteAccessService.newPairingCode();
} }
/** Une tablette peut-elle joindre ce PC ? (type de réseau, règle du pare-feu) */
@GetMapping("/network-check")
public NetworkReadiness networkCheck() {
return NetworkReadiness.evaluate(hostNetworkAccess.inspect(remoteAccessService.configuredPort()));
}
/** Ajoute la règle du pare-feu ; attend la réponse de l'utilisateur à la confirmation Windows (UAC). */
@PostMapping("/firewall-rule")
public FirewallFixResponse allowThroughFirewall() {
HostNetworkAccess.FirewallFixOutcome outcome = hostNetworkAccess.allowThroughFirewall();
return new FirewallFixResponse(outcome, NetworkReadiness.evaluate(hostNetworkAccess.inspect(remoteAccessService.configuredPort())));
}
/** Ouvre les réglages réseau de Windows (pour passer un Wi-Fi « Public » en « Privé »). */
@PostMapping("/open-network-settings")
public ResponseEntity<Void> openNetworkSettings() {
hostNetworkAccess.openNetworkSettings();
return ResponseEntity.noContent().build();
}
@DeleteMapping("/devices/{id}") @DeleteMapping("/devices/{id}")
public ResponseEntity<Void> revoke(@PathVariable String id) { public ResponseEntity<Void> revoke(@PathVariable String id) {
return remoteAccessService.revoke(id) ? ResponseEntity.noContent().build() : ResponseEntity.notFound().build(); return remoteAccessService.revoke(id) ? ResponseEntity.noContent().build() : ResponseEntity.notFound().build();
@@ -0,0 +1,118 @@
package com.loremind.application.remoteaccess;
import com.loremind.domain.remoteaccess.NetworkSnapshot;
import com.loremind.domain.remoteaccess.NetworkSnapshot.FirewallRule;
import com.loremind.domain.remoteaccess.NetworkSnapshot.Network;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
/** Test du verdict « une tablette peut-elle joindre ce PC ? » à partir des faits lus sur Windows. */
class NetworkReadinessTest {
private static final Network HOME_PRIVATE = new Network("Bbox-Maison", "Wi-Fi", "Private");
private static final Network HOME_PUBLIC = new Network("Bbox-Maison", "Wi-Fi", "Public");
private static final FirewallRule ALLOW_PRIVATE = new FirewallRule("Allow", "Private", "True");
private static NetworkReadiness eval(List<Network> networks, List<FirewallRule> rules) {
return NetworkReadiness.evaluate(new NetworkSnapshot(true, "C:\\DM Loremind.exe", networks, rules, List.of()));
}
@Test
void unsupported_whenNotWindows() {
NetworkReadiness r = NetworkReadiness.evaluate(NetworkSnapshot.unsupported());
assertFalse(r.supported());
assertFalse(r.ready());
}
@Test
void ready_onPrivateNetwork_withAllowRule() {
NetworkReadiness r = eval(List.of(HOME_PRIVATE), List.of(ALLOW_PRIVATE));
assertTrue(r.ready());
assertTrue(r.firewallAllowed());
assertTrue(r.publicNetworks().isEmpty());
}
@Test
void notReady_withoutAnyRule_evenOnPrivateNetwork() {
// Cas réel du 2026-10-17 : Wi-Fi passé en privé, mais aucune règle → la tablette charge sans fin.
NetworkReadiness r = eval(List.of(HOME_PRIVATE), List.of());
assertFalse(r.ready());
assertFalse(r.firewallAllowed());
}
@Test
void notReady_onPublicNetwork_evenWithPrivateRule() {
NetworkReadiness r = eval(List.of(HOME_PUBLIC), List.of(ALLOW_PRIVATE));
assertFalse(r.ready());
assertEquals(List.of("Bbox-Maison"), r.publicNetworks());
}
@Test
void publicNetwork_isNotAnObstacle_whenPublicExplicitlyAllowed() {
NetworkReadiness r = eval(List.of(HOME_PUBLIC), List.of(new FirewallRule("Allow", "Private, Public", "True")));
assertTrue(r.ready());
assertTrue(r.publicNetworks().isEmpty());
}
@Test
void blockRule_winsOverAllow() {
NetworkReadiness r = eval(List.of(HOME_PRIVATE),
List.of(ALLOW_PRIVATE, new FirewallRule("Block", "Any", "True")));
assertFalse(r.ready());
assertTrue(r.firewallBlocked());
}
@Test
void disabledRules_areIgnored_andAnyCoversPrivate() {
assertFalse(eval(List.of(HOME_PRIVATE), List.of(new FirewallRule("Allow", "Private", "False"))).ready());
assertTrue(eval(List.of(HOME_PRIVATE), List.of(new FirewallRule("Allow", "Any", "True"))).ready());
}
@Test
void thirdPartyFirewall_isReported_withoutPretendingToKnowItsRules() {
// Cas réel du 2026-10-17 : Windows prêt, mais Bitdefender filtre en plus avec ses propres règles.
NetworkReadiness r = NetworkReadiness.evaluate(new NetworkSnapshot(true, "C:\\DM Loremind.exe",
List.of(HOME_PRIVATE), List.of(ALLOW_PRIVATE), List.of("Bitdefender Pare-feu")));
assertTrue(r.ready(), "Windows est prêt…");
assertEquals(List.of("Bitdefender Pare-feu"), r.thirdPartyFirewalls(), "…mais le pare-feu tiers est signalé");
}
@Test
void publicNetwork_withoutName_usesInterfaceAlias() {
NetworkReadiness r = eval(List.of(new Network(null, "Wi-Fi", "Public")), List.of(ALLOW_PRIVATE));
assertEquals(List.of("Wi-Fi"), r.publicNetworks());
}
// --- Linux ---
@Test
void linux_withoutFirewall_isReady() {
NetworkReadiness r = NetworkReadiness.evaluate(NetworkSnapshot.linux("none", 8765, null));
assertTrue(r.ready());
assertEquals("linux", r.platform());
assertNull(r.fixCommand());
}
@Test
void linux_ufw_portUnknown_proposesTheCommand() {
NetworkReadiness r = NetworkReadiness.evaluate(NetworkSnapshot.linux("ufw", 8765, null));
assertFalse(r.ready());
assertNull(r.portOpen());
assertEquals("sudo ufw allow 8765/tcp", r.fixCommand());
}
@Test
void linux_firewalld_closedThenOpen() {
NetworkReadiness closed = NetworkReadiness.evaluate(NetworkSnapshot.linux("firewalld", 9000, false));
assertFalse(closed.ready());
assertEquals("sudo firewall-cmd --permanent --add-port=9000/tcp && sudo firewall-cmd --reload", closed.fixCommand());
NetworkReadiness open = NetworkReadiness.evaluate(NetworkSnapshot.linux("firewalld", 9000, true));
assertTrue(open.ready());
assertNull(open.fixCommand());
}
}
@@ -0,0 +1,56 @@
package com.loremind.infrastructure.desktop;
import com.loremind.domain.remoteaccess.NetworkSnapshot;
import com.loremind.domain.remoteaccess.ports.HostNetworkAccess;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.junit.jupiter.api.Assertions.*;
/**
* Test de {@link LinuxHostNetworkAccess} : lecture de ufw.conf, interprétation de
* {@code firewall-cmd --query-port}, et cas ufw actif sans droits root (port inconnu).
*/
class LinuxHostNetworkAccessTest {
@Test
void ufwEnabled_readsTheConfigFile() {
assertTrue(LinuxHostNetworkAccess.ufwEnabled("# commentaire\nENABLED=yes\nLOGLEVEL=low"));
assertTrue(LinuxHostNetworkAccess.ufwEnabled("ENABLED=\"yes\""));
assertFalse(LinuxHostNetworkAccess.ufwEnabled("ENABLED=no"));
assertFalse(LinuxHostNetworkAccess.ufwEnabled("#ENABLED=yes"));
assertFalse(LinuxHostNetworkAccess.ufwEnabled(null));
}
@Test
void firewalldQuery_yesNoOrUnknown() {
assertEquals(Boolean.TRUE, LinuxHostNetworkAccess.interpretQuery(0, "yes\n"));
assertEquals(Boolean.FALSE, LinuxHostNetworkAccess.interpretQuery(1, "no\n"));
// Refus D-Bus / commande absente : on ne prétend rien.
assertNull(LinuxHostNetworkAccess.interpretQuery(-1, ""));
assertNull(LinuxHostNetworkAccess.interpretQuery(11, "Authorization failed."));
}
@Test
void activeUfw_meansPortUnknownWithoutRoot(@TempDir Path dir) throws Exception {
Path conf = dir.resolve("ufw.conf");
Files.writeString(conf, "ENABLED=yes\n");
NetworkSnapshot s = new LinuxHostNetworkAccess(conf).inspect(8765);
assertTrue(s.supported());
assertEquals("linux", s.platform());
assertEquals("ufw", s.linuxFirewall());
assertEquals(8765, s.port());
assertNull(s.portOpen());
}
@Test
void noOneClickFixOnLinux() {
assertEquals(HostNetworkAccess.FirewallFixOutcome.UNSUPPORTED,
new LinuxHostNetworkAccess(Path.of("absent")).allowThroughFirewall());
}
}
@@ -0,0 +1,87 @@
package com.loremind.infrastructure.desktop;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loremind.domain.remoteaccess.NetworkSnapshot;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import static org.junit.jupiter.api.Assertions.*;
/**
* Test de {@link WindowsHostNetworkAccess} : lecture du JSON de PowerShell (objet seul ou
* tableau), contenu des scripts, et — sur Windows seulement — un vrai appel en lecture seule.
*/
class WindowsHostNetworkAccessTest {
private final ObjectMapper mapper = new ObjectMapper();
@Test
void parse_handlesSingleObjectsAndArrays() throws Exception {
// ConvertTo-Json écrit un objet (pas un tableau) quand il n'y a qu'un élément.
String json = "{\"networks\":{\"name\":\"Bbox\",\"alias\":\"Wi-Fi\",\"category\":\"Private\"},"
+ "\"rules\":[{\"action\":\"Allow\",\"profile\":\"Private\",\"enabled\":\"True\"},"
+ "{\"action\":\"Block\",\"profile\":\"Public\",\"enabled\":\"True\"}]}";
NetworkSnapshot s = WindowsHostNetworkAccess.parseSnapshot(mapper, "C:\\app.exe", json);
assertTrue(s.supported());
assertEquals(1, s.networks().size());
assertEquals("Private", s.networks().get(0).category());
assertEquals(2, s.rules().size());
assertEquals("Block", s.rules().get(1).action());
assertTrue(s.thirdPartyFirewalls().isEmpty());
}
@Test
void parse_readsThirdPartyFirewalls_asSingleValueOrArray() throws Exception {
NetworkSnapshot one = WindowsHostNetworkAccess.parseSnapshot(mapper, "C:\\app.exe",
"{\"networks\":[],\"rules\":[],\"thirdPartyFirewalls\":\"Bitdefender Pare-feu\"}");
assertEquals(java.util.List.of("Bitdefender Pare-feu"), one.thirdPartyFirewalls());
NetworkSnapshot two = WindowsHostNetworkAccess.parseSnapshot(mapper, "C:\\app.exe",
"{\"networks\":[],\"rules\":[],\"thirdPartyFirewalls\":[\"Norton\",\"\"]}");
assertEquals(java.util.List.of("Norton"), two.thirdPartyFirewalls());
}
@Test
void parse_handlesEmptyLists_andEmptyOutput() throws Exception {
NetworkSnapshot empty = WindowsHostNetworkAccess.parseSnapshot(mapper, "C:\\app.exe", "{\"networks\":[],\"rules\":[]}");
assertTrue(empty.networks().isEmpty());
assertTrue(empty.rules().isEmpty());
NetworkSnapshot blank = WindowsHostNetworkAccess.parseSnapshot(mapper, "C:\\app.exe", " ");
assertTrue(blank.networks().isEmpty());
}
@Test
void scripts_quoteThePath_andOnlyOpenPrivateNetworks() {
String path = "C:\\Users\\l'MJ\\DM Loremind.exe";
String allow = WindowsHostNetworkAccess.allowScript(path);
assertTrue(allow.contains("'C:\\Users\\l''MJ\\DM Loremind.exe'"), "apostrophe doublée dans la chaîne PowerShell");
assertTrue(allow.contains("-Profile Private"));
assertFalse(allow.contains("Public"), "la règle ne doit jamais ouvrir les réseaux publics");
assertTrue(allow.contains("Remove-NetFirewallRule"), "les blocages de CE programme sont retirés");
assertTrue(WindowsHostNetworkAccess.inspectScript(path).contains("ConvertTo-Json"));
assertTrue(WindowsHostNetworkAccess.inspectScript(path).contains("SecurityCenter2"));
}
@Test
void encode_isUtf16LeBase64_asExpectedByEncodedCommand() {
String encoded = WindowsHostNetworkAccess.encode("é");
assertEquals("é", new String(Base64.getDecoder().decode(encoded), StandardCharsets.UTF_16LE));
}
@Test
@EnabledOnOs(OS.WINDOWS)
void inspect_readsTheRealSystem_onWindows() {
NetworkSnapshot s = new WindowsHostNetworkAccess(mapper).inspect(8765);
assertTrue(s.supported(), "PowerShell doit répondre en lecture seule sur Windows");
assertNotNull(s.program());
assertNotNull(s.thirdPartyFirewalls());
}
}
+18 -7
View File
@@ -133,19 +133,30 @@ test.describe('Shell mobile (375 px)', () => {
await page.getByRole('button', { name: "Ouvrir l'arborescence" }).tap(); await page.getByRole('button', { name: "Ouvrir l'arborescence" }).tap();
await expect(tree).toBeVisible(); await expect(tree).toBeVisible();
// Déplie « Scènes » puis l'arc / le chapitre jusqu'à la scène, au doigt. // Navigation par niveaux : toucher une ligne qui a des enfants « entre » dedans
for (const label of [/Scènes/, new RegExp(arc.name), new RegExp(chapter.name)]) { // (sans quitter le volet), jusqu'à la scène. Mode plat ou arc/chapitre selon le seed.
const row = tree.locator('.tree-row', { has: page.locator('.tree-btn', { hasText: label }) }).first(); const sceneRow = tree.locator('.drill-row', { hasText: scene.name });
if (await tree.getByRole('button', { name: scene.name }).isVisible()) break; for (const label of ['Scènes', arc.name, chapter.name]) {
const chevron = row.locator('.chevron-btn'); if (await sceneRow.isVisible()) break;
if (await chevron.count()) await chevron.tap(); const row = tree.locator('.drill-row', { hasText: label }).first();
if (await row.count()) {
await row.tap();
await expect(tree.locator('.drill-back')).toBeVisible();
await expect(tree).toBeVisible();
} }
await tree.getByRole('button', { name: scene.name }).tap(); }
await sceneRow.tap();
await expect(page).toHaveURL(new RegExp(`/scenes/${scene.id}$`)); await expect(page).toHaveURL(new RegExp(`/scenes/${scene.id}$`));
await expect(page.getByRole('heading', { level: 1, name: scene.name })).toBeVisible(); await expect(page.getByRole('heading', { level: 1, name: scene.name })).toBeVisible();
await expect(tree).toBeHidden(); await expect(tree).toBeHidden();
await expectNoHorizontalScroll(page); await expectNoHorizontalScroll(page);
// En rouvrant le volet, on retrouve le niveau de la scène, surlignée ; « retour » remonte.
await page.getByRole('button', { name: "Ouvrir l'arborescence" }).tap();
await expect(tree.locator('.drill-row.active', { hasText: scene.name })).toBeVisible();
await tree.locator('.drill-back').tap();
await expect(tree.locator('.drill-row.active', { hasText: scene.name })).toHaveCount(0);
}); });
test('écran de séance : journal et horloges lisibles sans scroll horizontal', async ({ page, request }) => { test('écran de séance : journal et horloges lisibles sans scroll horizontal', async ({ page, request }) => {
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "loremind-web", "name": "loremind-web",
"version": "1.0.3", "version": "1.3.0-beta",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "loremind-web", "name": "loremind-web",
"version": "1.0.3", "version": "1.3.0-beta",
"dependencies": { "dependencies": {
"@angular/animations": "^21.2.17", "@angular/animations": "^21.2.17",
"@angular/cdk": "^21.2.14", "@angular/cdk": "^21.2.14",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "loremind-web", "name": "loremind-web",
"version": "1.0.3", "version": "1.3.0-beta",
"description": "LoreMind Frontend - Angular", "description": "LoreMind Frontend - Angular",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
@@ -30,6 +30,33 @@ export interface PairingCode {
expiresAt: string; expiresAt: string;
} }
/** Une tablette peut-elle joindre ce PC ? (Windows : type de réseau + pare-feu) */
export interface NetworkReadiness {
supported: boolean;
ready: boolean;
/** Réseaux connectés classés « Public » que le pare-feu ne laisse pas passer. */
publicNetworks: string[];
firewallAllowed: boolean;
firewallBlocked: boolean;
/** Pare-feu tiers (Bitdefender…) : ils filtrent en plus de Windows, réglages illisibles d'ici. */
thirdPartyFirewalls: string[];
program?: string | null;
platform?: 'windows' | 'linux' | null;
/** Linux : pare-feu actif (ufw, firewalld) ou « none ». */
linuxFirewall?: string | null;
/** Linux : port autorisé ; null = invérifiable sans droits administrateur (ufw). */
portOpen?: boolean | null;
/** Linux : commande à lancer sur la machine pour ouvrir le port. */
fixCommand?: string | null;
}
export type FirewallFixOutcome = 'APPLIED' | 'CANCELLED' | 'FAILED' | 'UNSUPPORTED';
export interface FirewallFixResponse {
outcome: FirewallFixOutcome;
readiness: NetworkReadiness;
}
export interface RemoteSession { export interface RemoteSession {
/** Requête arrivée par le réseau local (tablette) plutôt que depuis le PC. */ /** Requête arrivée par le réseau local (tablette) plutôt que depuis le PC. */
remote: boolean; remote: boolean;
@@ -65,6 +92,19 @@ export class RemoteAccessService {
return this.http.delete<void>(`${this.adminUrl}/devices/${deviceId}`); return this.http.delete<void>(`${this.adminUrl}/devices/${deviceId}`);
} }
networkCheck(): Observable<NetworkReadiness> {
return this.http.get<NetworkReadiness>(`${this.adminUrl}/network-check`);
}
/** Attend la réponse de l'utilisateur à la confirmation administrateur de Windows. */
allowThroughFirewall(): Observable<FirewallFixResponse> {
return this.http.post<FirewallFixResponse>(`${this.adminUrl}/firewall-rule`, {});
}
openNetworkSettings(): Observable<void> {
return this.http.post<void>(`${this.adminUrl}/open-network-settings`, {});
}
pair(code: string, deviceName: string): Observable<PairedDevice> { pair(code: string, deviceName: string): Observable<PairedDevice> {
return this.http.post<PairedDevice>('/api/remote-access/pair', { code, deviceName }); return this.http.post<PairedDevice>('/api/remote-access/pair', { code, deviceName });
} }
@@ -36,6 +36,82 @@
} }
</div> </div>
@if (network?.supported) {
<div class="remote-block network-check" [class.ok]="allClear">
<h3>{{ 'remoteAccess.network.title' | translate }}</h3>
@if (isLinux) {
<!-- Linux : état du pare-feu lisible sans root, sinon commande à lancer sur la machine. -->
@if (network!.ready) {
<p class="check-ok">
<lucide-icon [img]="CheckCircle2" [size]="16"></lucide-icon>
{{ (network!.linuxFirewall === 'none' ? 'remoteAccess.network.linuxNone' : 'remoteAccess.network.linuxOpen')
| translate: { fw: network!.linuxFirewall, port: s.port } }}
</p>
} @else {
<div class="check-item">
<p class="check-problem">
{{ (network!.portOpen === false ? 'remoteAccess.network.linuxClosed' : 'remoteAccess.network.linuxUnknown')
| translate: { fw: network!.linuxFirewall, port: s.port } }}
</p>
@if (network!.fixCommand) {
<div class="command-row">
<code class="command">{{ network!.fixCommand }}</code>
<button type="button" class="btn-secondary" (click)="copyFixCommand()">
<lucide-icon [img]="Copy" [size]="14"></lucide-icon>
{{ (copied ? 'remoteAccess.network.copied' : 'remoteAccess.network.copy') | translate }}
</button>
</div>
}
</div>
}
} @else if (network!.ready) {
<p class="check-ok">
<lucide-icon [img]="CheckCircle2" [size]="16"></lucide-icon>
{{ (thirdPartyFirewalls.length > 0 ? 'remoteAccess.network.windowsReady' : 'remoteAccess.network.ready') | translate }}
</p>
} @else {
@if (network!.publicNetworks.length > 0) {
<div class="check-item">
<p class="check-problem">{{ 'remoteAccess.network.publicProblem' | translate: { names: network!.publicNetworks.join(', ') } }}</p>
<p class="note">{{ 'remoteAccess.network.publicHowTo' | translate }}</p>
<button type="button" class="btn-secondary" (click)="openNetworkSettings()">
<lucide-icon [img]="Settings2" [size]="15"></lucide-icon>
{{ 'remoteAccess.network.openSettings' | translate }}
</button>
</div>
}
@if (firewallNeedsFix) {
<div class="check-item">
<p class="check-problem">
{{ (network!.firewallBlocked ? 'remoteAccess.network.firewallBlocked' : 'remoteAccess.network.firewallMissing') | translate }}
</p>
<button type="button" class="btn-primary" (click)="allowFirewall()" [disabled]="fixing">
<lucide-icon [img]="ShieldCheck" [size]="16"></lucide-icon>
{{ (fixing ? 'remoteAccess.network.fixing' : 'remoteAccess.network.allowFirewall') | translate }}
</button>
<p class="note">{{ 'remoteAccess.network.uacNote' | translate }}</p>
</div>
}
}
@if (thirdPartyFirewalls.length > 0) {
<div class="check-item">
<p class="check-problem">{{ 'remoteAccess.network.thirdParty' | translate: { names: thirdPartyFirewalls.join(', ') } }}</p>
<p class="note">{{ 'remoteAccess.network.thirdPartyHowTo' | translate }}</p>
<a class="btn-link" [href]="'remoteAccess.network.docUrl' | translate" target="_blank" rel="noopener">
{{ 'remoteAccess.network.docLink' | translate }}
</a>
</div>
}
@if (fixMessage) {
<p class="fix-message" role="status">{{ fixMessage }}</p>
}
<button type="button" class="btn-link" (click)="checkNetwork()" [disabled]="checking">
<lucide-icon [img]="RefreshCw" [size]="14"></lucide-icon>
{{ (checking ? 'remoteAccess.network.checking' : 'remoteAccess.network.recheck') | translate }}
</button>
</div>
}
<div class="remote-block"> <div class="remote-block">
<h3>{{ 'remoteAccess.settings.pairTitle' | translate }}</h3> <h3>{{ 'remoteAccess.settings.pairTitle' | translate }}</h3>
@if (pairing) { @if (pairing) {
@@ -171,3 +171,85 @@
color: white; color: white;
} }
} }
// --- Vérification du réseau (pare-feu / réseau public) ---------------------------------
.network-check {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
padding: 0.9rem 1rem;
border-radius: 8px;
border: 1px solid rgba(245, 158, 11, 0.35);
background: rgba(245, 158, 11, 0.06);
&.ok {
border-color: rgba(34, 197, 94, 0.35);
background: rgba(34, 197, 94, 0.06);
}
}
.check-ok {
display: flex;
align-items: center;
gap: 0.45rem;
margin: 0;
color: #86efac;
font-size: 0.9rem;
}
.check-item {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
}
.check-problem {
margin: 0;
color: #fde68a;
font-size: 0.9rem;
line-height: 1.5;
}
.fix-message {
margin: 0;
font-size: 0.85rem;
color: rgba(255, 255, 255, 0.75);
}
.btn-link {
padding: 0;
border: none;
background: none;
color: #a5b4fc;
font-size: 0.85rem;
cursor: pointer;
min-height: 32px !important;
&:hover:not(:disabled) { text-decoration: underline; }
&:disabled { opacity: 0.6; cursor: wait; }
&:focus-visible { outline: 2px solid #6c63ff; border-radius: 4px; }
}
// Linux : commande d'ouverture du port, sélectionnable et copiable.
.command-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem;
max-width: 100%;
}
.command {
flex: 1 1 260px;
min-width: 0;
padding: 0.55rem 0.75rem;
border-radius: 6px;
background: #0b0b16;
border: 1px solid #2a2a45;
color: #c7d2fe;
font-size: 0.85rem;
overflow-wrap: anywhere;
user-select: all;
}
@@ -3,11 +3,11 @@ import { FormsModule } from '@angular/forms';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { TranslatePipe, TranslateService } from '@ngx-translate/core'; import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { LucideAngularModule, Tablet, Trash2, RefreshCw, AlertCircle, ShieldCheck } from 'lucide-angular'; import { LucideAngularModule, Tablet, Trash2, RefreshCw, AlertCircle, ShieldCheck, CheckCircle2, Settings2, Copy } from 'lucide-angular';
import QRCode from 'qrcode'; import QRCode from 'qrcode';
import { import {
PairedDevice, PairingCode, RemoteAccessService, RemoteAccessStatus NetworkReadiness, PairedDevice, PairingCode, RemoteAccessService, RemoteAccessStatus
} from '../../services/remote-access.service'; } from '../../services/remote-access.service';
import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog.service'; import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog.service';
@@ -28,6 +28,10 @@ export class RemoteAccessSectionComponent implements OnInit, OnDestroy {
readonly RefreshCw = RefreshCw; readonly RefreshCw = RefreshCw;
readonly AlertCircle = AlertCircle; readonly AlertCircle = AlertCircle;
readonly ShieldCheck = ShieldCheck; readonly ShieldCheck = ShieldCheck;
readonly CheckCircle2 = CheckCircle2;
readonly Settings2 = Settings2;
readonly Copy = Copy;
copied = false;
private readonly remoteAccess = inject(RemoteAccessService); private readonly remoteAccess = inject(RemoteAccessService);
private readonly translate = inject(TranslateService); private readonly translate = inject(TranslateService);
@@ -41,6 +45,12 @@ export class RemoteAccessSectionComponent implements OnInit, OnDestroy {
busy = false; busy = false;
error: string | null = null; error: string | null = null;
/** Pare-feu et type de réseau (Windows) : null tant que non vérifié ou accès fermé. */
network: NetworkReadiness | null = null;
checking = false;
fixing = false;
fixMessage: string | null = null;
pairing: PairingCode | null = null; pairing: PairingCode | null = null;
qrDataUrl: string | null = null; qrDataUrl: string | null = null;
secondsLeft = 0; secondsLeft = 0;
@@ -138,6 +148,76 @@ export class RemoteAccessSectionComponent implements OnInit, OnDestroy {
private apply(status: RemoteAccessStatus): void { private apply(status: RemoteAccessStatus): void {
this.status = status; this.status = status;
this.port = status.port; this.port = status.port;
if (status.running) {
this.checkNetwork();
} else {
this.network = null;
this.fixMessage = null;
}
}
// --- Vérification du réseau (Windows) ----------------------------------------------
/** Sans règle de pare-feu, ou sur un réseau « Public », la tablette charge sans fin : on le dit. */
checkNetwork(): void {
if (this.checking) return;
this.checking = true;
this.remoteAccess.networkCheck().subscribe({
next: r => { this.checking = false; this.network = r; },
error: () => { this.checking = false; this.network = null; }
});
}
/** Windows affiche sa confirmation administrateur : la requête attend la réponse. */
allowFirewall(): void {
if (this.fixing) return;
this.fixing = true;
this.fixMessage = null;
this.remoteAccess.allowThroughFirewall().subscribe({
next: res => {
this.fixing = false;
this.network = res.readiness;
this.fixMessage = this.translate.instant(`remoteAccess.network.fix.${res.outcome}`);
},
error: () => {
this.fixing = false;
this.fixMessage = this.translate.instant('remoteAccess.network.fix.FAILED');
}
});
}
openNetworkSettings(): void {
this.remoteAccess.openNetworkSettings().subscribe({ error: () => undefined });
}
/** Vert seulement si rien ne bloque côté Windows ET qu'aucun pare-feu tiers n'échappe à la vérification. */
get allClear(): boolean {
return !!this.network && this.network.ready && this.thirdPartyFirewalls.length === 0;
}
get thirdPartyFirewalls(): string[] {
return this.network?.thirdPartyFirewalls ?? [];
}
get isLinux(): boolean {
return this.network?.platform === 'linux';
}
get firewallNeedsFix(): boolean {
return !!this.network && !this.isLinux && (!this.network.firewallAllowed || this.network.firewallBlocked);
}
/** Linux : copie la commande d'ouverture du port (à lancer sur le serveur). */
async copyFixCommand(): Promise<void> {
const command = this.network?.fixCommand;
if (!command) return;
try {
await navigator.clipboard.writeText(command);
this.copied = true;
setTimeout(() => this.copied = false, 2000);
} catch {
this.copied = false; // presse-papiers indisponible : la commande reste lisible et sélectionnable
}
} }
/** Le QR code ouvre directement l'écran d'appairage avec le code pré-rempli. */ /** Le QR code ouvre directement l'écran d'appairage avec le code pré-rempli. */
@@ -13,6 +13,32 @@
} }
@if (!collapsed) { @if (!collapsed) {
<!-- Niveau ouvert en mode tiroir : son propre en-tête (retour, titre, actions). -->
@if (drawerMode && drillLevel; as level) {
<div class="drill-header">
<button type="button" class="drill-back" (click)="drillBack()">
<lucide-icon [img]="ArrowLeft" [size]="18"></lucide-icon>
<span class="drill-back-label">{{ drillBackLabel }}</span>
</button>
<h2 #drillTitle class="drill-title" tabindex="-1">{{ level.label }}</h2>
@if (level.route || level.createActions?.length) {
<div class="drill-actions">
@if (level.route) {
<button type="button" class="drill-action" (click)="openDrillLevel()">
<lucide-icon [img]="ExternalLink" [size]="15"></lucide-icon>
{{ 'treeDrill.open' | translate }}
</button>
}
@for (a of level.createActions; track a.id) {
<button type="button" class="drill-action" (click)="runCreateAction($event, a)">
<lucide-icon [img]="iconForAction(a)" [size]="15"></lucide-icon>
{{ a.label }}
</button>
}
</div>
}
</div>
} @else {
@if (titleRoute) { @if (titleRoute) {
<button <button
type="button" type="button"
@@ -39,10 +65,44 @@
} }
</div> </div>
} }
}
<!-- cdkDropListGroup : connecte toutes les drop lists de l'arbre (déplacement d'un <!-- cdkDropListGroup : connecte toutes les drop lists de l'arbre (déplacement d'un
nœud d'une liste à l'autre). Chaque ligne est un <app-sidebar-tree-node> : nœud d'une liste à l'autre). Chaque ligne est un <app-sidebar-tree-node> :
comme c'est un VRAI composant déclaré statiquement dans la drop list, son comme c'est un VRAI composant déclaré statiquement dans la drop list, son
cdkDrag résout sa drop list par DI (impossible via un template outlet-é). --> cdkDrag résout sa drop list par DI (impossible via un template outlet-é). -->
@if (drawerMode) {
<nav class="drill-list" [attr.aria-label]="drillLevel?.label || title">
@for (item of drillRows; track item.id; let first = $first) {
@if (!drillLevel && item.sectionHeaderBefore) {
<div class="tree-section-header" [class.first]="first">{{ item.sectionHeaderBefore }}</div>
}
<button type="button" class="drill-row"
[class.active]="isActive(item)"
[class.action]="item.isAction"
[attr.aria-current]="isActive(item) ? 'page' : null"
(click)="tapDrillRow(item)">
@if (iconFor(item); as icon) {
<lucide-icon [img]="icon" [size]="17" class="drill-icon"></lucide-icon>
}
@if (item.statusDot) {
<span class="status-dot"
[class.blocking]="item.statusDot === 'blocking'"
[class.recommended]="item.statusDot === 'recommended'"
[title]="item.statusDotTitle || (('readiness.dot.' + item.statusDot) | translate)"></span>
}
<span class="drill-label">{{ item.label }}</span>
@if (!item.isAction && drillCount(item); as count) {
<span class="drill-count">{{ count }}</span>
}
@if (canDrill(item)) {
<lucide-icon [img]="ChevronRight" [size]="18" class="drill-chevron"></lucide-icon>
}
</button>
} @empty {
<p class="drill-empty">{{ 'treeDrill.empty' | translate }}</p>
}
</nav>
} @else {
<div class="tree"> <div class="tree">
<div class="tree-list" cdkDropList <div class="tree-list" cdkDropList
id="sidebar-root" id="sidebar-root"
@@ -66,8 +126,9 @@
} }
</div> </div>
</div> </div>
<!-- Panneau bas (ex: Templates) ------------------------------------ --> }
@if (bottomPanel) { <!-- Panneau bas (ex: Templates) : à la racine seulement en mode tiroir. -->
@if (bottomPanel && !(drawerMode && drillLevel)) {
<section class="bottom-panel"> <section class="bottom-panel">
<div class="panel-header-row"> <div class="panel-header-row">
<button class="panel-header" (click)="togglePanel()"> <button class="panel-header" (click)="togglePanel()">
@@ -15,8 +15,10 @@
// Tiroir (shell < 1024 px) : largeur confortable au doigt, plafonnée par l'écran. // Tiroir (shell < 1024 px) : largeur confortable au doigt, plafonnée par l'écran.
&.drawer { &.drawer {
width: min(320px, 88vw); // Téléphone : presque tout l'écran ; tablette : assez large pour des titres sur une ligne.
width: min(400px, 88vw);
padding: 1rem 0.75rem; padding: 1rem 0.75rem;
overflow-y: auto;
} }
&.collapsed { &.collapsed {
@@ -264,3 +266,143 @@
.panel-header-action { width: 36px; height: 36px; } .panel-header-action { width: 36px; height: 36px; }
.panel-header, .panel-item { min-height: 40px; } .panel-header, .panel-item { min-height: 40px; }
} }
// --- Navigation par niveaux (mode tiroir) ------------------------------------------------
.drill-header {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid #1e1e3a;
}
.drill-back {
display: inline-flex;
align-items: center;
gap: 0.4rem;
align-self: flex-start;
max-width: 100%;
min-height: 44px;
padding: 0 0.6rem 0 0.25rem;
border: none;
border-radius: 8px;
background: transparent;
color: #a5b4fc;
font-size: 0.92rem;
cursor: pointer;
&:hover { background: rgba(138, 123, 200, 0.12); }
&:focus-visible { outline: 2px solid #6c63ff; }
}
.drill-back-label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.drill-title {
margin: 0;
padding: 0 0.25rem;
font-size: 1.1rem;
font-weight: 700;
line-height: 1.3;
color: white;
overflow-wrap: anywhere;
&:focus { outline: none; }
}
.drill-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.drill-action {
display: inline-flex;
align-items: center;
gap: 0.4rem;
min-height: 44px;
padding: 0 0.85rem;
border: 1px solid #2a2a45;
border-radius: 8px;
background: #161628;
color: #e5e7eb;
font-size: 0.88rem;
cursor: pointer;
&:hover { border-color: #6c63ff; }
&:focus-visible { outline: 2px solid #6c63ff; outline-offset: 2px; }
}
.drill-list {
display: flex;
flex-direction: column;
min-height: 0;
}
.drill-row {
display: flex;
align-items: center;
gap: 0.6rem;
width: 100%;
min-height: 48px;
padding: 0.55rem 0.5rem;
border: none;
border-bottom: 1px solid rgba(30, 30, 58, 0.8);
border-radius: 0;
background: transparent;
color: #e5e7eb;
font-size: 0.95rem;
text-align: left;
cursor: pointer;
&:hover { background: rgba(138, 123, 200, 0.08); }
&:focus-visible { outline: 2px solid #6c63ff; outline-offset: -2px; }
&.active { background: rgba(108, 99, 255, 0.16); color: white; }
&.action { color: #a5b4fc; }
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
&.blocking { background: #ef4444; }
&.recommended { background: #fb923c; }
}
}
.drill-icon { flex-shrink: 0; color: #9ca3af; }
// Titres longs : deux lignes au plus, puis points de suspension.
.drill-label {
flex: 1;
min-width: 0;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
line-height: 1.35;
}
.drill-count {
flex-shrink: 0;
min-width: 1.6rem;
padding: 0.1rem 0.45rem;
border-radius: 999px;
background: #1f2937;
color: #9ca3af;
font-size: 0.75rem;
text-align: center;
font-variant-numeric: tabular-nums;
}
.drill-chevron { flex-shrink: 0; color: #6b7280; }
.drill-empty {
margin: 1rem 0.5rem;
color: #6b7280;
font-size: 0.88rem;
}
@@ -1,13 +1,15 @@
import { Component, Input, Output, EventEmitter, HostListener, OnDestroy, ElementRef, forwardRef } from '@angular/core'; import { Component, Input, Output, EventEmitter, HostListener, OnDestroy, ElementRef, ViewChild, forwardRef } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Router } from '@angular/router'; import { NavigationEnd, Router } from '@angular/router';
import { Subscription, filter } from 'rxjs';
import { TranslatePipe } from '@ngx-translate/core'; import { TranslatePipe } from '@ngx-translate/core';
import { CdkDropList, CdkDrag, CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop'; import { CdkDropList, CdkDrag, CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop';
import { LucideAngularModule, ChevronRight, ChevronDown, PanelLeftClose, PanelLeftOpen, Plus, FolderPlus, FilePlus, Home, LucideIconData } from 'lucide-angular'; import { LucideAngularModule, ChevronRight, ChevronDown, PanelLeftClose, PanelLeftOpen, Plus, FolderPlus, FilePlus, Home, ArrowLeft, ExternalLink, LucideIconData } from 'lucide-angular';
import { TreeItem, TreeCreateAction, SidebarAction, BottomPanel, BottomPanelItem, LayoutService, ReorderKind, SidebarReorderContext } from '../../services/layout.service'; import { TreeItem, TreeCreateAction, SidebarAction, BottomPanel, BottomPanelItem, LayoutService, ReorderKind, SidebarReorderContext } from '../../services/layout.service';
import { SidebarReorderService } from '../../services/sidebar-reorder.service'; import { SidebarReorderService } from '../../services/sidebar-reorder.service';
import { SidebarTreeNodeComponent } from './sidebar-tree-node.component'; import { SidebarTreeNodeComponent } from './sidebar-tree-node.component';
import { resolveIcon } from '../../lore/lore-icons'; import { resolveIcon } from '../../lore/lore-icons';
import { countLabel, hasChildren as nodeHasChildren, resolveStack, stackForActive } from './tree-drilldown';
@Component({ @Component({
selector: 'app-secondary-sidebar', selector: 'app-secondary-sidebar',
@@ -29,7 +31,21 @@ export class SecondarySidebarComponent implements OnDestroy {
* Mode tiroir (shell < 1024 px) : largeur fixée par le CSS, pas de repli 44 px * Mode tiroir (shell < 1024 px) : largeur fixée par le CSS, pas de repli 44 px
* ni de poignée de redimensionnement — le tiroir se ferme depuis la barre haute. * ni de poignée de redimensionnement — le tiroir se ferme depuis la barre haute.
*/ */
@Input() drawerMode = false; @Input() set drawerMode(value: boolean) {
this._drawerMode = value;
if (value) this.syncDrillToActive();
}
get drawerMode(): boolean { return this._drawerMode; }
private _drawerMode = false;
// --- Navigation par niveaux (mode tiroir : téléphone, tablette) ---------------------
// Un niveau à la fois au lieu de l'arbre indenté : toucher un nœud qui a des enfants
// « entre » dedans (sans naviguer ni fermer le tiroir), « retour » remonte. Seule une
// feuille (scène, page…) navigue — le tiroir se ferme alors au changement de route.
/** Pile des nœuds ouverts, de la racine vers le niveau affiché. */
drill: TreeItem[] = [];
@ViewChild('drillTitle') private drillTitle?: ElementRef<HTMLElement>;
private routerSub?: Subscription;
@Output() collapsedChange = new EventEmitter<boolean>(); @Output() collapsedChange = new EventEmitter<boolean>();
/** true = ouvert (on affiche les items) ; false = replié (titre seul). */ /** true = ouvert (on affiche les items) ; false = replié (titre seul). */
@@ -43,6 +59,8 @@ export class SecondarySidebarComponent implements OnDestroy {
readonly FolderPlus = FolderPlus; readonly FolderPlus = FolderPlus;
readonly FilePlus = FilePlus; readonly FilePlus = FilePlus;
readonly Home = Home; readonly Home = Home;
readonly ArrowLeft = ArrowLeft;
readonly ExternalLink = ExternalLink;
isCollapsed = false; isCollapsed = false;
@@ -79,6 +97,10 @@ export class SecondarySidebarComponent implements OnDestroy {
this._items = value ?? []; this._items = value ?? [];
this._buildDragMaps(); this._buildDragMaps();
this.autoExpandActiveAncestors(); this.autoExpandActiveAncestors();
// Arbre reconstruit (même ids, nouveaux objets) : on garde le niveau où l'on était.
this.drill = this.drill.length
? resolveStack(this._items, this.drill.map(n => n.id))
: resolveStack(this._items, stackForActive(this._items, i => this.isDrillActive(i)));
} }
get items(): TreeItem[] { return this._items; } get items(): TreeItem[] { return this._items; }
@@ -94,6 +116,10 @@ export class SecondarySidebarComponent implements OnDestroy {
private elementRef: ElementRef<HTMLElement>, private elementRef: ElementRef<HTMLElement>,
private reorderService: SidebarReorderService private reorderService: SidebarReorderService
) { ) {
// Après chaque navigation, le tiroir rouvert montre le niveau de la page courante.
this.routerSub = this.router.events
.pipe(filter(e => e instanceof NavigationEnd))
.subscribe(() => { if (this._drawerMode) this.syncDrillToActive(); });
try { try {
const stored = localStorage.getItem(SecondarySidebarComponent.WIDTH_STORAGE_KEY); const stored = localStorage.getItem(SecondarySidebarComponent.WIDTH_STORAGE_KEY);
const parsed = stored ? parseInt(stored, 10) : NaN; const parsed = stored ? parseInt(stored, 10) : NaN;
@@ -142,6 +168,7 @@ export class SecondarySidebarComponent implements OnDestroy {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.routerSub?.unsubscribe();
// Sécurité : si le composant est détruit en plein drag, on restaure le curseur global. // Sécurité : si le composant est détruit en plein drag, on restaure le curseur global.
if (this.isResizing) { if (this.isResizing) {
document.body.style.userSelect = ''; document.body.style.userSelect = '';
@@ -149,6 +176,68 @@ export class SecondarySidebarComponent implements OnDestroy {
} }
} }
/** Niveau affiché : le dernier nœud ouvert, ou null à la racine. */
get drillLevel(): TreeItem | null {
return this.drill.length ? this.drill[this.drill.length - 1] : null;
}
/** Lignes du niveau affiché. */
get drillRows(): TreeItem[] {
return this.drillLevel ? this.drillLevel.children ?? [] : this._items;
}
/** Libellé du bouton retour : le niveau parent, ou le titre de la section. */
get drillBackLabel(): string {
return this.drill.length > 1 ? this.drill[this.drill.length - 2].label : this.title;
}
drillCount(item: TreeItem): string | null {
return countLabel(item);
}
canDrill(item: TreeItem): boolean {
return !item.isAction && nodeHasChildren(item);
}
/** Toucher une ligne : entrer si elle a des enfants, sinon ouvrir sa page. */
tapDrillRow(item: TreeItem): void {
if (this.canDrill(item)) {
this.drill = [...this.drill, item];
this.focusDrillTitle();
} else if (item.route) {
this.router.navigate([item.route]);
}
}
drillBack(): void {
this.drill = this.drill.slice(0, -1);
this.focusDrillTitle();
}
/** « Ouvrir la fiche » du niveau affiché (arc, chapitre, dossier…). */
openDrillLevel(): void {
const route = this.drillLevel?.route;
if (route) this.router.navigate([route]);
}
/**
* Page courante pour le choix du niveau. L'accueil de la section (route du titre) ne
* compte pas : un nœud qui y pointe (ex. « Parties » → hub) ouvrirait sinon le tiroir
* dans ce nœud au lieu de la racine.
*/
private isDrillActive(item: TreeItem): boolean {
return item.route !== this.titleRoute && this.isActive(item);
}
private syncDrillToActive(): void {
this.drill = resolveStack(this._items, stackForActive(this._items, i => this.isDrillActive(i)));
}
/** Lecteurs d'écran / clavier : le focus suit le changement de niveau. */
private focusDrillTitle(): void {
setTimeout(() => this.drillTitle?.nativeElement.focus());
}
runAction(action: SidebarAction): void { runAction(action: SidebarAction): void {
if (action.route) { this.router.navigate([action.route]); } if (action.route) { this.router.navigate([action.route]); }
} }
@@ -0,0 +1,51 @@
import { TreeItem } from '../../services/layout.service';
import { countLabel, findPath, resolveStack, stackForActive } from './tree-drilldown';
const scene = (id: string): TreeItem => ({ id, label: id, route: `/s/${id}` });
const tree = (): TreeItem[] => [
{ id: 'parties', label: 'Parties', children: [scene('p1')] },
{
id: 'arc1', label: 'Acte I', route: '/arc1', children: [
{ id: 'ch1', label: 'Chapitre 1', route: '/ch1', children: [scene('s1'), scene('s2')] },
{ id: 'ch2', label: 'Chapitre 2', route: '/ch2' }
]
},
{ id: 'npcs', label: 'PNJ', meta: '3', children: [{ id: 'new', label: '+ PNJ', isAction: true, route: '/new' }] },
{ id: 'tables', label: 'Tables', route: '/tables' }
];
describe('tree drill-down', () => {
it('finds the path from the root to a node', () => {
expect(findPath(tree(), 's2')?.map(n => n.id)).toEqual(['arc1', 'ch1', 's2']);
expect(findPath(tree(), 'nope')).toBeNull();
});
it('resolves a stack of ids against a rebuilt tree, stopping at what disappeared', () => {
expect(resolveStack(tree(), ['arc1', 'ch1']).map(n => n.id)).toEqual(['arc1', 'ch1']);
expect(resolveStack(tree(), ['arc1', 'gone', 'x']).map(n => n.id)).toEqual(['arc1']);
// ch2 n'a pas d'enfants : on ne peut pas « entrer » dedans.
expect(resolveStack(tree(), ['arc1', 'ch2']).map(n => n.id)).toEqual(['arc1']);
});
it('opens the level of the current page', () => {
// Sur une scène : on voit ses sœurs (le chapitre).
expect(stackForActive(tree(), i => i.id === 's2')).toEqual(['arc1', 'ch1']);
// Sur un arc : on voit son contenu.
expect(stackForActive(tree(), i => i.id === 'arc1')).toEqual(['arc1']);
// Sur une feuille racine, ou nulle part : la racine.
expect(stackForActive(tree(), i => i.id === 'tables')).toEqual([]);
expect(stackForActive(tree(), () => false)).toEqual([]);
});
it('prefers the deepest active node', () => {
expect(stackForActive(tree(), i => i.id === 'arc1' || i.id === 'ch1')).toEqual(['arc1', 'ch1']);
});
it('shows the given badge, else the number of real children', () => {
const [parties, arc1, npcs, tables] = tree();
expect(countLabel(parties)).toBe('1');
expect(countLabel(arc1)).toBe('2');
expect(countLabel(npcs)).toBe('3');
expect(countLabel(tables)).toBeNull();
});
});
@@ -0,0 +1,68 @@
import { TreeItem } from '../../services/layout.service';
/**
* Navigation PAR NIVEAUX dans l'arborescence (mode tiroir : téléphone, tablette).
* Au lieu d'un arbre indenté à minuscules chevrons, on affiche un niveau à la fois :
* toucher un nœud qui a des enfants « entre » dedans, un bouton retour remonte.
* Logique pure, sans Angular (testée en vitest).
*/
/** Chemin racine → nœud (inclus), ou null si l'id n'existe pas. */
export function findPath(items: TreeItem[], id: string): TreeItem[] | null {
for (const item of items) {
if (item.id === id) return [item];
const sub = findPath(item.children ?? [], id);
if (sub) return [item, ...sub];
}
return null;
}
/**
* Ré-résout une pile d'ids après une reconstruction de l'arbre (les objets changent,
* les ids restent) : on suit les ids niveau par niveau et on s'arrête au premier
* qui a disparu (nœud supprimé, ou plus d'enfants).
*/
export function resolveStack(items: TreeItem[], ids: string[]): TreeItem[] {
const stack: TreeItem[] = [];
let level = items;
for (const id of ids) {
const node = level.find(i => i.id === id);
if (!node || !hasChildren(node)) break;
stack.push(node);
level = node.children ?? [];
}
return stack;
}
/**
* Niveau à afficher pour la page courante : les ancêtres du nœud actif le plus
* profond, plus le nœud lui-même s'il a des enfants (sur la page d'un arc, on voit
* ses chapitres). Aucun nœud actif → racine.
*/
export function stackForActive(items: TreeItem[], isActive: (item: TreeItem) => boolean): string[] {
const path = deepestActivePath(items, isActive);
if (!path) return [];
const active = path[path.length - 1];
const containers = hasChildren(active) ? path : path.slice(0, -1);
return containers.map(n => n.id);
}
function deepestActivePath(items: TreeItem[], isActive: (item: TreeItem) => boolean): TreeItem[] | null {
for (const item of items) {
const sub = deepestActivePath(item.children ?? [], isActive);
if (sub) return [item, ...sub];
if (isActive(item)) return [item];
}
return null;
}
export function hasChildren(item: TreeItem): boolean {
return !!item.children && item.children.length > 0;
}
/** Compteur affiché à droite d'une ligne : le badge fourni, sinon le nombre d'enfants réels. */
export function countLabel(item: TreeItem): string | null {
if (item.meta) return item.meta;
const n = (item.children ?? []).filter(c => !c.isAction).length;
return n > 0 ? String(n) : null;
}
+36 -1
View File
@@ -2393,7 +2393,7 @@
"title": "Access from a tablet", "title": "Access from a tablet",
"hint": "Browse and edit your campaigns from a tablet or phone on the same Wi-Fi as this PC. Each device must be authorized once, with a code shown here.", "hint": "Browse and edit your campaigns from a tablet or phone on the same Wi-Fi as this PC. Each device must be authorized once, with a code shown here.",
"enable": "Allow access from the local network", "enable": "Allow access from the local network",
"firewallNote": "When you turn this on, Windows may ask to allow DM Loremind through the firewall: choose \"Private networks\" only. Only enable it on a trusted network (your home router), never on public Wi-Fi.", "firewallNote": "Once access is on, DM Loremind checks that the Windows firewall and your network type let the tablet through, and helps you fix it if needed. Only turn it on at home, never on public Wi-Fi.",
"addressTitle": "Address to open on the tablet", "addressTitle": "Address to open on the tablet",
"noAddress": "No local network address found: check that this PC is connected to your Wi-Fi or home router.", "noAddress": "No local network address found: check that this PC is connected to your Wi-Fi or home router.",
"pairTitle": "Connect a device", "pairTitle": "Connect a device",
@@ -2434,6 +2434,37 @@
"onHostTitle": "You're on the PC", "onHostTitle": "You're on the PC",
"onHostText": "This page is for connecting a tablet. On this PC, access is managed from Settings.", "onHostText": "This page is for connecting a tablet. On this PC, access is managed from Settings.",
"onHostLink": "Open access settings" "onHostLink": "Open access settings"
},
"network": {
"title": "Network check",
"ready": "The firewall and the network let the tablet through.",
"publicProblem": "Windows considers your network \"{{names}}\" public: it blocks other devices, even with the firewall permission.",
"publicHowTo": "If it's your home network, switch it to \"Private\": Windows network settings > your Wi-Fi > Properties > Network profile type: Private. Then check again.",
"openSettings": "Open network settings",
"firewallMissing": "The Windows firewall doesn't let DM Loremind through yet: the tablet would load forever.",
"firewallBlocked": "The Windows firewall blocks DM Loremind (a permission was probably declined).",
"allowFirewall": "Allow through the firewall",
"fixing": "Confirm in the Windows prompt…",
"uacNote": "Windows will ask for administrator confirmation. DM Loremind will be allowed on private networks only.",
"recheck": "Check again",
"checking": "Checking…",
"fix": {
"APPLIED": "Done: DM Loremind is allowed through the firewall.",
"CANCELLED": "Confirmation cancelled: nothing was changed.",
"FAILED": "The permission failed. You can try again, or add it manually (see the documentation).",
"UNSUPPORTED": "This check is only available on Windows."
},
"windowsReady": "The Windows firewall and the network type let the tablet through.",
"thirdParty": "{{names}} also filters connections on this PC, with its own rules that DM Loremind can't check. Until it allows it, the tablet will load forever.",
"thirdPartyHowTo": "In that software's firewall settings: classify your Wi-Fi as a home network (not public, stealth mode off), then add a rule allowing incoming connections for DM Loremind.",
"docLink": "See how to fix it",
"docUrl": "https://loremind-docs.igmlcreation.fr/en/docs/configuration/acces-tablette#the-tablet-loads-forever",
"linuxNone": "No ufw or firewalld firewall is active on this machine: nothing to open.",
"linuxOpen": "The firewall ({{fw}}) lets port {{port}} through.",
"linuxClosed": "The firewall ({{fw}}) blocks port {{port}}: other devices would load forever. Open it with this command on the machine:",
"linuxUnknown": "The {{fw}} firewall is active. DM Loremind can't read its rules without administrator rights: if you haven't already, open port {{port}} with this command on the machine:",
"copy": "Copy",
"copied": "Copied"
} }
}, },
"mobileShell": { "mobileShell": {
@@ -2489,5 +2520,9 @@
"chooseSystem": "Choose the campaign's system", "chooseSystem": "Choose the campaign's system",
"noRules": "The \"{{name}}\" system has no rules yet.", "noRules": "The \"{{name}}\" system has no rules yet.",
"addRules": "Add rules to the system" "addRules": "Add rules to the system"
},
"treeDrill": {
"open": "Open page",
"empty": "Nothing here yet."
} }
} }
+36 -1
View File
@@ -2393,7 +2393,7 @@
"title": "Accès depuis une tablette", "title": "Accès depuis une tablette",
"hint": "Consulte et modifie tes campagnes depuis une tablette ou un téléphone connecté au même Wi-Fi que ce PC. Chaque appareil doit être autorisé une fois, avec un code affiché ici.", "hint": "Consulte et modifie tes campagnes depuis une tablette ou un téléphone connecté au même Wi-Fi que ce PC. Chaque appareil doit être autorisé une fois, avec un code affiché ici.",
"enable": "Autoriser l'accès depuis le réseau local", "enable": "Autoriser l'accès depuis le réseau local",
"firewallNote": "À l'activation, Windows peut demander d'autoriser DM Loremind dans le pare-feu : choisis « Réseaux privés » uniquement. À n'activer que sur un réseau de confiance (ta box), jamais sur un Wi-Fi public.", "firewallNote": "Une fois l'accès activé, DM Loremind vérifie que le pare-feu Windows et le type de ton réseau laissent passer la tablette, et t'aide à corriger si besoin. À n'activer que sur ton réseau de maison, jamais sur un Wi-Fi public.",
"addressTitle": "Adresse à ouvrir sur la tablette", "addressTitle": "Adresse à ouvrir sur la tablette",
"noAddress": "Aucune adresse réseau locale détectée : vérifie que ce PC est bien connecté au Wi-Fi ou au réseau de ta box.", "noAddress": "Aucune adresse réseau locale détectée : vérifie que ce PC est bien connecté au Wi-Fi ou au réseau de ta box.",
"pairTitle": "Connecter un appareil", "pairTitle": "Connecter un appareil",
@@ -2434,6 +2434,37 @@
"onHostTitle": "Tu es sur le PC", "onHostTitle": "Tu es sur le PC",
"onHostText": "Cette page sert à connecter une tablette. Sur ce PC, l'accès se règle depuis les Paramètres.", "onHostText": "Cette page sert à connecter une tablette. Sur ce PC, l'accès se règle depuis les Paramètres.",
"onHostLink": "Ouvrir les réglages d'accès" "onHostLink": "Ouvrir les réglages d'accès"
},
"network": {
"title": "Vérification du réseau",
"ready": "Le pare-feu et le réseau laissent passer la tablette.",
"publicProblem": "Windows considère ton réseau « {{names}} » comme un réseau public : il bloque les autres appareils, même avec l'autorisation du pare-feu.",
"publicHowTo": "S'il s'agit de ton réseau de maison, passe-le en « Privé » : réglages réseau de Windows > ton Wi-Fi > Propriétés > Type de profil réseau : Privé. Puis vérifie à nouveau.",
"openSettings": "Ouvrir les réglages réseau",
"firewallMissing": "Le pare-feu Windows ne laisse pas encore passer DM Loremind : la tablette chargerait sans fin.",
"firewallBlocked": "Le pare-feu Windows bloque DM Loremind (une autorisation a sans doute été refusée).",
"allowFirewall": "Autoriser dans le pare-feu",
"fixing": "Confirme dans la fenêtre de Windows…",
"uacNote": "Windows te demandera une confirmation administrateur. DM Loremind sera autorisé sur les réseaux privés uniquement.",
"recheck": "Vérifier à nouveau",
"checking": "Vérification…",
"fix": {
"APPLIED": "C'est fait : DM Loremind est autorisé dans le pare-feu.",
"CANCELLED": "Confirmation annulée : rien n'a été modifié.",
"FAILED": "L'autorisation a échoué. Tu peux réessayer, ou l'ajouter à la main (voir la documentation).",
"UNSUPPORTED": "Cette vérification n'est disponible que sur Windows."
},
"windowsReady": "Le pare-feu Windows et le type de réseau laissent passer la tablette.",
"thirdParty": "{{names}} filtre aussi les connexions sur ce PC, avec ses propres règles que DM Loremind ne peut pas vérifier. Tant qu'il ne l'autorise pas, la tablette chargera sans fin.",
"thirdPartyHowTo": "Dans les réglages du pare-feu de ce logiciel : classe ton Wi-Fi en réseau domestique (pas public, sans mode furtif), puis ajoute une règle qui autorise DM Loremind en connexions entrantes.",
"docLink": "Voir la marche à suivre",
"docUrl": "https://loremind-docs.igmlcreation.fr/docs/configuration/acces-tablette#la-tablette-charge-sans-fin",
"linuxNone": "Aucun pare-feu ufw ou firewalld n'est actif sur cette machine : rien à ouvrir.",
"linuxOpen": "Le pare-feu ({{fw}}) laisse passer le port {{port}}.",
"linuxClosed": "Le pare-feu ({{fw}}) bloque le port {{port}} : les autres appareils chargeraient sans fin. Ouvre-le avec cette commande sur la machine :",
"linuxUnknown": "Le pare-feu {{fw}} est actif. DM Loremind ne peut pas lire ses règles sans droits administrateur : si ce n'est pas déjà fait, ouvre le port {{port}} avec cette commande sur la machine :",
"copy": "Copier",
"copied": "Copié"
} }
}, },
"mobileShell": { "mobileShell": {
@@ -2489,5 +2520,9 @@
"chooseSystem": "Choisir le système de la campagne", "chooseSystem": "Choisir le système de la campagne",
"noRules": "Le système « {{name}} » n'a pas encore de règles.", "noRules": "Le système « {{name}} » n'a pas encore de règles.",
"addRules": "Ajouter des règles au système" "addRules": "Ajouter des règles au système"
},
"treeDrill": {
"open": "Ouvrir la fiche",
"empty": "Rien ici pour le moment."
} }
} }
@@ -4,7 +4,7 @@
"title": "Access from a tablet", "title": "Access from a tablet",
"hint": "Browse and edit your campaigns from a tablet or phone on the same Wi-Fi as this PC. Each device must be authorized once, with a code shown here.", "hint": "Browse and edit your campaigns from a tablet or phone on the same Wi-Fi as this PC. Each device must be authorized once, with a code shown here.",
"enable": "Allow access from the local network", "enable": "Allow access from the local network",
"firewallNote": "When you turn this on, Windows may ask to allow DM Loremind through the firewall: choose \"Private networks\" only. Only enable it on a trusted network (your home router), never on public Wi-Fi.", "firewallNote": "Once access is on, DM Loremind checks that the Windows firewall and your network type let the tablet through, and helps you fix it if needed. Only turn it on at home, never on public Wi-Fi.",
"addressTitle": "Address to open on the tablet", "addressTitle": "Address to open on the tablet",
"noAddress": "No local network address found: check that this PC is connected to your Wi-Fi or home router.", "noAddress": "No local network address found: check that this PC is connected to your Wi-Fi or home router.",
"pairTitle": "Connect a device", "pairTitle": "Connect a device",
@@ -45,6 +45,37 @@
"onHostTitle": "You're on the PC", "onHostTitle": "You're on the PC",
"onHostText": "This page is for connecting a tablet. On this PC, access is managed from Settings.", "onHostText": "This page is for connecting a tablet. On this PC, access is managed from Settings.",
"onHostLink": "Open access settings" "onHostLink": "Open access settings"
},
"network": {
"title": "Network check",
"ready": "The firewall and the network let the tablet through.",
"publicProblem": "Windows considers your network \"{{names}}\" public: it blocks other devices, even with the firewall permission.",
"publicHowTo": "If it's your home network, switch it to \"Private\": Windows network settings > your Wi-Fi > Properties > Network profile type: Private. Then check again.",
"openSettings": "Open network settings",
"firewallMissing": "The Windows firewall doesn't let DM Loremind through yet: the tablet would load forever.",
"firewallBlocked": "The Windows firewall blocks DM Loremind (a permission was probably declined).",
"allowFirewall": "Allow through the firewall",
"fixing": "Confirm in the Windows prompt…",
"uacNote": "Windows will ask for administrator confirmation. DM Loremind will be allowed on private networks only.",
"recheck": "Check again",
"checking": "Checking…",
"fix": {
"APPLIED": "Done: DM Loremind is allowed through the firewall.",
"CANCELLED": "Confirmation cancelled: nothing was changed.",
"FAILED": "The permission failed. You can try again, or add it manually (see the documentation).",
"UNSUPPORTED": "This check is only available on Windows."
},
"windowsReady": "The Windows firewall and the network type let the tablet through.",
"thirdParty": "{{names}} also filters connections on this PC, with its own rules that DM Loremind can't check. Until it allows it, the tablet will load forever.",
"thirdPartyHowTo": "In that software's firewall settings: classify your Wi-Fi as a home network (not public, stealth mode off), then add a rule allowing incoming connections for DM Loremind.",
"docLink": "See how to fix it",
"docUrl": "https://loremind-docs.igmlcreation.fr/en/docs/configuration/acces-tablette#the-tablet-loads-forever",
"linuxNone": "No ufw or firewalld firewall is active on this machine: nothing to open.",
"linuxOpen": "The firewall ({{fw}}) lets port {{port}} through.",
"linuxClosed": "The firewall ({{fw}}) blocks port {{port}}: other devices would load forever. Open it with this command on the machine:",
"linuxUnknown": "The {{fw}} firewall is active. DM Loremind can't read its rules without administrator rights: if you haven't already, open port {{port}} with this command on the machine:",
"copy": "Copy",
"copied": "Copied"
} }
} }
} }
@@ -4,7 +4,7 @@
"title": "Accès depuis une tablette", "title": "Accès depuis une tablette",
"hint": "Consulte et modifie tes campagnes depuis une tablette ou un téléphone connecté au même Wi-Fi que ce PC. Chaque appareil doit être autorisé une fois, avec un code affiché ici.", "hint": "Consulte et modifie tes campagnes depuis une tablette ou un téléphone connecté au même Wi-Fi que ce PC. Chaque appareil doit être autorisé une fois, avec un code affiché ici.",
"enable": "Autoriser l'accès depuis le réseau local", "enable": "Autoriser l'accès depuis le réseau local",
"firewallNote": "À l'activation, Windows peut demander d'autoriser DM Loremind dans le pare-feu : choisis « Réseaux privés » uniquement. À n'activer que sur un réseau de confiance (ta box), jamais sur un Wi-Fi public.", "firewallNote": "Une fois l'accès activé, DM Loremind vérifie que le pare-feu Windows et le type de ton réseau laissent passer la tablette, et t'aide à corriger si besoin. À n'activer que sur ton réseau de maison, jamais sur un Wi-Fi public.",
"addressTitle": "Adresse à ouvrir sur la tablette", "addressTitle": "Adresse à ouvrir sur la tablette",
"noAddress": "Aucune adresse réseau locale détectée : vérifie que ce PC est bien connecté au Wi-Fi ou au réseau de ta box.", "noAddress": "Aucune adresse réseau locale détectée : vérifie que ce PC est bien connecté au Wi-Fi ou au réseau de ta box.",
"pairTitle": "Connecter un appareil", "pairTitle": "Connecter un appareil",
@@ -45,6 +45,37 @@
"onHostTitle": "Tu es sur le PC", "onHostTitle": "Tu es sur le PC",
"onHostText": "Cette page sert à connecter une tablette. Sur ce PC, l'accès se règle depuis les Paramètres.", "onHostText": "Cette page sert à connecter une tablette. Sur ce PC, l'accès se règle depuis les Paramètres.",
"onHostLink": "Ouvrir les réglages d'accès" "onHostLink": "Ouvrir les réglages d'accès"
},
"network": {
"title": "Vérification du réseau",
"ready": "Le pare-feu et le réseau laissent passer la tablette.",
"publicProblem": "Windows considère ton réseau « {{names}} » comme un réseau public : il bloque les autres appareils, même avec l'autorisation du pare-feu.",
"publicHowTo": "S'il s'agit de ton réseau de maison, passe-le en « Privé » : réglages réseau de Windows > ton Wi-Fi > Propriétés > Type de profil réseau : Privé. Puis vérifie à nouveau.",
"openSettings": "Ouvrir les réglages réseau",
"firewallMissing": "Le pare-feu Windows ne laisse pas encore passer DM Loremind : la tablette chargerait sans fin.",
"firewallBlocked": "Le pare-feu Windows bloque DM Loremind (une autorisation a sans doute été refusée).",
"allowFirewall": "Autoriser dans le pare-feu",
"fixing": "Confirme dans la fenêtre de Windows…",
"uacNote": "Windows te demandera une confirmation administrateur. DM Loremind sera autorisé sur les réseaux privés uniquement.",
"recheck": "Vérifier à nouveau",
"checking": "Vérification…",
"fix": {
"APPLIED": "C'est fait : DM Loremind est autorisé dans le pare-feu.",
"CANCELLED": "Confirmation annulée : rien n'a été modifié.",
"FAILED": "L'autorisation a échoué. Tu peux réessayer, ou l'ajouter à la main (voir la documentation).",
"UNSUPPORTED": "Cette vérification n'est disponible que sur Windows."
},
"windowsReady": "Le pare-feu Windows et le type de réseau laissent passer la tablette.",
"thirdParty": "{{names}} filtre aussi les connexions sur ce PC, avec ses propres règles que DM Loremind ne peut pas vérifier. Tant qu'il ne l'autorise pas, la tablette chargera sans fin.",
"thirdPartyHowTo": "Dans les réglages du pare-feu de ce logiciel : classe ton Wi-Fi en réseau domestique (pas public, sans mode furtif), puis ajoute une règle qui autorise DM Loremind en connexions entrantes.",
"docLink": "Voir la marche à suivre",
"docUrl": "https://loremind-docs.igmlcreation.fr/docs/configuration/acces-tablette#la-tablette-charge-sans-fin",
"linuxNone": "Aucun pare-feu ufw ou firewalld n'est actif sur cette machine : rien à ouvrir.",
"linuxOpen": "Le pare-feu ({{fw}}) laisse passer le port {{port}}.",
"linuxClosed": "Le pare-feu ({{fw}}) bloque le port {{port}} : les autres appareils chargeraient sans fin. Ouvre-le avec cette commande sur la machine :",
"linuxUnknown": "Le pare-feu {{fw}} est actif. DM Loremind ne peut pas lire ses règles sans droits administrateur : si ce n'est pas déjà fait, ouvre le port {{port}} avec cette commande sur la machine :",
"copy": "Copier",
"copied": "Copié"
} }
} }
} }
@@ -0,0 +1,6 @@
{
"treeDrill": {
"open": "Open page",
"empty": "Nothing here yet."
}
}
@@ -0,0 +1,6 @@
{
"treeDrill": {
"open": "Ouvrir la fiche",
"empty": "Rien ici pour le moment."
}
}