Appli de bureau : accès depuis une tablette sur le réseau local (appairage par code, migration V25)
- Activation dans Paramètres > « Accès depuis une tablette » (raccourci tray « Connecter une tablette… ») : un second connecteur Tomcat s'ouvre à chaud sur le réseau local (port 8765 par défaut, modifiable) ; le connecteur habituel reste sur 127.0.0.1, rien ne change pour qui n'active rien. - Appairage : QR code + code à 6 chiffres (5 min, usage unique, 5 essais, 20 échecs/min au total) échangé contre un jeton d'appareil posé en cookie HttpOnly + SameSite=Strict ; seule son empreinte SHA-256 est stockée (tables remote_access_config et remote_devices, migration V25). - RemoteAccessFilter (avant le HTTP Basic) : depuis le réseau, API réservée aux appareils appairés (sinon 401 → écran /pair côté front) ; Paramètres, données, mises à jour et licence toujours refusés (403), même appairé. - Front : section Paramètres (adresse, QR code, compte à rebours, appareils autorisés avec « Retirer l'accès »), écran d'appairage plein écran, intercepteur de redirection ; dépendance qrcode. - Mode bureau uniquement (profil local) : Docker inchangé. Vérifié : core clean verify (1205 tests, dont un test d'intégration sur un vrai Tomcat : ouverture/fermeture du port, filtre, appairage + cookie), migration V25 sur H2, web build + 303 vitest, lint sans erreur, parcours PC et tablette testés en mode bureau isolé ; doc à jour (accès tablette + Tailscale). À redéployer : core (migration V25) + web.
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
package com.loremind.application.remoteaccess;
|
||||||
|
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteDevice;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/** Vue publique d'un appareil appairé (jamais l'empreinte du jeton). */
|
||||||
|
public record PairedDevice(String id, String name, String userAgent, Instant createdAt, Instant lastSeenAt) {
|
||||||
|
|
||||||
|
static PairedDevice of(RemoteDevice d) {
|
||||||
|
return new PairedDevice(d.getId(), d.getName(), d.getUserAgent(), d.getCreatedAt(), d.getLastSeenAt());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.loremind.application.remoteaccess;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/** Code d'appairage à 6 chiffres affiché sur le PC (usage unique). */
|
||||||
|
public record PairingCode(String code, Instant expiresAt) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.loremind.application.remoteaccess;
|
||||||
|
|
||||||
|
/** Appairage refusé : code absent, faux, expiré, ou trop d'essais. Message prêt à afficher. */
|
||||||
|
public class PairingRejectedException extends RuntimeException {
|
||||||
|
|
||||||
|
public PairingRejectedException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.loremind.application.remoteaccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Résultat d'un appairage réussi.
|
||||||
|
*
|
||||||
|
* @param token jeton d'appareil en clair : à poser en cookie, jamais renvoyé dans le corps
|
||||||
|
* @param device l'appareil enregistré
|
||||||
|
*/
|
||||||
|
public record PairingResult(String token, PairedDevice device) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
package com.loremind.application.remoteaccess;
|
||||||
|
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteAccessConfig;
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteDevice;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.LanConnector;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.RemoteAccessConfigRepository;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.RemoteDeviceRepository;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.time.Clock;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.HexFormat;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accès distant à l'application de bureau (tablette / téléphone sur le réseau local).
|
||||||
|
* <p>
|
||||||
|
* Modèle de confiance : le connecteur habituel reste limité à la machine (127.0.0.1) et
|
||||||
|
* n'exige rien, comme avant. Quand le MJ active l'accès distant, un SECOND connecteur
|
||||||
|
* s'ouvre sur le réseau local ; tout ce qui y arrive doit présenter un jeton d'appareil,
|
||||||
|
* obtenu en saisissant un code à 6 chiffres affiché sur le PC (usage unique, 5 minutes,
|
||||||
|
* 5 essais). Les Paramètres restent réservés à la machine (filtre {@code RemoteAccessFilter}).
|
||||||
|
* <p>
|
||||||
|
* Uniquement en mode bureau (profil {@code local}) : en Docker, rien de tout ceci n'existe.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Profile("local")
|
||||||
|
public class RemoteAccessService {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RemoteAccessService.class);
|
||||||
|
|
||||||
|
static final Duration CODE_TTL = Duration.ofMinutes(5);
|
||||||
|
static final int CODE_MAX_ATTEMPTS = 5;
|
||||||
|
/** Garde-fou anti force brute tous codes confondus : au-delà, plus aucun essai pendant 1 min. */
|
||||||
|
static final int GLOBAL_MAX_FAILURES_PER_MINUTE = 20;
|
||||||
|
/** On ne réécrit « vu pour la dernière fois » qu'au plus une fois par minute et par appareil. */
|
||||||
|
static final Duration TOUCH_INTERVAL = Duration.ofMinutes(1);
|
||||||
|
static final int DEVICE_NAME_MAX = 100;
|
||||||
|
static final int USER_AGENT_MAX = 300;
|
||||||
|
|
||||||
|
private final RemoteAccessConfigRepository configRepository;
|
||||||
|
private final RemoteDeviceRepository deviceRepository;
|
||||||
|
private final LanConnector lanConnector;
|
||||||
|
private final int localPort;
|
||||||
|
private final Clock clock;
|
||||||
|
private final SecureRandom random = new SecureRandom();
|
||||||
|
|
||||||
|
private PairingCode currentCode;
|
||||||
|
private int attemptsLeft;
|
||||||
|
private final Deque<Instant> recentFailures = new ArrayDeque<>();
|
||||||
|
private String lastError;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RemoteAccessService(RemoteAccessConfigRepository configRepository,
|
||||||
|
RemoteDeviceRepository deviceRepository,
|
||||||
|
LanConnector lanConnector,
|
||||||
|
@Value("${server.port:8080}") int localPort) {
|
||||||
|
this(configRepository, deviceRepository, lanConnector, localPort, Clock.systemUTC());
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoteAccessService(RemoteAccessConfigRepository configRepository,
|
||||||
|
RemoteDeviceRepository deviceRepository,
|
||||||
|
LanConnector lanConnector,
|
||||||
|
int localPort,
|
||||||
|
Clock clock) {
|
||||||
|
this.configRepository = configRepository;
|
||||||
|
this.deviceRepository = deviceRepository;
|
||||||
|
this.lanConnector = lanConnector;
|
||||||
|
this.localPort = localPort;
|
||||||
|
this.clock = clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Réglage -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Au démarrage : rouvre le connecteur si l'accès distant était activé. Ne bloque jamais le lancement. */
|
||||||
|
public synchronized void applySavedConfig() {
|
||||||
|
RemoteAccessConfig config = currentConfig();
|
||||||
|
if (!config.enabled()) return;
|
||||||
|
try {
|
||||||
|
lanConnector.start(config.port());
|
||||||
|
lastError = null;
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
lastError = e.getMessage();
|
||||||
|
log.warn("Accès distant activé mais connecteur impossible à ouvrir : {}", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active ou désactive l'accès distant. À l'activation, le connecteur est ouvert AVANT
|
||||||
|
* d'enregistrer le réglage : un port occupé laisse l'accès désactivé.
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException port hors plage ou identique au port local
|
||||||
|
* @throws IllegalStateException port déjà occupé
|
||||||
|
*/
|
||||||
|
public synchronized RemoteAccessStatus configure(boolean enabled, int port) {
|
||||||
|
if (port < 1024 || port > 65535) {
|
||||||
|
throw new IllegalArgumentException("Le port doit être compris entre 1024 et 65535.");
|
||||||
|
}
|
||||||
|
if (port == localPort) {
|
||||||
|
throw new IllegalArgumentException("Choisissez un port différent de celui de l'application (" + localPort + ").");
|
||||||
|
}
|
||||||
|
if (enabled) {
|
||||||
|
lanConnector.start(port);
|
||||||
|
} else {
|
||||||
|
lanConnector.stop();
|
||||||
|
currentCode = null;
|
||||||
|
}
|
||||||
|
lastError = null;
|
||||||
|
configRepository.save(new RemoteAccessConfig(enabled, port));
|
||||||
|
return status();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized RemoteAccessStatus status() {
|
||||||
|
RemoteAccessConfig config = currentConfig();
|
||||||
|
int running = lanConnector.runningPort();
|
||||||
|
List<String> urls = running > 0
|
||||||
|
? lanConnector.lanAddresses().stream().map(ip -> "http://" + ip + ":" + running).toList()
|
||||||
|
: List.of();
|
||||||
|
List<PairedDevice> devices = deviceRepository.findAll().stream()
|
||||||
|
.sorted(Comparator.comparing(RemoteDevice::getCreatedAt, Comparator.nullsLast(Comparator.naturalOrder())))
|
||||||
|
.map(PairedDevice::of)
|
||||||
|
.toList();
|
||||||
|
return new RemoteAccessStatus(config.enabled(), config.port(), running > 0, urls, lastError, devices);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RemoteAccessConfig currentConfig() {
|
||||||
|
return configRepository.find().orElseGet(RemoteAccessConfig::disabledByDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Appairage -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nouveau code d'appairage (remplace le précédent).
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException si l'accès distant n'est pas ouvert
|
||||||
|
*/
|
||||||
|
public synchronized PairingCode newPairingCode() {
|
||||||
|
if (lanConnector.runningPort() <= 0) {
|
||||||
|
throw new IllegalStateException("Activez d'abord l'accès depuis le réseau local.");
|
||||||
|
}
|
||||||
|
String code = String.format("%06d", random.nextInt(1_000_000));
|
||||||
|
currentCode = new PairingCode(code, clock.instant().plus(CODE_TTL));
|
||||||
|
attemptsLeft = CODE_MAX_ATTEMPTS;
|
||||||
|
return currentCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Échange un code valide contre un jeton d'appareil (à poser en cookie). Le code est
|
||||||
|
* consommé : un second appareil demande un nouveau code.
|
||||||
|
*
|
||||||
|
* @throws PairingRejectedException code absent, faux, expiré ou trop d'essais
|
||||||
|
*/
|
||||||
|
public synchronized PairingResult pair(String code, String deviceName, String userAgent) {
|
||||||
|
Instant now = clock.instant();
|
||||||
|
pruneFailures(now);
|
||||||
|
if (recentFailures.size() >= GLOBAL_MAX_FAILURES_PER_MINUTE) {
|
||||||
|
throw new PairingRejectedException("Trop d'essais. Patientez une minute.");
|
||||||
|
}
|
||||||
|
if (currentCode == null || now.isAfter(currentCode.expiresAt())) {
|
||||||
|
currentCode = null;
|
||||||
|
recordFailure(now);
|
||||||
|
throw new PairingRejectedException("Aucun code valide : affichez un nouveau code sur le PC.");
|
||||||
|
}
|
||||||
|
if (code == null || !constantTimeEquals(code.trim(), currentCode.code())) {
|
||||||
|
recordFailure(now);
|
||||||
|
if (--attemptsLeft <= 0) {
|
||||||
|
currentCode = null;
|
||||||
|
throw new PairingRejectedException("Trop d'essais : affichez un nouveau code sur le PC.");
|
||||||
|
}
|
||||||
|
throw new PairingRejectedException("Code incorrect.");
|
||||||
|
}
|
||||||
|
currentCode = null;
|
||||||
|
|
||||||
|
String token = newToken();
|
||||||
|
RemoteDevice device = deviceRepository.save(RemoteDevice.builder()
|
||||||
|
.name(clean(deviceName, DEVICE_NAME_MAX, "Appareil"))
|
||||||
|
.tokenHash(sha256(token))
|
||||||
|
.userAgent(clean(userAgent, USER_AGENT_MAX, null))
|
||||||
|
.createdAt(now)
|
||||||
|
.lastSeenAt(now)
|
||||||
|
.build());
|
||||||
|
log.info("Accès distant : appareil appairé « {} »", device.getName());
|
||||||
|
return new PairingResult(token, PairedDevice.of(device));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Appareil correspondant au jeton présenté, s'il est connu (sinon : appairage requis). */
|
||||||
|
public Optional<RemoteDevice> authenticate(String token) {
|
||||||
|
if (token == null || token.isBlank()) return Optional.empty();
|
||||||
|
Optional<RemoteDevice> device = deviceRepository.findByTokenHash(sha256(token));
|
||||||
|
device.ifPresent(d -> {
|
||||||
|
Instant now = clock.instant();
|
||||||
|
if (d.getLastSeenAt() == null || d.getLastSeenAt().plus(TOUCH_INTERVAL).isBefore(now)) {
|
||||||
|
deviceRepository.touch(d.getId(), now);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Coupe l'accès d'un appareil. */
|
||||||
|
public boolean revoke(String deviceId) {
|
||||||
|
return deviceRepository.deleteById(deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Port du connecteur réseau ouvert, ou -1 (pour le filtre : qui vient « de l'extérieur » ?). */
|
||||||
|
public int lanPort() {
|
||||||
|
return lanConnector.runningPort();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Outils -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
private void recordFailure(Instant now) {
|
||||||
|
recentFailures.addLast(now);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pruneFailures(Instant now) {
|
||||||
|
Instant limit = now.minus(Duration.ofMinutes(1));
|
||||||
|
while (!recentFailures.isEmpty() && recentFailures.peekFirst().isBefore(limit)) {
|
||||||
|
recentFailures.removeFirst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String newToken() {
|
||||||
|
byte[] bytes = new byte[32];
|
||||||
|
random.nextBytes(bytes);
|
||||||
|
return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
static String sha256(String value) {
|
||||||
|
try {
|
||||||
|
byte[] digest = MessageDigest.getInstance("SHA-256").digest(value.getBytes(StandardCharsets.UTF_8));
|
||||||
|
return HexFormat.of().formatHex(digest);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new IllegalStateException("SHA-256 indisponible", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean constantTimeEquals(String a, String b) {
|
||||||
|
return MessageDigest.isEqual(a.getBytes(StandardCharsets.UTF_8), b.getBytes(StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String clean(String value, int max, String fallback) {
|
||||||
|
if (value == null || value.isBlank()) return fallback;
|
||||||
|
String trimmed = value.strip();
|
||||||
|
return trimmed.length() > max ? trimmed.substring(0, max) : trimmed;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.loremind.application.remoteaccess;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* État de l'accès distant, pour l'écran Paramètres du PC.
|
||||||
|
*
|
||||||
|
* @param enabled accès activé (réglage enregistré)
|
||||||
|
* @param port port réseau dédié
|
||||||
|
* @param running connecteur réseau effectivement ouvert
|
||||||
|
* @param urls adresses à taper sur la tablette (une par interface réseau locale)
|
||||||
|
* @param lastError dernière erreur d'ouverture (ex. port occupé au démarrage), ou null
|
||||||
|
* @param devices appareils appairés
|
||||||
|
*/
|
||||||
|
public record RemoteAccessStatus(
|
||||||
|
boolean enabled,
|
||||||
|
int port,
|
||||||
|
boolean running,
|
||||||
|
List<String> urls,
|
||||||
|
String lastError,
|
||||||
|
List<PairedDevice> devices
|
||||||
|
) {
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.loremind.domain.remoteaccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Réglage de l'accès distant (singleton) : activé ou non, et port réseau ouvert
|
||||||
|
* sur le réseau local quand il l'est.
|
||||||
|
*
|
||||||
|
* @param enabled accès depuis le réseau local autorisé
|
||||||
|
* @param port port réseau dédié (distinct du port local de l'application)
|
||||||
|
*/
|
||||||
|
public record RemoteAccessConfig(boolean enabled, int port) {
|
||||||
|
|
||||||
|
/** Port proposé par défaut : libre en pratique, et distinct du 8080 local. */
|
||||||
|
public static final int DEFAULT_PORT = 8765;
|
||||||
|
|
||||||
|
public static RemoteAccessConfig disabledByDefault() {
|
||||||
|
return new RemoteAccessConfig(false, DEFAULT_PORT);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.loremind.domain.remoteaccess;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appareil (tablette, téléphone) autorisé à accéder à l'application de bureau depuis
|
||||||
|
* le réseau local, après appairage par code.
|
||||||
|
* <p>
|
||||||
|
* <b>Sécurité :</b> seule l'empreinte SHA-256 du jeton est conservée ; le jeton en
|
||||||
|
* clair n'existe que dans le cookie de l'appareil. Révoquer = supprimer la ligne.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class RemoteDevice {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** Nom choisi à l'appairage (« Tablette de Léa »), pour s'y retrouver dans la liste. */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** Empreinte SHA-256 (hex) du jeton d'appareil. */
|
||||||
|
private String tokenHash;
|
||||||
|
|
||||||
|
private String userAgent;
|
||||||
|
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
private Instant lastSeenAt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.loremind.domain.remoteaccess.ports;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Port vers le « second guichet » réseau de l'application de bureau : un connecteur
|
||||||
|
* HTTP ouvert sur le réseau local (toutes interfaces) à côté du connecteur habituel,
|
||||||
|
* qui reste limité à la machine (127.0.0.1).
|
||||||
|
* <p>
|
||||||
|
* Tout ce qui arrive par ce connecteur vient d'un autre appareil (ou de la machine
|
||||||
|
* elle-même via son adresse réseau) et doit présenter un jeton d'appareil.
|
||||||
|
*/
|
||||||
|
public interface LanConnector {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ouvre le connecteur sur ce port (le referme d'abord s'il tournait sur un autre).
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException si le port est déjà occupé ou ne peut pas être ouvert
|
||||||
|
*/
|
||||||
|
void start(int port);
|
||||||
|
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
/** Port du connecteur ouvert, ou -1 s'il est fermé. */
|
||||||
|
int runningPort();
|
||||||
|
|
||||||
|
/** Adresses IPv4 de la machine sur le réseau local (pour composer l'URL à taper). */
|
||||||
|
List<String> lanAddresses();
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package com.loremind.domain.remoteaccess.ports;
|
||||||
|
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteAccessConfig;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/** Port de persistance du réglage d'accès distant (singleton). */
|
||||||
|
public interface RemoteAccessConfigRepository {
|
||||||
|
|
||||||
|
Optional<RemoteAccessConfig> find();
|
||||||
|
|
||||||
|
RemoteAccessConfig save(RemoteAccessConfig config);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.loremind.domain.remoteaccess.ports;
|
||||||
|
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteDevice;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/** Port de persistance des appareils appairés. */
|
||||||
|
public interface RemoteDeviceRepository {
|
||||||
|
|
||||||
|
RemoteDevice save(RemoteDevice device);
|
||||||
|
|
||||||
|
Optional<RemoteDevice> findByTokenHash(String tokenHash);
|
||||||
|
|
||||||
|
List<RemoteDevice> findAll();
|
||||||
|
|
||||||
|
void touch(String id, Instant lastSeenAt);
|
||||||
|
|
||||||
|
boolean deleteById(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.loremind.infrastructure.desktop;
|
||||||
|
|
||||||
|
import com.loremind.application.remoteaccess.RemoteAccessService;
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/** Mode bureau : rouvre l'accès distant au démarrage s'il avait été activé. */
|
||||||
|
@Component
|
||||||
|
@Profile("local")
|
||||||
|
public class RemoteAccessBootstrap {
|
||||||
|
|
||||||
|
private final RemoteAccessService remoteAccessService;
|
||||||
|
|
||||||
|
public RemoteAccessBootstrap(RemoteAccessService remoteAccessService) {
|
||||||
|
this.remoteAccessService = remoteAccessService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
|
public void reopenIfEnabled() {
|
||||||
|
remoteAccessService.applySavedConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,6 +70,13 @@ public class SystemTrayManager {
|
|||||||
open.addActionListener(e -> DesktopSingleInstance.openAppInBrowser());
|
open.addActionListener(e -> DesktopSingleInstance.openAppInBrowser());
|
||||||
popup.add(open);
|
popup.add(open);
|
||||||
|
|
||||||
|
// Acces distant : ouvre la section Parametres ou l'on active l'acces
|
||||||
|
// depuis une tablette et ou l'on affiche le code d'appairage.
|
||||||
|
MenuItem remote = new MenuItem("Connecter une tablette…");
|
||||||
|
remote.addActionListener(e -> DesktopSingleInstance.openUrl(
|
||||||
|
"http://localhost:" + DesktopUserConfig.runningPort() + "/settings?section=remote-access"));
|
||||||
|
popup.add(remote);
|
||||||
|
|
||||||
popup.addSeparator();
|
popup.addSeparator();
|
||||||
|
|
||||||
// Reglages : ouvre loremind.properties (port, identifiants admin) dans
|
// Reglages : ouvre loremind.properties (port, identifiants admin) dans
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.loremind.infrastructure.desktop;
|
||||||
|
|
||||||
|
import com.loremind.domain.remoteaccess.ports.LanConnector;
|
||||||
|
import org.apache.catalina.connector.Connector;
|
||||||
|
import org.apache.catalina.startup.Tomcat;
|
||||||
|
import org.apache.coyote.http11.AbstractHttp11Protocol;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.web.embedded.tomcat.TomcatWebServer;
|
||||||
|
import org.springframework.boot.web.server.WebServer;
|
||||||
|
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.Inet4Address;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
|
import java.net.ServerSocket;
|
||||||
|
import java.net.SocketException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Second connecteur HTTP de Tomcat, ouvert À CHAUD sur toutes les interfaces quand le MJ
|
||||||
|
* active l'accès distant (mode bureau uniquement).
|
||||||
|
* <p>
|
||||||
|
* Pourquoi un second connecteur plutôt que d'ouvrir le principal : le connecteur habituel
|
||||||
|
* reste sur 127.0.0.1 (aucun changement de comportement, pas d'alerte du pare-feu Windows
|
||||||
|
* chez qui n'active rien), et le port d'arrivée suffit à distinguer une requête locale d'une
|
||||||
|
* requête venue du réseau (cf. {@code RemoteAccessFilter}). Ouverture et fermeture sans
|
||||||
|
* redémarrer l'application.
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Profile("local")
|
||||||
|
public class TomcatLanConnector implements LanConnector {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(TomcatLanConnector.class);
|
||||||
|
|
||||||
|
/** Interfaces à ignorer pour composer l'URL : réseaux virtuels (VM, WSL, Docker, VPN…). */
|
||||||
|
private static final List<String> VIRTUAL_HINTS = List.of(
|
||||||
|
"virtual", "vmware", "vbox", "hyper-v", "vethernet", "docker", "wsl", "loopback", "tap-", "tun");
|
||||||
|
|
||||||
|
private final ApplicationContext context;
|
||||||
|
private Connector connector;
|
||||||
|
|
||||||
|
public TomcatLanConnector(ApplicationContext context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void start(int port) {
|
||||||
|
if (connector != null && connector.getPort() == port) return;
|
||||||
|
stop();
|
||||||
|
ensurePortFree(port);
|
||||||
|
|
||||||
|
Tomcat tomcat = tomcat();
|
||||||
|
Connector main = tomcat.getConnector();
|
||||||
|
Connector lan = new Connector(main.getProtocolHandlerClassName());
|
||||||
|
lan.setPort(port);
|
||||||
|
lan.setProperty("address", "0.0.0.0");
|
||||||
|
// Mêmes limites d'upload que le connecteur principal (imports PDF volumineux).
|
||||||
|
lan.setMaxPostSize(main.getMaxPostSize());
|
||||||
|
if (main.getProtocolHandler() instanceof AbstractHttp11Protocol<?> mainProtocol
|
||||||
|
&& lan.getProtocolHandler() instanceof AbstractHttp11Protocol<?> lanProtocol) {
|
||||||
|
lanProtocol.setMaxSwallowSize(mainProtocol.getMaxSwallowSize());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
tomcat.getService().addConnector(lan); // démarre le connecteur : le service tourne déjà
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new IllegalStateException("Impossible d'ouvrir le port " + port + " : " + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
connector = lan;
|
||||||
|
log.info("Accès distant : connecteur réseau ouvert sur le port {}", port);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void stop() {
|
||||||
|
if (connector == null) return;
|
||||||
|
try {
|
||||||
|
tomcat().getService().removeConnector(connector);
|
||||||
|
connector.destroy();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Fermeture du connecteur réseau incomplète : {}", e.getMessage());
|
||||||
|
}
|
||||||
|
log.info("Accès distant : connecteur réseau fermé (port {})", connector.getPort());
|
||||||
|
connector = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized int runningPort() {
|
||||||
|
return connector != null ? connector.getPort() : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> lanAddresses() {
|
||||||
|
try {
|
||||||
|
return Collections.list(NetworkInterface.getNetworkInterfaces()).stream()
|
||||||
|
.filter(TomcatLanConnector::isPhysicalAndUp)
|
||||||
|
.flatMap(nic -> Collections.list(nic.getInetAddresses()).stream())
|
||||||
|
.filter(a -> a instanceof Inet4Address && a.isSiteLocalAddress())
|
||||||
|
.map(a -> a.getHostAddress())
|
||||||
|
.distinct()
|
||||||
|
// Box domestique d'abord (192.168.x), puis 10.x / 172.16-31.x.
|
||||||
|
.sorted(Comparator.comparing((String ip) -> !ip.startsWith("192.168.")).thenComparing(ip -> ip))
|
||||||
|
.toList();
|
||||||
|
} catch (SocketException e) {
|
||||||
|
log.warn("Lecture des interfaces réseau impossible : {}", e.getMessage());
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isPhysicalAndUp(NetworkInterface nic) {
|
||||||
|
try {
|
||||||
|
if (!nic.isUp() || nic.isLoopback() || nic.isVirtual() || nic.isPointToPoint()) return false;
|
||||||
|
} catch (SocketException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String label = (nic.getName() + " " + nic.getDisplayName()).toLowerCase(Locale.ROOT);
|
||||||
|
return VIRTUAL_HINTS.stream().noneMatch(label::contains);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Vérification préalable pour un message clair (sinon Tomcat ne log qu'une trace obscure). */
|
||||||
|
private static void ensurePortFree(int port) {
|
||||||
|
try (ServerSocket probe = new ServerSocket()) {
|
||||||
|
probe.setReuseAddress(false);
|
||||||
|
probe.bind(new InetSocketAddress(port));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalStateException("Le port " + port + " est déjà utilisé par une autre application.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tomcat tomcat() {
|
||||||
|
if (context instanceof ServletWebServerApplicationContext web) {
|
||||||
|
WebServer server = web.getWebServer();
|
||||||
|
if (server instanceof TomcatWebServer tomcatServer) {
|
||||||
|
return tomcatServer.getTomcat();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException("Serveur web embarqué indisponible.");
|
||||||
|
}
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package com.loremind.infrastructure.persistence.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entité JPA du réglage d'accès distant (migration V25). Singleton : une seule ligne,
|
||||||
|
* {@code id = "current"}, comme la licence.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "remote_access_config")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RemoteAccessConfigJpaEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private boolean enabled;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private int port;
|
||||||
|
|
||||||
|
@Column(name = "updated_at", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.loremind.infrastructure.persistence.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/** Entité JPA d'un appareil appairé pour l'accès distant (migration V25). */
|
||||||
|
@Entity
|
||||||
|
@Table(name = "remote_devices")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RemoteDeviceJpaEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(nullable = false, length = 100)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(name = "token_hash", nullable = false, length = 64, unique = true)
|
||||||
|
private String tokenHash;
|
||||||
|
|
||||||
|
@Column(name = "user_agent", length = 300)
|
||||||
|
private String userAgent;
|
||||||
|
|
||||||
|
@Column(name = "created_at", nullable = false, updatable = false)
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
@Column(name = "last_seen_at")
|
||||||
|
private Instant lastSeenAt;
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.loremind.infrastructure.persistence.jpa;
|
||||||
|
|
||||||
|
import com.loremind.infrastructure.persistence.entity.RemoteAccessConfigJpaEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface RemoteAccessConfigJpaRepository extends JpaRepository<RemoteAccessConfigJpaEntity, String> {
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package com.loremind.infrastructure.persistence.jpa;
|
||||||
|
|
||||||
|
import com.loremind.infrastructure.persistence.entity.RemoteDeviceJpaEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface RemoteDeviceJpaRepository extends JpaRepository<RemoteDeviceJpaEntity, Long> {
|
||||||
|
|
||||||
|
Optional<RemoteDeviceJpaEntity> findByTokenHash(String tokenHash);
|
||||||
|
|
||||||
|
/** Mise à jour ciblée (pas de relecture de l'entité à chaque requête d'une tablette). */
|
||||||
|
@Modifying
|
||||||
|
@Transactional
|
||||||
|
@Query("update RemoteDeviceJpaEntity d set d.lastSeenAt = :seenAt where d.id = :id")
|
||||||
|
void touch(@Param("id") Long id, @Param("seenAt") Instant seenAt);
|
||||||
|
}
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package com.loremind.infrastructure.persistence.postgres;
|
||||||
|
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteAccessConfig;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.RemoteAccessConfigRepository;
|
||||||
|
import com.loremind.infrastructure.persistence.entity.RemoteAccessConfigJpaEntity;
|
||||||
|
import com.loremind.infrastructure.persistence.jpa.RemoteAccessConfigJpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class PostgresRemoteAccessConfigRepository implements RemoteAccessConfigRepository {
|
||||||
|
|
||||||
|
static final String CURRENT_ID = "current";
|
||||||
|
|
||||||
|
private final RemoteAccessConfigJpaRepository jpa;
|
||||||
|
|
||||||
|
public PostgresRemoteAccessConfigRepository(RemoteAccessConfigJpaRepository jpa) {
|
||||||
|
this.jpa = jpa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<RemoteAccessConfig> find() {
|
||||||
|
return jpa.findById(CURRENT_ID).map(e -> new RemoteAccessConfig(e.isEnabled(), e.getPort()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteAccessConfig save(RemoteAccessConfig config) {
|
||||||
|
jpa.save(RemoteAccessConfigJpaEntity.builder()
|
||||||
|
.id(CURRENT_ID)
|
||||||
|
.enabled(config.enabled())
|
||||||
|
.port(config.port())
|
||||||
|
.updatedAt(Instant.now())
|
||||||
|
.build());
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
package com.loremind.infrastructure.persistence.postgres;
|
||||||
|
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteDevice;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.RemoteDeviceRepository;
|
||||||
|
import com.loremind.infrastructure.persistence.entity.RemoteDeviceJpaEntity;
|
||||||
|
import com.loremind.infrastructure.persistence.jpa.RemoteDeviceJpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class PostgresRemoteDeviceRepository implements RemoteDeviceRepository {
|
||||||
|
|
||||||
|
private final RemoteDeviceJpaRepository jpa;
|
||||||
|
|
||||||
|
public PostgresRemoteDeviceRepository(RemoteDeviceJpaRepository jpa) {
|
||||||
|
this.jpa = jpa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteDevice save(RemoteDevice device) {
|
||||||
|
RemoteDeviceJpaEntity entity = RemoteDeviceJpaEntity.builder()
|
||||||
|
.id(device.getId() != null ? Long.parseLong(device.getId()) : null)
|
||||||
|
.name(device.getName())
|
||||||
|
.tokenHash(device.getTokenHash())
|
||||||
|
.userAgent(device.getUserAgent())
|
||||||
|
.createdAt(device.getCreatedAt() != null ? device.getCreatedAt() : Instant.now())
|
||||||
|
.lastSeenAt(device.getLastSeenAt())
|
||||||
|
.build();
|
||||||
|
return toDomain(jpa.save(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<RemoteDevice> findByTokenHash(String tokenHash) {
|
||||||
|
return jpa.findByTokenHash(tokenHash).map(this::toDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RemoteDevice> findAll() {
|
||||||
|
return jpa.findAll().stream().map(this::toDomain).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void touch(String id, Instant lastSeenAt) {
|
||||||
|
jpa.touch(Long.parseLong(id), lastSeenAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteById(String id) {
|
||||||
|
Long key = Long.parseLong(id);
|
||||||
|
if (!jpa.existsById(key)) return false;
|
||||||
|
jpa.deleteById(key);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RemoteDevice toDomain(RemoteDeviceJpaEntity e) {
|
||||||
|
return RemoteDevice.builder()
|
||||||
|
.id(String.valueOf(e.getId()))
|
||||||
|
.name(e.getName())
|
||||||
|
.tokenHash(e.getTokenHash())
|
||||||
|
.userAgent(e.getUserAgent())
|
||||||
|
.createdAt(e.getCreatedAt())
|
||||||
|
.lastSeenAt(e.getLastSeenAt())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.loremind.infrastructure.web.config;
|
||||||
|
|
||||||
|
import com.loremind.application.remoteaccess.RemoteAccessService;
|
||||||
|
import jakarta.servlet.FilterChain;
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.http.Cookie;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Garde de l'accès distant (mode bureau). Ne concerne QUE les requêtes arrivées par le
|
||||||
|
* connecteur réseau local (port dédié) : celles du connecteur habituel (127.0.0.1) passent
|
||||||
|
* sans changement.
|
||||||
|
* <ul>
|
||||||
|
* <li>front statique (hors {@code /api/}) : libre — la tablette doit pouvoir afficher l'écran d'appairage ;</li>
|
||||||
|
* <li>{@code /api/config}, {@code /api/version}, appairage : libres ;</li>
|
||||||
|
* <li>administration (Paramètres, données, mises à jour, licence) : refusée, toujours, même appairé ;</li>
|
||||||
|
* <li>tout le reste de l'API : cookie d'appareil valide, sinon 401 {@code remote_pairing_required}.</li>
|
||||||
|
* </ul>
|
||||||
|
* Pas un {@code @Component} : instancié par {@link SecurityConfig} pour ne pas être enregistré
|
||||||
|
* deux fois (chaîne de sécurité + filtre servlet automatique).
|
||||||
|
*/
|
||||||
|
public class RemoteAccessFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
|
public static final String DEVICE_COOKIE = "lm_device";
|
||||||
|
|
||||||
|
private static final List<String> PUBLIC_PATHS = List.of(
|
||||||
|
"/api/config", "/api/version", "/api/remote-access/pair", "/api/remote-access/session");
|
||||||
|
private static final List<String> LOCAL_ONLY_PREFIXES = List.of(
|
||||||
|
"/api/settings", "/api/admin", "/api/license");
|
||||||
|
|
||||||
|
private final RemoteAccessService remoteAccessService;
|
||||||
|
|
||||||
|
public RemoteAccessFilter(RemoteAccessService remoteAccessService) {
|
||||||
|
this.remoteAccessService = remoteAccessService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||||
|
throws ServletException, IOException {
|
||||||
|
if (!isFromLan(request, remoteAccessService.lanPort())) {
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String path = request.getRequestURI();
|
||||||
|
if (!path.startsWith("/api/") || PUBLIC_PATHS.contains(path)) {
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (LOCAL_ONLY_PREFIXES.stream().anyMatch(path::startsWith)) {
|
||||||
|
reject(response, HttpServletResponse.SC_FORBIDDEN, "remote_forbidden");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (remoteAccessService.authenticate(deviceToken(request)).isPresent()) {
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject(response, HttpServletResponse.SC_UNAUTHORIZED, "remote_pairing_required");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Arrivée par le connecteur réseau local ? (le port d'arrivée suffit : l'autre connecteur est sur 127.0.0.1). */
|
||||||
|
public static boolean isFromLan(HttpServletRequest request, int lanPort) {
|
||||||
|
return lanPort > 0 && request.getLocalPort() == lanPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String deviceToken(HttpServletRequest request) {
|
||||||
|
Cookie[] cookies = request.getCookies();
|
||||||
|
if (cookies == null) return null;
|
||||||
|
for (Cookie cookie : cookies) {
|
||||||
|
if (DEVICE_COOKIE.equals(cookie.getName())) return cookie.getValue();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void reject(HttpServletResponse response, int status, String error) throws IOException {
|
||||||
|
response.setStatus(status);
|
||||||
|
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
response.getWriter().write("{\"error\":\"" + error + "\"}");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.loremind.infrastructure.web.config;
|
package com.loremind.infrastructure.web.config;
|
||||||
|
|
||||||
|
import com.loremind.application.remoteaccess.RemoteAccessService;
|
||||||
|
import org.springframework.beans.factory.ObjectProvider;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -14,6 +16,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
|
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration Spring Security.
|
* Configuration Spring Security.
|
||||||
@@ -24,6 +27,9 @@ import org.springframework.security.web.SecurityFilterChain;
|
|||||||
* l'UI elle-meme n'est pas authentifiee (trust model : reseau local ou
|
* l'UI elle-meme n'est pas authentifiee (trust model : reseau local ou
|
||||||
* reverse-proxy front amont).
|
* reverse-proxy front amont).
|
||||||
* <p>
|
* <p>
|
||||||
|
* Mode bureau : l'acces depuis une tablette passe par un connecteur reseau dedie,
|
||||||
|
* garde par {@link RemoteAccessFilter} (jeton d'appareil obtenu par code d'appairage).
|
||||||
|
* <p>
|
||||||
* Fail-closed : refuse de demarrer si admin.password n'est pas defini.
|
* Fail-closed : refuse de demarrer si admin.password n'est pas defini.
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@@ -58,7 +64,15 @@ public class SecurityConfig {
|
|||||||
// S4502 : API stateless en HTTP Basic sans cookie — CSRF sans objet (voir javadoc de classe).
|
// S4502 : API stateless en HTTP Basic sans cookie — CSRF sans objet (voir javadoc de classe).
|
||||||
@SuppressWarnings("java:S4502")
|
@SuppressWarnings("java:S4502")
|
||||||
@Bean
|
@Bean
|
||||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
public SecurityFilterChain filterChain(HttpSecurity http,
|
||||||
|
ObjectProvider<RemoteAccessService> remoteAccess) throws Exception {
|
||||||
|
// Mode bureau : garde de l'accès distant (tablette sur le réseau local), placée AVANT
|
||||||
|
// le HTTP Basic pour qu'un appareil du réseau ne puisse même pas tenter le mot de
|
||||||
|
// passe admin. Absente en Docker (le service n'existe que sous le profil local).
|
||||||
|
RemoteAccessService remoteAccessService = remoteAccess.getIfAvailable();
|
||||||
|
if (remoteAccessService != null) {
|
||||||
|
http.addFilterBefore(new RemoteAccessFilter(remoteAccessService), BasicAuthenticationFilter.class);
|
||||||
|
}
|
||||||
http
|
http
|
||||||
// API stateless : pas de session, pas de cookie => CSRF sans objet.
|
// API stateless : pas de session, pas de cookie => CSRF sans objet.
|
||||||
// Les credentials HTTP Basic sont envoyes a chaque requete, donc
|
// Les credentials HTTP Basic sont envoyes a chaque requete, donc
|
||||||
|
|||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
package com.loremind.infrastructure.web.controller;
|
||||||
|
|
||||||
|
import com.loremind.application.remoteaccess.PairingCode;
|
||||||
|
import com.loremind.application.remoteaccess.RemoteAccessService;
|
||||||
|
import com.loremind.application.remoteaccess.RemoteAccessStatus;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Réglage de l'accès distant, côté PC (mode bureau). Sous {@code /api/settings} : réservé
|
||||||
|
* à l'admin (HTTP Basic) ET à la machine elle-même ({@code RemoteAccessFilter} refuse ces
|
||||||
|
* routes à tout appareil du réseau, même appairé). 404 en Docker (profil {@code local} absent).
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Profile("local")
|
||||||
|
@RequestMapping("/api/settings/remote-access")
|
||||||
|
public class RemoteAccessAdminController {
|
||||||
|
|
||||||
|
private final RemoteAccessService remoteAccessService;
|
||||||
|
|
||||||
|
public RemoteAccessAdminController(RemoteAccessService remoteAccessService) {
|
||||||
|
this.remoteAccessService = remoteAccessService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public record ConfigureRequest(boolean enabled, int port) {}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public RemoteAccessStatus status() {
|
||||||
|
return remoteAccessService.status();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public RemoteAccessStatus configure(@RequestBody ConfigureRequest request) {
|
||||||
|
return remoteAccessService.configure(request.enabled(), request.port());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/pairing-code")
|
||||||
|
public PairingCode newPairingCode() {
|
||||||
|
return remoteAccessService.newPairingCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/devices/{id}")
|
||||||
|
public ResponseEntity<Void> revoke(@PathVariable String id) {
|
||||||
|
return remoteAccessService.revoke(id) ? ResponseEntity.noContent().build() : ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Port occupé, accès non ouvert… : conflit d'état, message prêt à afficher. */
|
||||||
|
@ExceptionHandler(IllegalStateException.class)
|
||||||
|
public ResponseEntity<Map<String, String>> conflict(IllegalStateException e) {
|
||||||
|
return ResponseEntity.status(HttpStatus.CONFLICT).body(Map.of("error", e.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
+78
@@ -0,0 +1,78 @@
|
|||||||
|
package com.loremind.infrastructure.web.controller;
|
||||||
|
|
||||||
|
import com.loremind.application.remoteaccess.PairedDevice;
|
||||||
|
import com.loremind.application.remoteaccess.PairingRejectedException;
|
||||||
|
import com.loremind.application.remoteaccess.PairingResult;
|
||||||
|
import com.loremind.application.remoteaccess.RemoteAccessService;
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteDevice;
|
||||||
|
import com.loremind.infrastructure.web.config.RemoteAccessFilter;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseCookie;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appairage d'une tablette (mode bureau) : seules routes d'API joignables depuis le réseau
|
||||||
|
* sans jeton (avec {@code /api/config} et {@code /api/version}).
|
||||||
|
* <p>
|
||||||
|
* Le jeton est posé en cookie {@code HttpOnly} + {@code SameSite=Strict} : envoyé
|
||||||
|
* automatiquement par le navigateur (y compris pour les {@code <img>}), illisible par le
|
||||||
|
* JavaScript de la page, et jamais joint à une requête venue d'un autre site (anti-CSRF).
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Profile("local")
|
||||||
|
@RequestMapping("/api/remote-access")
|
||||||
|
public class RemotePairingController {
|
||||||
|
|
||||||
|
static final Duration COOKIE_LIFETIME = Duration.ofDays(365);
|
||||||
|
|
||||||
|
private final RemoteAccessService remoteAccessService;
|
||||||
|
|
||||||
|
public RemotePairingController(RemoteAccessService remoteAccessService) {
|
||||||
|
this.remoteAccessService = remoteAccessService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public record PairRequest(String code, String deviceName) {}
|
||||||
|
|
||||||
|
/** Ce que le front a besoin de savoir pour décider d'afficher l'écran d'appairage. */
|
||||||
|
public record SessionInfo(boolean remote, boolean paired, String deviceName) {}
|
||||||
|
|
||||||
|
@PostMapping("/pair")
|
||||||
|
public ResponseEntity<PairedDevice> pair(@RequestBody PairRequest request,
|
||||||
|
@RequestHeader(value = HttpHeaders.USER_AGENT, required = false) String userAgent) {
|
||||||
|
PairingResult result = remoteAccessService.pair(request.code(), request.deviceName(), userAgent);
|
||||||
|
ResponseCookie cookie = ResponseCookie.from(RemoteAccessFilter.DEVICE_COOKIE, result.token())
|
||||||
|
.httpOnly(true)
|
||||||
|
.sameSite("Strict")
|
||||||
|
.path("/")
|
||||||
|
.maxAge(COOKIE_LIFETIME)
|
||||||
|
.build();
|
||||||
|
return ResponseEntity.ok().header(HttpHeaders.SET_COOKIE, cookie.toString()).body(result.device());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/session")
|
||||||
|
public SessionInfo session(HttpServletRequest request) {
|
||||||
|
boolean remote = RemoteAccessFilter.isFromLan(request, remoteAccessService.lanPort());
|
||||||
|
if (!remote) return new SessionInfo(false, true, null);
|
||||||
|
Optional<RemoteDevice> device = remoteAccessService.authenticate(RemoteAccessFilter.deviceToken(request));
|
||||||
|
return new SessionInfo(true, device.isPresent(), device.map(RemoteDevice::getName).orElse(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(PairingRejectedException.class)
|
||||||
|
public ResponseEntity<Map<String, String>> rejected(PairingRejectedException e) {
|
||||||
|
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(Map.of("error", e.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
-- Accès distant à l'application de bureau (tablette / téléphone sur le réseau local).
|
||||||
|
-- remote_access_config : réglage singleton (id = 'current') — activé ou non, port réseau.
|
||||||
|
-- remote_devices : appareils appairés par code ; seule l'EMPREINTE SHA-256 du jeton
|
||||||
|
-- est stockée (le jeton lui-même ne vit que dans le cookie de l'appareil).
|
||||||
|
-- Tables présentes partout (Docker compris) mais utilisées uniquement en mode bureau.
|
||||||
|
-- Compatible Postgres et H2 (MODE=PostgreSQL).
|
||||||
|
create table remote_access_config (
|
||||||
|
id varchar(32) not null,
|
||||||
|
enabled boolean not null,
|
||||||
|
port integer not null,
|
||||||
|
updated_at timestamp(6) with time zone not null,
|
||||||
|
primary key (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table remote_devices (
|
||||||
|
id bigint generated by default as identity,
|
||||||
|
name varchar(100) not null,
|
||||||
|
token_hash varchar(64) not null,
|
||||||
|
user_agent varchar(300),
|
||||||
|
created_at timestamp(6) with time zone not null,
|
||||||
|
last_seen_at timestamp(6) with time zone,
|
||||||
|
primary key (id)
|
||||||
|
);
|
||||||
|
create unique index ux_remote_device_token on remote_devices (token_hash);
|
||||||
+258
@@ -0,0 +1,258 @@
|
|||||||
|
package com.loremind.application.remoteaccess;
|
||||||
|
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteAccessConfig;
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteDevice;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.LanConnector;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.RemoteAccessConfigRepository;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.RemoteDeviceRepository;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.time.Clock;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test unitaire de {@link RemoteAccessService} avec des doublures en mémoire (pas de Mockito :
|
||||||
|
* l'état des appareils et du connecteur doit vraiment évoluer d'un appel à l'autre).
|
||||||
|
*/
|
||||||
|
class RemoteAccessServiceTest {
|
||||||
|
|
||||||
|
private static final int LOCAL_PORT = 8080;
|
||||||
|
|
||||||
|
private MutableClock clock;
|
||||||
|
private FakeLan lan;
|
||||||
|
private InMemoryDevices devices;
|
||||||
|
private InMemoryConfig config;
|
||||||
|
private RemoteAccessService service;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() {
|
||||||
|
clock = new MutableClock(Instant.parse("2026-10-17T10:00:00Z"));
|
||||||
|
lan = new FakeLan();
|
||||||
|
devices = new InMemoryDevices();
|
||||||
|
config = new InMemoryConfig();
|
||||||
|
service = new RemoteAccessService(config, devices, lan, LOCAL_PORT, clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String freshCode() {
|
||||||
|
service.configure(true, 8765);
|
||||||
|
return service.newPairingCode().code();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Réglage ---
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void disabledByDefault_noConnector() {
|
||||||
|
RemoteAccessStatus status = service.status();
|
||||||
|
assertFalse(status.enabled());
|
||||||
|
assertFalse(status.running());
|
||||||
|
assertEquals(RemoteAccessConfig.DEFAULT_PORT, status.port());
|
||||||
|
assertTrue(status.urls().isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void enable_opensConnector_persists_andListsUrls() {
|
||||||
|
RemoteAccessStatus status = service.configure(true, 8765);
|
||||||
|
|
||||||
|
assertEquals(8765, lan.port);
|
||||||
|
assertTrue(status.running());
|
||||||
|
assertEquals(List.of("http://192.168.1.20:8765"), status.urls());
|
||||||
|
assertEquals(new RemoteAccessConfig(true, 8765), config.saved);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void enable_onBusyPort_staysDisabled() {
|
||||||
|
lan.busy = true;
|
||||||
|
assertThrows(IllegalStateException.class, () -> service.configure(true, 8765));
|
||||||
|
assertNull(config.saved);
|
||||||
|
assertFalse(service.status().enabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void rejects_portOutOfRange_orSameAsLocalPort() {
|
||||||
|
assertThrows(IllegalArgumentException.class, () -> service.configure(true, 80));
|
||||||
|
assertThrows(IllegalArgumentException.class, () -> service.configure(true, LOCAL_PORT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void disable_closesConnector_andInvalidatesPendingCode() {
|
||||||
|
String code = freshCode();
|
||||||
|
service.configure(false, 8765);
|
||||||
|
|
||||||
|
assertEquals(-1, lan.port);
|
||||||
|
assertThrows(PairingRejectedException.class, () -> service.pair(code, "Tablette", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void applySavedConfig_reopensOnBoot_withoutCrashingOnBusyPort() {
|
||||||
|
config.saved = new RemoteAccessConfig(true, 8765);
|
||||||
|
lan.busy = true;
|
||||||
|
|
||||||
|
service.applySavedConfig();
|
||||||
|
|
||||||
|
assertEquals(-1, lan.port);
|
||||||
|
assertNotNull(service.status().lastError());
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Appairage ---
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void pairingCode_requiresOpenConnector() {
|
||||||
|
assertThrows(IllegalStateException.class, () -> service.newPairingCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void pairingCode_isSixDigits() {
|
||||||
|
assertTrue(freshCode().matches("\\d{6}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void pair_withRightCode_issuesToken_storesOnlyItsHash_andConsumesTheCode() {
|
||||||
|
String code = freshCode();
|
||||||
|
|
||||||
|
PairingResult result = service.pair(code, " Tablette de Léa ", "Mozilla/5.0 (iPad)");
|
||||||
|
|
||||||
|
assertEquals("Tablette de Léa", result.device().name());
|
||||||
|
RemoteDevice stored = devices.items.get(0);
|
||||||
|
assertNotEquals(result.token(), stored.getTokenHash());
|
||||||
|
assertEquals(RemoteAccessService.sha256(result.token()), stored.getTokenHash());
|
||||||
|
assertTrue(service.authenticate(result.token()).isPresent());
|
||||||
|
// Code à usage unique.
|
||||||
|
assertThrows(PairingRejectedException.class, () -> service.pair(code, "Autre", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void pair_rejectsExpiredCode() {
|
||||||
|
String code = freshCode();
|
||||||
|
clock.advance(RemoteAccessService.CODE_TTL.plusSeconds(1));
|
||||||
|
assertThrows(PairingRejectedException.class, () -> service.pair(code, "Tablette", null));
|
||||||
|
assertTrue(devices.items.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void pair_invalidatesCodeAfterTooManyWrongAttempts() {
|
||||||
|
String code = freshCode();
|
||||||
|
String wrong = code.equals("000000") ? "111111" : "000000";
|
||||||
|
for (int i = 0; i < RemoteAccessService.CODE_MAX_ATTEMPTS; i++) {
|
||||||
|
assertThrows(PairingRejectedException.class, () -> service.pair(wrong, "Tablette", null));
|
||||||
|
}
|
||||||
|
// Même le bon code ne passe plus : il faut en afficher un nouveau.
|
||||||
|
assertThrows(PairingRejectedException.class, () -> service.pair(code, "Tablette", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void pair_globalThrottle_blocksBurstAcrossCodes() {
|
||||||
|
for (int i = 0; i < RemoteAccessService.GLOBAL_MAX_FAILURES_PER_MINUTE; i++) {
|
||||||
|
assertThrows(PairingRejectedException.class, () -> service.pair("123456", "x", null));
|
||||||
|
}
|
||||||
|
String code = freshCode();
|
||||||
|
PairingRejectedException blocked =
|
||||||
|
assertThrows(PairingRejectedException.class, () -> service.pair(code, "Tablette", null));
|
||||||
|
assertTrue(blocked.getMessage().contains("minute"));
|
||||||
|
|
||||||
|
clock.advance(Duration.ofMinutes(2));
|
||||||
|
assertDoesNotThrow(() -> service.pair(code, "Tablette", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deviceName_defaultsAndIsTruncated() {
|
||||||
|
PairingResult unnamed = service.pair(freshCode(), " ", null);
|
||||||
|
assertEquals("Appareil", unnamed.device().name());
|
||||||
|
|
||||||
|
PairingResult longName = service.pair(service.newPairingCode().code(), "x".repeat(300), null);
|
||||||
|
assertEquals(RemoteAccessService.DEVICE_NAME_MAX, longName.device().name().length());
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Authentification & révocation ---
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void authenticate_unknownOrBlankToken_isEmpty() {
|
||||||
|
assertTrue(service.authenticate(null).isEmpty());
|
||||||
|
assertTrue(service.authenticate("").isEmpty());
|
||||||
|
assertTrue(service.authenticate("inconnu").isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void authenticate_touchesLastSeen_atMostOncePerMinute() {
|
||||||
|
String token = service.pair(freshCode(), "Tablette", null).token();
|
||||||
|
devices.touches = 0;
|
||||||
|
|
||||||
|
service.authenticate(token);
|
||||||
|
assertEquals(0, devices.touches);
|
||||||
|
|
||||||
|
clock.advance(Duration.ofMinutes(2));
|
||||||
|
service.authenticate(token);
|
||||||
|
assertEquals(1, devices.touches);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void revoke_cutsAccess() {
|
||||||
|
PairingResult result = service.pair(freshCode(), "Tablette", null);
|
||||||
|
|
||||||
|
assertTrue(service.revoke(result.device().id()));
|
||||||
|
assertTrue(service.authenticate(result.token()).isEmpty());
|
||||||
|
assertFalse(service.revoke(result.device().id()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Doublures ---
|
||||||
|
|
||||||
|
private static final class MutableClock extends Clock {
|
||||||
|
private Instant now;
|
||||||
|
|
||||||
|
MutableClock(Instant now) { this.now = now; }
|
||||||
|
|
||||||
|
void advance(Duration d) { now = now.plus(d); }
|
||||||
|
|
||||||
|
@Override public Instant instant() { return now; }
|
||||||
|
@Override public java.time.ZoneId getZone() { return ZoneOffset.UTC; }
|
||||||
|
@Override public Clock withZone(java.time.ZoneId zone) { return this; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class FakeLan implements LanConnector {
|
||||||
|
int port = -1;
|
||||||
|
boolean busy;
|
||||||
|
|
||||||
|
@Override public void start(int p) {
|
||||||
|
if (busy) throw new IllegalStateException("Le port " + p + " est déjà utilisé par une autre application.");
|
||||||
|
port = p;
|
||||||
|
}
|
||||||
|
@Override public void stop() { port = -1; }
|
||||||
|
@Override public int runningPort() { return port; }
|
||||||
|
@Override public List<String> lanAddresses() { return List.of("192.168.1.20"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class InMemoryConfig implements RemoteAccessConfigRepository {
|
||||||
|
RemoteAccessConfig saved;
|
||||||
|
|
||||||
|
@Override public Optional<RemoteAccessConfig> find() { return Optional.ofNullable(saved); }
|
||||||
|
@Override public RemoteAccessConfig save(RemoteAccessConfig c) { saved = c; return c; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class InMemoryDevices implements RemoteDeviceRepository {
|
||||||
|
final List<RemoteDevice> items = new ArrayList<>();
|
||||||
|
int touches;
|
||||||
|
private int nextId = 1;
|
||||||
|
|
||||||
|
@Override public RemoteDevice save(RemoteDevice d) {
|
||||||
|
d.setId(String.valueOf(nextId++));
|
||||||
|
items.add(d);
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
@Override public Optional<RemoteDevice> findByTokenHash(String h) {
|
||||||
|
return items.stream().filter(d -> d.getTokenHash().equals(h)).findFirst();
|
||||||
|
}
|
||||||
|
@Override public List<RemoteDevice> findAll() { return List.copyOf(items); }
|
||||||
|
@Override public void touch(String id, Instant at) {
|
||||||
|
touches++;
|
||||||
|
items.stream().filter(d -> d.getId().equals(id)).forEach(d -> d.setLastSeenAt(at));
|
||||||
|
}
|
||||||
|
@Override public boolean deleteById(String id) { return items.removeIf(d -> d.getId().equals(id)); }
|
||||||
|
}
|
||||||
|
}
|
||||||
+193
@@ -0,0 +1,193 @@
|
|||||||
|
package com.loremind.infrastructure.desktop;
|
||||||
|
|
||||||
|
import com.loremind.application.remoteaccess.RemoteAccessService;
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteAccessConfig;
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteDevice;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.LanConnector;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.RemoteAccessConfigRepository;
|
||||||
|
import com.loremind.domain.remoteaccess.ports.RemoteDeviceRepository;
|
||||||
|
import com.loremind.infrastructure.web.config.RemoteAccessFilter;
|
||||||
|
import com.loremind.infrastructure.web.controller.RemotePairingController;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||||
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.ConnectException;
|
||||||
|
import java.net.ServerSocket;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test d'intégration de l'accès distant sur un VRAI Tomcat : ouverture à chaud du second
|
||||||
|
* connecteur, garde du filtre, appairage par code avec pose du cookie, puis fermeture.
|
||||||
|
* Contexte Spring minimal (ni base, ni sécurité) : seules les briques de l'accès distant.
|
||||||
|
*/
|
||||||
|
@SpringBootTest(classes = TomcatLanConnectorIntegrationTest.App.class,
|
||||||
|
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||||
|
properties = "spring.main.banner-mode=off")
|
||||||
|
class TomcatLanConnectorIntegrationTest {
|
||||||
|
|
||||||
|
@SpringBootConfiguration
|
||||||
|
@EnableAutoConfiguration(exclude = {
|
||||||
|
DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, FlywayAutoConfiguration.class,
|
||||||
|
SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class, UserDetailsServiceAutoConfiguration.class})
|
||||||
|
@Import(App.Ping.class)
|
||||||
|
static class App {
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
static class Ping {
|
||||||
|
@GetMapping("/api/ping")
|
||||||
|
String ping() { return "pong"; }
|
||||||
|
|
||||||
|
@GetMapping("/api/settings/secret")
|
||||||
|
String secret() { return "admin"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
TomcatLanConnector lanConnector(ApplicationContext context) {
|
||||||
|
return new TomcatLanConnector(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
RemoteAccessService remoteAccessService(LanConnector lan) {
|
||||||
|
return new RemoteAccessService(new InMemoryConfig(), new InMemoryDevices(), lan, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** En @Bean : un @Import ignorerait la classe, annotée @Profile("local"). */
|
||||||
|
@Bean
|
||||||
|
RemotePairingController remotePairingController(RemoteAccessService service) {
|
||||||
|
return new RemotePairingController(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
FilterRegistrationBean<RemoteAccessFilter> remoteAccessFilter(RemoteAccessService service) {
|
||||||
|
return new FilterRegistrationBean<>(new RemoteAccessFilter(service));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@LocalServerPort private int localPort;
|
||||||
|
@Autowired private RemoteAccessService service;
|
||||||
|
@Autowired private TomcatLanConnector lan;
|
||||||
|
|
||||||
|
private final HttpClient http = HttpClient.newHttpClient();
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void closeLan() {
|
||||||
|
lan.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private HttpResponse<String> get(int port, String path, String cookie) throws Exception {
|
||||||
|
HttpRequest.Builder req = HttpRequest.newBuilder(URI.create("http://127.0.0.1:" + port + path)).GET();
|
||||||
|
if (cookie != null) req.header("Cookie", cookie);
|
||||||
|
return http.send(req.build(), HttpResponse.BodyHandlers.ofString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private HttpResponse<String> post(int port, String path, String json) throws Exception {
|
||||||
|
return http.send(HttpRequest.newBuilder(URI.create("http://127.0.0.1:" + port + path))
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.POST(HttpRequest.BodyPublishers.ofString(json)).build(), HttpResponse.BodyHandlers.ofString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int freePort() throws IOException {
|
||||||
|
try (ServerSocket s = new ServerSocket(0)) {
|
||||||
|
return s.getLocalPort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void lanConnector_guardsApi_pairsWithCode_andClosesCleanly() throws Exception {
|
||||||
|
// Connecteur habituel : inchangé, aucun jeton demandé.
|
||||||
|
assertEquals(200, get(localPort, "/api/ping", null).statusCode());
|
||||||
|
|
||||||
|
int lanPort = freePort();
|
||||||
|
assertTrue(service.configure(true, lanPort).running());
|
||||||
|
|
||||||
|
// Depuis le réseau : appairage exigé, administration interdite.
|
||||||
|
HttpResponse<String> unpaired = get(lanPort, "/api/ping", null);
|
||||||
|
assertEquals(401, unpaired.statusCode());
|
||||||
|
assertTrue(unpaired.body().contains("remote_pairing_required"));
|
||||||
|
assertEquals(403, get(lanPort, "/api/settings/secret", null).statusCode());
|
||||||
|
|
||||||
|
// Mauvais code puis bon code : le bon pose un cookie HttpOnly + SameSite=Strict.
|
||||||
|
assertEquals(403, post(lanPort, "/api/remote-access/pair", "{\"code\":\"abcdef\",\"deviceName\":\"x\"}").statusCode());
|
||||||
|
String code = service.newPairingCode().code();
|
||||||
|
HttpResponse<String> paired = post(lanPort, "/api/remote-access/pair",
|
||||||
|
"{\"code\":\"" + code + "\",\"deviceName\":\"Tablette de test\"}");
|
||||||
|
assertEquals(200, paired.statusCode());
|
||||||
|
String setCookie = paired.headers().firstValue("Set-Cookie").orElseThrow();
|
||||||
|
assertTrue(setCookie.startsWith(RemoteAccessFilter.DEVICE_COOKIE + "="));
|
||||||
|
assertTrue(setCookie.contains("HttpOnly"));
|
||||||
|
assertTrue(setCookie.contains("SameSite=Strict"));
|
||||||
|
String cookie = setCookie.split(";", 2)[0];
|
||||||
|
|
||||||
|
HttpResponse<String> authorized = get(lanPort, "/api/ping", cookie);
|
||||||
|
assertEquals(200, authorized.statusCode());
|
||||||
|
assertEquals("pong", authorized.body());
|
||||||
|
assertEquals(403, get(lanPort, "/api/settings/secret", cookie).statusCode());
|
||||||
|
assertTrue(get(lanPort, "/api/remote-access/session", cookie).body().contains("\"paired\":true"));
|
||||||
|
|
||||||
|
// Désactivation : le port réseau se ferme, le connecteur local continue.
|
||||||
|
service.configure(false, lanPort);
|
||||||
|
assertThrows(ConnectException.class, () -> get(lanPort, "/api/ping", cookie));
|
||||||
|
assertEquals(200, get(localPort, "/api/ping", null).statusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void busyPort_isReportedClearly() throws Exception {
|
||||||
|
try (ServerSocket occupied = new ServerSocket(0)) {
|
||||||
|
IllegalStateException e = assertThrows(IllegalStateException.class,
|
||||||
|
() -> service.configure(true, occupied.getLocalPort()));
|
||||||
|
assertTrue(e.getMessage().contains("déjà utilisé"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Doublures de persistance ---
|
||||||
|
|
||||||
|
static final class InMemoryConfig implements RemoteAccessConfigRepository {
|
||||||
|
private RemoteAccessConfig saved;
|
||||||
|
|
||||||
|
@Override public Optional<RemoteAccessConfig> find() { return Optional.ofNullable(saved); }
|
||||||
|
@Override public RemoteAccessConfig save(RemoteAccessConfig c) { saved = c; return c; }
|
||||||
|
}
|
||||||
|
|
||||||
|
static final class InMemoryDevices implements RemoteDeviceRepository {
|
||||||
|
private final List<RemoteDevice> items = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override public synchronized RemoteDevice save(RemoteDevice d) {
|
||||||
|
d.setId(String.valueOf(items.size() + 1));
|
||||||
|
items.add(d);
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
@Override public synchronized Optional<RemoteDevice> findByTokenHash(String h) {
|
||||||
|
return items.stream().filter(d -> d.getTokenHash().equals(h)).findFirst();
|
||||||
|
}
|
||||||
|
@Override public synchronized List<RemoteDevice> findAll() { return List.copyOf(items); }
|
||||||
|
@Override public void touch(String id, Instant at) { /* sans objet ici */ }
|
||||||
|
@Override public synchronized boolean deleteById(String id) { return items.removeIf(d -> d.getId().equals(id)); }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -73,6 +73,15 @@ class FlywayMigrationTest {
|
|||||||
"values ('C', 0, now(), now())");
|
"values ('C', 0, now(), now())");
|
||||||
st.executeUpdate("insert into arcs (name, campaign_id, \"order\", type, created_at, updated_at) " +
|
st.executeUpdate("insert into arcs (name, campaign_id, \"order\", type, created_at, updated_at) " +
|
||||||
"select 'Quêtes libres', id, 9999, 'SYSTEM', now(), now() from campaigns");
|
"select 'Quêtes libres', id, 9999, 'SYSTEM', now(), now() from campaigns");
|
||||||
|
|
||||||
|
// V25 : accès distant — réglage singleton + appareils, empreinte de jeton unique.
|
||||||
|
st.executeUpdate("insert into remote_access_config (id, enabled, port, updated_at) " +
|
||||||
|
"values ('current', true, 8765, now())");
|
||||||
|
st.executeUpdate("insert into remote_devices (name, token_hash, created_at) values ('Tablette', 'abc', now())");
|
||||||
|
assertThrows(SQLException.class,
|
||||||
|
() -> st.executeUpdate("insert into remote_devices (name, token_hash, created_at) " +
|
||||||
|
"values ('Doublon', 'abc', now())"),
|
||||||
|
"remote_devices.token_hash doit être unique (V25)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.loremind.infrastructure.web.config;
|
||||||
|
|
||||||
|
import com.loremind.application.remoteaccess.RemoteAccessService;
|
||||||
|
import com.loremind.domain.remoteaccess.RemoteDevice;
|
||||||
|
import jakarta.servlet.http.Cookie;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
import org.mockito.junit.jupiter.MockitoSettings;
|
||||||
|
import org.mockito.quality.Strictness;
|
||||||
|
import org.springframework.mock.web.MockFilterChain;
|
||||||
|
import org.springframework.mock.web.MockHttpServletRequest;
|
||||||
|
import org.springframework.mock.web.MockHttpServletResponse;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test unitaire de {@link RemoteAccessFilter} : ce qui passe et ce qui est refusé selon
|
||||||
|
* le connecteur d'arrivée (local / réseau), le chemin et le cookie d'appareil.
|
||||||
|
*/
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||||
|
class RemoteAccessFilterTest {
|
||||||
|
|
||||||
|
private static final int LOCAL_PORT = 8080;
|
||||||
|
private static final int LAN_PORT = 8765;
|
||||||
|
|
||||||
|
@Mock private RemoteAccessService service;
|
||||||
|
private RemoteAccessFilter filter;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() {
|
||||||
|
filter = new RemoteAccessFilter(service);
|
||||||
|
when(service.lanPort()).thenReturn(LAN_PORT);
|
||||||
|
when(service.authenticate("bon-jeton")).thenReturn(Optional.of(RemoteDevice.builder().id("1").name("Tablette").build()));
|
||||||
|
when(service.authenticate(null)).thenReturn(Optional.empty());
|
||||||
|
when(service.authenticate("mauvais")).thenReturn(Optional.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
private record Outcome(boolean passed, int status, String body) {}
|
||||||
|
|
||||||
|
private Outcome run(int localPort, String path, String token) throws Exception {
|
||||||
|
MockHttpServletRequest request = new MockHttpServletRequest("GET", path);
|
||||||
|
request.setLocalPort(localPort);
|
||||||
|
if (token != null) request.setCookies(new Cookie(RemoteAccessFilter.DEVICE_COOKIE, token));
|
||||||
|
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||||
|
MockFilterChain chain = new MockFilterChain();
|
||||||
|
filter.doFilter(request, response, chain);
|
||||||
|
return new Outcome(chain.getRequest() != null, response.getStatus(), response.getContentAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void localConnector_isUntouched_evenForSettings() throws Exception {
|
||||||
|
assertTrue(run(LOCAL_PORT, "/api/campaigns", null).passed());
|
||||||
|
assertTrue(run(LOCAL_PORT, "/api/settings", null).passed());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void lanClosed_meansEverythingIsLocal() throws Exception {
|
||||||
|
when(service.lanPort()).thenReturn(-1);
|
||||||
|
assertTrue(run(LOCAL_PORT, "/api/campaigns", null).passed());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void lan_staticFrontAndPublicApi_passWithoutToken() throws Exception {
|
||||||
|
assertTrue(run(LAN_PORT, "/", null).passed());
|
||||||
|
assertTrue(run(LAN_PORT, "/pair", null).passed());
|
||||||
|
assertTrue(run(LAN_PORT, "/main-ABC123.js", null).passed());
|
||||||
|
assertTrue(run(LAN_PORT, "/api/config", null).passed());
|
||||||
|
assertTrue(run(LAN_PORT, "/api/remote-access/pair", null).passed());
|
||||||
|
assertTrue(run(LAN_PORT, "/api/remote-access/session", null).passed());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void lan_api_requiresValidDeviceToken() throws Exception {
|
||||||
|
Outcome none = run(LAN_PORT, "/api/campaigns", null);
|
||||||
|
assertFalse(none.passed());
|
||||||
|
assertEquals(401, none.status());
|
||||||
|
assertTrue(none.body().contains("remote_pairing_required"));
|
||||||
|
|
||||||
|
assertEquals(401, run(LAN_PORT, "/api/images/42", "mauvais").status());
|
||||||
|
assertTrue(run(LAN_PORT, "/api/campaigns", "bon-jeton").passed());
|
||||||
|
assertTrue(run(LAN_PORT, "/api/images/42", "bon-jeton").passed());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void lan_adminRoutes_areAlwaysForbidden_evenWhenPaired() throws Exception {
|
||||||
|
for (String path : new String[]{"/api/settings", "/api/settings/remote-access", "/api/admin/data/export", "/api/license"}) {
|
||||||
|
Outcome outcome = run(LAN_PORT, path, "bon-jeton");
|
||||||
|
assertFalse(outcome.passed(), path);
|
||||||
|
assertEquals(403, outcome.status(), path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,9 @@
|
|||||||
"zone.js"
|
"zone.js"
|
||||||
],
|
],
|
||||||
"tsConfig": "tsconfig.json",
|
"tsConfig": "tsconfig.json",
|
||||||
|
"allowedCommonJsDependencies": [
|
||||||
|
"qrcode"
|
||||||
|
],
|
||||||
"assets": [
|
"assets": [
|
||||||
"src/favicon.ico",
|
"src/favicon.ico",
|
||||||
"src/assets"
|
"src/assets"
|
||||||
|
|||||||
Generated
+254
-47
@@ -22,6 +22,7 @@
|
|||||||
"dompurify": "^3.4.1",
|
"dompurify": "^3.4.1",
|
||||||
"lucide-angular": "^1.0.0",
|
"lucide-angular": "^1.0.0",
|
||||||
"marked": "^18.0.2",
|
"marked": "^18.0.2",
|
||||||
|
"qrcode": "^1.5.4",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"zone.js": "~0.15.1"
|
"zone.js": "~0.15.1"
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
"@emnapi/runtime": "^1.11.0",
|
"@emnapi/runtime": "^1.11.0",
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@playwright/test": "^1.59.1",
|
"@playwright/test": "^1.59.1",
|
||||||
|
"@types/qrcode": "^1.5.6",
|
||||||
"@vitest/coverage-v8": "^4.1.9",
|
"@vitest/coverage-v8": "^4.1.9",
|
||||||
"angular-eslint": "21.4.0",
|
"angular-eslint": "21.4.0",
|
||||||
"eslint": "^10.3.0",
|
"eslint": "^10.3.0",
|
||||||
@@ -570,7 +572,6 @@
|
|||||||
"integrity": "sha512-BaUSLSyS+43fzDoJkTMkGqNdCXq3fGnUZsfXTmrlZPJf5AYFbgAlAPGZXDJyoNWw43fux+DafdlrlKcYUSgSIw==",
|
"integrity": "sha512-BaUSLSyS+43fzDoJkTMkGqNdCXq3fGnUZsfXTmrlZPJf5AYFbgAlAPGZXDJyoNWw43fux+DafdlrlKcYUSgSIw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular-eslint/bundled-angular-compiler": "21.4.0",
|
"@angular-eslint/bundled-angular-compiler": "21.4.0",
|
||||||
"eslint-scope": "9.1.2"
|
"eslint-scope": "9.1.2"
|
||||||
@@ -601,7 +602,6 @@
|
|||||||
"integrity": "sha512-zOW8FFa9qfbVkZ5TulxDkl1C3+gEjWfAAD5Z2MycA6pjVJQlLYPiTAGq+flOQ3yZfTT0z6kd5rejQMXWI81Dvg==",
|
"integrity": "sha512-zOW8FFa9qfbVkZ5TulxDkl1C3+gEjWfAAD5Z2MycA6pjVJQlLYPiTAGq+flOQ3yZfTT0z6kd5rejQMXWI81Dvg==",
|
||||||
"deprecated": "@angular/animations is deprecated. Use `animate.enter` and `animate.leave` instead. For more information see: https://v22.angular.dev/guide/animations.",
|
"deprecated": "@angular/animations is deprecated. Use `animate.enter` and `animate.leave` instead. For more information see: https://v22.angular.dev/guide/animations.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -734,7 +734,6 @@
|
|||||||
"integrity": "sha512-WOZF4p0SnrmBpNeiOA2pdp9OBvGnOSLWbGdRLXJykyseIiEn7+N+GZp+ZA1aNZB4SWolpYCZfTYwkpo6Sf/LXg==",
|
"integrity": "sha512-WOZF4p0SnrmBpNeiOA2pdp9OBvGnOSLWbGdRLXJykyseIiEn7+N+GZp+ZA1aNZB4SWolpYCZfTYwkpo6Sf/LXg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular-devkit/architect": "0.2102.18",
|
"@angular-devkit/architect": "0.2102.18",
|
||||||
"@angular-devkit/core": "21.2.18",
|
"@angular-devkit/core": "21.2.18",
|
||||||
@@ -769,7 +768,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/common/-/common-21.2.17.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/common/-/common-21.2.17.tgz",
|
||||||
"integrity": "sha512-hqAQxRfi5ldFE42suAXRcY+JCANrUh7fuSQ/DtZ7L896id5BT/exuv6dWNBC1PyAfQmRbpD5Pt6/pd+tNLyhDQ==",
|
"integrity": "sha512-hqAQxRfi5ldFE42suAXRcY+JCANrUh7fuSQ/DtZ7L896id5BT/exuv6dWNBC1PyAfQmRbpD5Pt6/pd+tNLyhDQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -786,7 +784,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-21.2.17.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-21.2.17.tgz",
|
||||||
"integrity": "sha512-p+NdjYiwAz9Zmu2yul0LlMXaFjMISVVa24+/MVMoKFeQeI82QE8jDywPlnOSHQHvdCcQVpS7saeEriZzX3JuBQ==",
|
"integrity": "sha512-p+NdjYiwAz9Zmu2yul0LlMXaFjMISVVa24+/MVMoKFeQeI82QE8jDywPlnOSHQHvdCcQVpS7saeEriZzX3JuBQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -800,7 +797,6 @@
|
|||||||
"integrity": "sha512-KithZ3b0HBFH0NbUcswBcjpN9y09vLbarMD7qmGWTnGUBk4W8cn4sbT8zJyv9CRKg9ZcuUBeJYKUfUPn/u/5OQ==",
|
"integrity": "sha512-KithZ3b0HBFH0NbUcswBcjpN9y09vLbarMD7qmGWTnGUBk4W8cn4sbT8zJyv9CRKg9ZcuUBeJYKUfUPn/u/5OQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "7.29.0",
|
"@babel/core": "7.29.0",
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.14",
|
"@jridgewell/sourcemap-codec": "^1.4.14",
|
||||||
@@ -881,7 +877,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/core/-/core-21.2.17.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/core/-/core-21.2.17.tgz",
|
||||||
"integrity": "sha512-wYHpwIdnUnjQFOJJNqRcGx7LS3u64jT+R9L0TnMR/ViBM9dQgGYImlSikkftg2yrFCNo5aKRxhG2LLskQurVdg==",
|
"integrity": "sha512-wYHpwIdnUnjQFOJJNqRcGx7LS3u64jT+R9L0TnMR/ViBM9dQgGYImlSikkftg2yrFCNo5aKRxhG2LLskQurVdg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -926,7 +921,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-21.2.17.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-21.2.17.tgz",
|
||||||
"integrity": "sha512-ROdSliejY37g1EphYmweYdm5cHM8HY3X4tbWt4ubxmhTyYgfN3nxrxfGQ/n7Mz5tDY9VXVLIGDgjLOGYOo4uTQ==",
|
"integrity": "sha512-ROdSliejY37g1EphYmweYdm5cHM8HY3X4tbWt4ubxmhTyYgfN3nxrxfGQ/n7Mz5tDY9VXVLIGDgjLOGYOo4uTQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -1012,7 +1006,6 @@
|
|||||||
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
|
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.29.7",
|
"@babel/code-frame": "^7.29.7",
|
||||||
"@babel/generator": "^7.29.7",
|
"@babel/generator": "^7.29.7",
|
||||||
@@ -2746,7 +2739,6 @@
|
|||||||
"integrity": "sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA==",
|
"integrity": "sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emnapi/wasi-threads": "1.2.2",
|
"@emnapi/wasi-threads": "1.2.2",
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
@@ -2758,7 +2750,6 @@
|
|||||||
"integrity": "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==",
|
"integrity": "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
@@ -3663,7 +3654,6 @@
|
|||||||
"integrity": "sha512-Dx/y9bCQcXLI5ooQ5KyvA4FTgeo2jYj/7plWfV5Ak5wDPKQZgudKez2ixyfz7tKXzcJciTxqLeK7R9HItwiByg==",
|
"integrity": "sha512-Dx/y9bCQcXLI5ooQ5KyvA4FTgeo2jYj/7plWfV5Ak5wDPKQZgudKez2ixyfz7tKXzcJciTxqLeK7R9HItwiByg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@inquirer/checkbox": "^4.3.2",
|
"@inquirer/checkbox": "^4.3.2",
|
||||||
"@inquirer/confirm": "^5.1.21",
|
"@inquirer/confirm": "^5.1.21",
|
||||||
@@ -4903,7 +4893,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@ngx-translate/core/-/core-18.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ngx-translate/core/-/core-18.0.0.tgz",
|
||||||
"integrity": "sha512-Z9u9AXaeuyeHHimivvJQvhal/LJNB+5tlH+FimSU4QQ61FrtRDqgyn6nfFbc6Cb+59NDZdsh4QeTJyPCldFUwA==",
|
"integrity": "sha512-Z9u9AXaeuyeHHimivvJQvhal/LJNB+5tlH+FimSU4QQ61FrtRDqgyn6nfFbc6Cb+59NDZdsh4QeTJyPCldFUwA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -6540,6 +6529,16 @@
|
|||||||
"undici-types": "~8.3.0"
|
"undici-types": "~8.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/qrcode": {
|
||||||
|
"version": "1.5.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz",
|
||||||
|
"integrity": "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/qs": {
|
"node_modules/@types/qs": {
|
||||||
"version": "6.15.1",
|
"version": "6.15.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.1.tgz",
|
||||||
@@ -7211,7 +7210,6 @@
|
|||||||
"integrity": "sha512-xyLtl9DUBBFrcJS4x2pIqGLH68/tC2uOa4Z7pUteW09D3bXnnXUom4dyPikzWgB7llmIc1zoeI3aoUdC4rPK/Q==",
|
"integrity": "sha512-xyLtl9DUBBFrcJS4x2pIqGLH68/tC2uOa4Z7pUteW09D3bXnnXUom4dyPikzWgB7llmIc1zoeI3aoUdC4rPK/Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
},
|
},
|
||||||
@@ -7254,7 +7252,6 @@
|
|||||||
"integrity": "sha512-fUKaeAvrTuQg/Tgt3nliAUSZHJM6DlCcfyEmxCvlX8kieWSStBX+5O5Fnidtc3i2JrH+9c/GL4RY2iasd/GPTA==",
|
"integrity": "sha512-fUKaeAvrTuQg/Tgt3nliAUSZHJM6DlCcfyEmxCvlX8kieWSStBX+5O5Fnidtc3i2JrH+9c/GL4RY2iasd/GPTA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.9.1",
|
"@eslint-community/eslint-utils": "^4.9.1",
|
||||||
"@typescript-eslint/scope-manager": "8.63.0",
|
"@typescript-eslint/scope-manager": "8.63.0",
|
||||||
@@ -7323,7 +7320,6 @@
|
|||||||
"integrity": "sha512-IM49HmthevbgAO4anp1hwtoT9wYe59w0LR00gr+eagHE+ZJ5lK4sLPeO0ubgoJcwLk6dehU3R24N+FbEEKDc8g==",
|
"integrity": "sha512-IM49HmthevbgAO4anp1hwtoT9wYe59w0LR00gr+eagHE+ZJ5lK4sLPeO0ubgoJcwLk6dehU3R24N+FbEEKDc8g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bcoe/v8-coverage": "^1.0.2",
|
"@bcoe/v8-coverage": "^1.0.2",
|
||||||
"@vitest/utils": "4.1.10",
|
"@vitest/utils": "4.1.10",
|
||||||
@@ -7681,7 +7677,6 @@
|
|||||||
"integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==",
|
"integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -7757,7 +7752,6 @@
|
|||||||
"integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
|
"integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"fast-uri": "^3.0.1",
|
"fast-uri": "^3.0.1",
|
||||||
@@ -8303,7 +8297,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.10.42",
|
"baseline-browser-mapping": "^2.10.42",
|
||||||
"caniuse-lite": "^1.0.30001800",
|
"caniuse-lite": "^1.0.30001800",
|
||||||
@@ -8447,6 +8440,15 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/camelcase": {
|
||||||
|
"version": "5.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
|
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001802",
|
"version": "1.0.30001802",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001802.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001802.tgz",
|
||||||
@@ -8673,7 +8675,6 @@
|
|||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"color-name": "~1.1.4"
|
"color-name": "~1.1.4"
|
||||||
@@ -8686,7 +8687,6 @@
|
|||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/colorette": {
|
"node_modules/colorette": {
|
||||||
@@ -9038,6 +9038,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/decamelize": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/deep-is": {
|
"node_modules/deep-is": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||||
@@ -9127,6 +9136,12 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/dijkstrajs": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/dns-packet": {
|
"node_modules/dns-packet": {
|
||||||
"version": "5.6.1",
|
"version": "5.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz",
|
||||||
@@ -9469,7 +9484,6 @@
|
|||||||
"integrity": "sha512-6lVbcqSodALYo+4ELD0heG6lFiFxnLMuLkiMi2qV8LMp54N8tE8FT1GMH+ev4Ti00nFjNze2+Su6DsV5OQW3Dg==",
|
"integrity": "sha512-6lVbcqSodALYo+4ELD0heG6lFiFxnLMuLkiMi2qV8LMp54N8tE8FT1GMH+ev4Ti00nFjNze2+Su6DsV5OQW3Dg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
@@ -9800,7 +9814,6 @@
|
|||||||
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
|
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"accepts": "^2.0.0",
|
"accepts": "^2.0.0",
|
||||||
"body-parser": "^2.2.1",
|
"body-parser": "^2.2.1",
|
||||||
@@ -10137,7 +10150,6 @@
|
|||||||
"version": "2.0.5",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "6.* || 8.* || >= 10.*"
|
"node": "6.* || 8.* || >= 10.*"
|
||||||
@@ -10332,7 +10344,6 @@
|
|||||||
"integrity": "sha512-YwUvVpSF7m1yOblFPrU3Hbo8XhPheBoiyfGuII6z19LnOr6JpDnyyp7LFNrfV56wS8tpvtBFGRISHN02pDdLOA==",
|
"integrity": "sha512-YwUvVpSF7m1yOblFPrU3Hbo8XhPheBoiyfGuII6z19LnOr6JpDnyyp7LFNrfV56wS8tpvtBFGRISHN02pDdLOA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.9.0"
|
"node": ">=16.9.0"
|
||||||
}
|
}
|
||||||
@@ -11221,7 +11232,6 @@
|
|||||||
"integrity": "sha512-j1n1IuTX1VQjIy3tT7cyGbX7nvQOsFLoIqobZv4ttI5axP923gA44zUj6miiA6R5Aoms4sEGVIIcucXUbRI14g==",
|
"integrity": "sha512-j1n1IuTX1VQjIy3tT7cyGbX7nvQOsFLoIqobZv4ttI5axP923gA44zUj6miiA6R5Aoms4sEGVIIcucXUbRI14g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"copy-anything": "^2.0.1",
|
"copy-anything": "^2.0.1",
|
||||||
"parse-node-version": "^1.0.1",
|
"parse-node-version": "^1.0.1",
|
||||||
@@ -12627,6 +12637,15 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/p-try": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pacote": {
|
"node_modules/pacote": {
|
||||||
"version": "21.5.1",
|
"version": "21.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/pacote/-/pacote-21.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/pacote/-/pacote-21.5.1.tgz",
|
||||||
@@ -12787,7 +12806,6 @@
|
|||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -12959,6 +12977,15 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pngjs": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.5.12",
|
"version": "8.5.12",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.12.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.12.tgz",
|
||||||
@@ -12979,7 +13006,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.11",
|
"nanoid": "^3.3.11",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
@@ -13231,6 +13257,177 @@
|
|||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/qrcode": {
|
||||||
|
"version": "1.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
||||||
|
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"dijkstrajs": "^1.0.1",
|
||||||
|
"pngjs": "^5.0.0",
|
||||||
|
"yargs": "^15.3.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"qrcode": "bin/qrcode"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/ansi-regex": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/cliui": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"string-width": "^4.2.0",
|
||||||
|
"strip-ansi": "^6.0.0",
|
||||||
|
"wrap-ansi": "^6.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/emoji-regex": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/find-up": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"locate-path": "^5.0.0",
|
||||||
|
"path-exists": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/is-fullwidth-code-point": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/locate-path": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"p-locate": "^4.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/p-limit": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"p-try": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/p-locate": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"p-limit": "^2.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/string-width": {
|
||||||
|
"version": "4.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||||
|
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"emoji-regex": "^8.0.0",
|
||||||
|
"is-fullwidth-code-point": "^3.0.0",
|
||||||
|
"strip-ansi": "^6.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/strip-ansi": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": "^5.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/y18n": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/yargs": {
|
||||||
|
"version": "15.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
|
||||||
|
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"cliui": "^6.0.0",
|
||||||
|
"decamelize": "^1.2.0",
|
||||||
|
"find-up": "^4.1.0",
|
||||||
|
"get-caller-file": "^2.0.1",
|
||||||
|
"require-directory": "^2.1.1",
|
||||||
|
"require-main-filename": "^2.0.0",
|
||||||
|
"set-blocking": "^2.0.0",
|
||||||
|
"string-width": "^4.2.0",
|
||||||
|
"which-module": "^2.0.0",
|
||||||
|
"y18n": "^4.0.0",
|
||||||
|
"yargs-parser": "^18.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/yargs-parser": {
|
||||||
|
"version": "18.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
|
||||||
|
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"camelcase": "^5.0.0",
|
||||||
|
"decamelize": "^1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/qs": {
|
"node_modules/qs": {
|
||||||
"version": "6.15.3",
|
"version": "6.15.3",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
|
||||||
@@ -13406,6 +13603,15 @@
|
|||||||
"regjsparser": "bin/parser"
|
"regjsparser": "bin/parser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/require-directory": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/require-from-string": {
|
"node_modules/require-from-string": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
||||||
@@ -13416,6 +13622,12 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/require-main-filename": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
"node_modules/requires-port": {
|
"node_modules/requires-port": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||||
@@ -13643,7 +13855,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
||||||
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.1.0"
|
"tslib": "^2.1.0"
|
||||||
}
|
}
|
||||||
@@ -13682,7 +13893,6 @@
|
|||||||
"integrity": "sha512-fDz1zJpd5GycprAbu4Q2PV/RprsRtKC/0z82z0JLgdytmcq0+ujJbJ/09bPGDxCLkKY3Np5cRAOcWiVkLXJURg==",
|
"integrity": "sha512-fDz1zJpd5GycprAbu4Q2PV/RprsRtKC/0z82z0JLgdytmcq0+ujJbJ/09bPGDxCLkKY3Np5cRAOcWiVkLXJURg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": "^4.0.0",
|
"chokidar": "^4.0.0",
|
||||||
"immutable": "^5.0.2",
|
"immutable": "^5.0.2",
|
||||||
@@ -14048,6 +14258,12 @@
|
|||||||
"url": "https://opencollective.com/express"
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/set-blocking": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
"node_modules/setprototypeof": {
|
"node_modules/setprototypeof": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||||
@@ -14808,8 +15024,7 @@
|
|||||||
"version": "2.8.1",
|
"version": "2.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
"license": "0BSD",
|
"license": "0BSD"
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/tsyringe": {
|
"node_modules/tsyringe": {
|
||||||
"version": "4.10.0",
|
"version": "4.10.0",
|
||||||
@@ -14905,7 +15120,6 @@
|
|||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@@ -14920,7 +15134,6 @@
|
|||||||
"integrity": "sha512-pJw051uomb3ZeCzGTpRb8RbEqB5Y4WWet8gl/GcTlU35BSx0PVdZ86/bqkQCyKKuraVQEK7r6kBHQXF+fBhkoQ==",
|
"integrity": "sha512-pJw051uomb3ZeCzGTpRb8RbEqB5Y4WWet8gl/GcTlU35BSx0PVdZ86/bqkQCyKKuraVQEK7r6kBHQXF+fBhkoQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "8.59.2",
|
"@typescript-eslint/eslint-plugin": "8.59.2",
|
||||||
"@typescript-eslint/parser": "8.59.2",
|
"@typescript-eslint/parser": "8.59.2",
|
||||||
@@ -15259,7 +15472,6 @@
|
|||||||
"integrity": "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==",
|
"integrity": "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.27.0 || ^0.28.0",
|
"esbuild": "^0.27.0 || ^0.28.0",
|
||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
@@ -15350,7 +15562,6 @@
|
|||||||
"integrity": "sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==",
|
"integrity": "sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vitest/expect": "4.1.10",
|
"@vitest/expect": "4.1.10",
|
||||||
"@vitest/mocker": "4.1.10",
|
"@vitest/mocker": "4.1.10",
|
||||||
@@ -15473,7 +15684,6 @@
|
|||||||
"integrity": "sha512-dRXm0a2qcHPUBEzVk8uph0xWSjV/xZxenQQbLwnwP7caQCYpqG1qddwlyEkIDkYn0K8tvmcrZ+bOrzoQ3HxCDw==",
|
"integrity": "sha512-dRXm0a2qcHPUBEzVk8uph0xWSjV/xZxenQQbLwnwP7caQCYpqG1qddwlyEkIDkYn0K8tvmcrZ+bOrzoQ3HxCDw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/eslint-scope": "^3.7.7",
|
"@types/eslint-scope": "^3.7.7",
|
||||||
"@types/estree": "^1.0.8",
|
"@types/estree": "^1.0.8",
|
||||||
@@ -16187,6 +16397,12 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/which-module": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
"node_modules/why-is-node-running": {
|
"node_modules/why-is-node-running": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
|
||||||
@@ -16225,7 +16441,6 @@
|
|||||||
"version": "6.2.0",
|
"version": "6.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
||||||
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-styles": "^4.0.0",
|
"ansi-styles": "^4.0.0",
|
||||||
@@ -16240,7 +16455,6 @@
|
|||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -16250,7 +16464,6 @@
|
|||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"color-convert": "^2.0.1"
|
"color-convert": "^2.0.1"
|
||||||
@@ -16266,14 +16479,12 @@
|
|||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": {
|
"node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -16283,7 +16494,6 @@
|
|||||||
"version": "4.2.3",
|
"version": "4.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"emoji-regex": "^8.0.0",
|
"emoji-regex": "^8.0.0",
|
||||||
@@ -16298,7 +16508,6 @@
|
|||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-regex": "^5.0.1"
|
"ansi-regex": "^5.0.1"
|
||||||
@@ -16477,7 +16686,6 @@
|
|||||||
"integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",
|
"integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/colinhacks"
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
}
|
}
|
||||||
@@ -16496,8 +16704,7 @@
|
|||||||
"version": "0.15.1",
|
"version": "0.15.1",
|
||||||
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.15.1.tgz",
|
||||||
"integrity": "sha512-XE96n56IQpJM7NAoXswY3XRLcWFW83xe0BiAOeMD7K5k5xecOeul3Qcpx6GqEeeHNkW5DWL5zOyTbEfB4eti8w==",
|
"integrity": "sha512-XE96n56IQpJM7NAoXswY3XRLcWFW83xe0BiAOeMD7K5k5xecOeul3Qcpx6GqEeeHNkW5DWL5zOyTbEfB4eti8w==",
|
||||||
"license": "MIT",
|
"license": "MIT"
|
||||||
"peer": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
"dompurify": "^3.4.1",
|
"dompurify": "^3.4.1",
|
||||||
"lucide-angular": "^1.0.0",
|
"lucide-angular": "^1.0.0",
|
||||||
"marked": "^18.0.2",
|
"marked": "^18.0.2",
|
||||||
|
"qrcode": "^1.5.4",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"zone.js": "~0.15.1"
|
"zone.js": "~0.15.1"
|
||||||
@@ -46,6 +47,7 @@
|
|||||||
"@emnapi/runtime": "^1.11.0",
|
"@emnapi/runtime": "^1.11.0",
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@playwright/test": "^1.59.1",
|
"@playwright/test": "^1.59.1",
|
||||||
|
"@types/qrcode": "^1.5.6",
|
||||||
"@vitest/coverage-v8": "^4.1.9",
|
"@vitest/coverage-v8": "^4.1.9",
|
||||||
"angular-eslint": "21.4.0",
|
"angular-eslint": "21.4.0",
|
||||||
"eslint": "^10.3.0",
|
"eslint": "^10.3.0",
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ export const routes: Routes = [
|
|||||||
{ path: 'game-systems/:id/edit', loadComponent: () => import('./game-systems/game-system-edit/game-system-edit.component').then(m => m.GameSystemEditComponent) },
|
{ path: 'game-systems/:id/edit', loadComponent: () => import('./game-systems/game-system-edit/game-system-edit.component').then(m => m.GameSystemEditComponent) },
|
||||||
// Routes masquees en mode demo : ajouter canActivate: [hiddenInDemoGuard]
|
// Routes masquees en mode demo : ajouter canActivate: [hiddenInDemoGuard]
|
||||||
// (a prevoir aussi sur la future route d'export VTT).
|
// (a prevoir aussi sur la future route d'export VTT).
|
||||||
|
// Accès distant (mode bureau) : appairage d'une tablette par code.
|
||||||
|
{ path: 'pair', loadComponent: () => import('./remote-access/remote-pair/remote-pair.component').then(m => m.RemotePairComponent) },
|
||||||
{ path: 'settings', canActivate: [hiddenInDemoGuard], loadComponent: () => import('./settings/settings.component').then(m => m.SettingsComponent) },
|
{ path: 'settings', canActivate: [hiddenInDemoGuard], loadComponent: () => import('./settings/settings.component').then(m => m.SettingsComponent) },
|
||||||
{ path: '', redirectTo: '/lore', pathMatch: 'full' }
|
{ path: '', redirectTo: '/lore', pathMatch: 'full' }
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { HttpErrorResponse, HttpInterceptorFn } from '@angular/common/http';
|
||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { catchError, throwError } from 'rxjs';
|
||||||
|
import { REMOTE_PAIRING_REQUIRED } from '../services/remote-access.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accès distant (tablette sur le réseau local) : quand le Core répond
|
||||||
|
* `401 remote_pairing_required`, l'appareil n'est pas (ou plus) appairé — on bascule
|
||||||
|
* sur l'écran d'appairage en retenant la page demandée. Inerte sur le PC et en Docker,
|
||||||
|
* où ce code d'erreur n'existe pas.
|
||||||
|
*/
|
||||||
|
export const remotePairingInterceptor: HttpInterceptorFn = (req, next) => {
|
||||||
|
const router = inject(Router);
|
||||||
|
return next(req).pipe(
|
||||||
|
catchError((err) => {
|
||||||
|
if (err instanceof HttpErrorResponse && err.status === 401 && err.error?.error === REMOTE_PAIRING_REQUIRED
|
||||||
|
&& !router.url.startsWith('/pair')) {
|
||||||
|
router.navigate(['/pair'], { queryParams: { returnUrl: router.url } });
|
||||||
|
}
|
||||||
|
return throwError(() => err);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<div class="pair-screen">
|
||||||
|
<main class="pair-card">
|
||||||
|
<div class="pair-icon" aria-hidden="true">
|
||||||
|
<lucide-icon [img]="Tablet" [size]="28"></lucide-icon>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (onHost) {
|
||||||
|
<h1>{{ 'remoteAccess.pair.onHostTitle' | translate }}</h1>
|
||||||
|
<p class="pair-text">{{ 'remoteAccess.pair.onHostText' | translate }}</p>
|
||||||
|
<a class="btn-primary pair-link" [routerLink]="['/settings']" [queryParams]="{ section: 'remote-access' }">
|
||||||
|
{{ 'remoteAccess.pair.onHostLink' | translate }}
|
||||||
|
</a>
|
||||||
|
} @else {
|
||||||
|
<h1>{{ 'remoteAccess.pair.title' | translate }}</h1>
|
||||||
|
<p class="pair-text">{{ 'remoteAccess.pair.text' | translate }}</p>
|
||||||
|
|
||||||
|
<form class="pair-form" (ngSubmit)="submit()">
|
||||||
|
<div class="field">
|
||||||
|
<label for="pair-code">{{ 'remoteAccess.pair.codeLabel' | translate }}</label>
|
||||||
|
<!-- Pas de ngModel : on réécrit le champ à chaque frappe pour n'y laisser
|
||||||
|
que des chiffres (ngModel ne rafraîchit pas la vue si la valeur nettoyée ne change pas).
|
||||||
|
Pas de maxlength : il couperait « 123 456 » collé AVANT le nettoyage. -->
|
||||||
|
<input id="pair-code" name="code" class="code-input"
|
||||||
|
inputmode="numeric" autocomplete="one-time-code"
|
||||||
|
[value]="code" (input)="onCodeInput($event)"
|
||||||
|
placeholder="000000" />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="pair-name">{{ 'remoteAccess.pair.nameLabel' | translate }}</label>
|
||||||
|
<input id="pair-name" name="deviceName" maxlength="100" [(ngModel)]="deviceName" />
|
||||||
|
<p class="field-hint">{{ 'remoteAccess.pair.nameHint' | translate }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (error) {
|
||||||
|
<p class="pair-error" role="alert">{{ error }}</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<button type="submit" class="btn-primary pair-submit" [disabled]="!canSubmit">
|
||||||
|
<lucide-icon [img]="Check" [size]="16"></lucide-icon>
|
||||||
|
{{ (submitting ? 'remoteAccess.pair.submitting' : 'remoteAccess.pair.submit') | translate }}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
// Recouvre tout le shell (menus compris) : sans appairage, rien d'autre n'est utilisable.
|
||||||
|
.pair-screen {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 2000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 1rem;
|
||||||
|
background: #0a0a14;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-card {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 420px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.75rem 1.5rem;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #111827;
|
||||||
|
border: 1px solid #1f2937;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.35rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: white;
|
||||||
|
text-wrap: balance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-icon {
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
border-radius: 12px;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
background: rgba(108, 99, 255, 0.15);
|
||||||
|
color: #a5b4fc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-text {
|
||||||
|
margin: 0;
|
||||||
|
color: #d1d5db;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gros chiffres espacés : se lit et se tape facilement au doigt.
|
||||||
|
.code-input {
|
||||||
|
font-size: 1.8rem !important;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
letter-spacing: 0.5em;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0.6rem 0 0.6rem 0.5em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-error {
|
||||||
|
margin: 0;
|
||||||
|
color: #fca5a5;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pair-submit,
|
||||||
|
.pair-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
min-height: 48px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
|
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||||
|
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||||
|
import { LucideAngularModule, Tablet, Check } from 'lucide-angular';
|
||||||
|
|
||||||
|
import { RemoteAccessService } from '../../services/remote-access.service';
|
||||||
|
import { guessDeviceKey, normalizeCode, safeReturnUrl } from './remote-pair.helpers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Écran d'appairage d'une tablette (accès distant, mode bureau). Recouvre toute l'appli :
|
||||||
|
* tant que l'appareil n'est pas reconnu, rien d'autre n'est accessible depuis le réseau.
|
||||||
|
* Le QR code affiché sur le PC ouvre `/pair?code=123456` : le code est alors pré-rempli.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'app-remote-pair',
|
||||||
|
imports: [FormsModule, RouterLink, TranslatePipe, LucideAngularModule],
|
||||||
|
templateUrl: './remote-pair.component.html',
|
||||||
|
styleUrls: ['./remote-pair.component.scss']
|
||||||
|
})
|
||||||
|
export class RemotePairComponent implements OnInit {
|
||||||
|
readonly Tablet = Tablet;
|
||||||
|
readonly Check = Check;
|
||||||
|
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly remoteAccess = inject(RemoteAccessService);
|
||||||
|
private readonly translate = inject(TranslateService);
|
||||||
|
|
||||||
|
code = '';
|
||||||
|
deviceName = '';
|
||||||
|
submitting = false;
|
||||||
|
error: string | null = null;
|
||||||
|
/** Ouvert sur le PC lui-même : rien à appairer. */
|
||||||
|
onHost = false;
|
||||||
|
private returnUrl = '/';
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
const params = this.route.snapshot.queryParamMap;
|
||||||
|
this.code = normalizeCode(params.get('code'));
|
||||||
|
this.returnUrl = safeReturnUrl(params.get('returnUrl'));
|
||||||
|
this.deviceName = this.translate.instant(guessDeviceKey(navigator.userAgent));
|
||||||
|
|
||||||
|
this.remoteAccess.session().subscribe(session => {
|
||||||
|
if (!session.remote) this.onHost = true;
|
||||||
|
else if (session.paired) this.router.navigateByUrl(this.returnUrl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get canSubmit(): boolean {
|
||||||
|
return /^\d{6}$/.test(this.code) && !this.submitting;
|
||||||
|
}
|
||||||
|
|
||||||
|
onCodeInput(event: Event): void {
|
||||||
|
const input = event.target as HTMLInputElement;
|
||||||
|
this.code = normalizeCode(input.value);
|
||||||
|
input.value = this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
submit(): void {
|
||||||
|
if (!this.canSubmit) return;
|
||||||
|
this.submitting = true;
|
||||||
|
this.error = null;
|
||||||
|
this.remoteAccess.pair(this.code, this.deviceName).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.remoteAccess.resetSession();
|
||||||
|
this.router.navigateByUrl(this.returnUrl);
|
||||||
|
},
|
||||||
|
error: (err: HttpErrorResponse) => {
|
||||||
|
this.submitting = false;
|
||||||
|
this.error = this.translate.instant(err.status === 403 ? 'remoteAccess.pair.rejected' : 'remoteAccess.pair.failed');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { guessDeviceKey, normalizeCode, safeReturnUrl } from './remote-pair.helpers';
|
||||||
|
|
||||||
|
describe('safeReturnUrl', () => {
|
||||||
|
it('keeps internal paths', () => {
|
||||||
|
expect(safeReturnUrl('/campaigns/7')).toBe('/campaigns/7');
|
||||||
|
expect(safeReturnUrl('/sessions/19?tab=dice')).toBe('/sessions/19?tab=dice');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects external or looping targets', () => {
|
||||||
|
for (const bad of [null, '', 'https://evil.example', '//evil.example', '/\\evil.example', '/pair', '/pair?code=1']) {
|
||||||
|
expect(safeReturnUrl(bad)).toBe('/');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('guessDeviceKey', () => {
|
||||||
|
it('recognizes tablets, phones and the rest', () => {
|
||||||
|
expect(guessDeviceKey('Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X)')).toBe('remoteAccess.pair.defaultTablet');
|
||||||
|
expect(guessDeviceKey('Mozilla/5.0 (Linux; Android 14; SM-X710) Safari')).toBe('remoteAccess.pair.defaultTablet');
|
||||||
|
expect(guessDeviceKey('Mozilla/5.0 (Linux; Android 14; Pixel 8) Mobile Safari')).toBe('remoteAccess.pair.defaultPhone');
|
||||||
|
expect(guessDeviceKey('Mozilla/5.0 (iPhone; CPU iPhone OS 17_0)')).toBe('remoteAccess.pair.defaultPhone');
|
||||||
|
expect(guessDeviceKey('Mozilla/5.0 (Windows NT 10.0; Win64; x64)')).toBe('remoteAccess.pair.defaultDevice');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('normalizeCode', () => {
|
||||||
|
it('keeps at most six digits', () => {
|
||||||
|
expect(normalizeCode('123 456')).toBe('123456');
|
||||||
|
expect(normalizeCode('12a3-45678')).toBe('123456');
|
||||||
|
expect(normalizeCode(null)).toBe('');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Logique pure de l'écran d'appairage (testée sans Angular).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Uniquement un chemin interne : jamais d'URL absolue (pas de redirection vers un autre site). */
|
||||||
|
export function safeReturnUrl(value: string | null): string {
|
||||||
|
return value && value.startsWith('/') && !value.startsWith('//') && !value.startsWith('/\\')
|
||||||
|
&& !value.startsWith('/pair') ? value : '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Nom proposé par défaut pour l'appareil (clé i18n), d'après le navigateur. */
|
||||||
|
export function guessDeviceKey(userAgent: string): string {
|
||||||
|
const ua = userAgent.toLowerCase();
|
||||||
|
if (ua.includes('ipad') || (ua.includes('android') && !ua.includes('mobile')) || ua.includes('tablet')) {
|
||||||
|
return 'remoteAccess.pair.defaultTablet';
|
||||||
|
}
|
||||||
|
if (ua.includes('iphone') || ua.includes('android')) return 'remoteAccess.pair.defaultPhone';
|
||||||
|
return 'remoteAccess.pair.defaultDevice';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Ne garde que les chiffres, 6 au plus (saisie du code ou paramètre d'URL du QR code). */
|
||||||
|
export function normalizeCode(value: string | null | undefined): string {
|
||||||
|
return (value ?? '').replace(/\D/g, '').slice(0, 6);
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Observable, catchError, of, shareReplay } from 'rxjs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accès distant à l'application de bureau (tablette / téléphone sur le réseau local).
|
||||||
|
* Côté PC : réglage, code d'appairage, appareils (routes /api/settings/remote-access,
|
||||||
|
* réservées à la machine). Côté tablette : appairage et état de la session.
|
||||||
|
* En Docker ces routes n'existent pas (404) : l'écran Paramètres masque alors la section.
|
||||||
|
*/
|
||||||
|
export interface PairedDevice {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
userAgent?: string | null;
|
||||||
|
createdAt?: string | null;
|
||||||
|
lastSeenAt?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RemoteAccessStatus {
|
||||||
|
enabled: boolean;
|
||||||
|
port: number;
|
||||||
|
running: boolean;
|
||||||
|
urls: string[];
|
||||||
|
lastError?: string | null;
|
||||||
|
devices: PairedDevice[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PairingCode {
|
||||||
|
code: string;
|
||||||
|
expiresAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RemoteSession {
|
||||||
|
/** Requête arrivée par le réseau local (tablette) plutôt que depuis le PC. */
|
||||||
|
remote: boolean;
|
||||||
|
paired: boolean;
|
||||||
|
deviceName?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Réponse d'erreur du filtre / des contrôleurs. */
|
||||||
|
export const REMOTE_PAIRING_REQUIRED = 'remote_pairing_required';
|
||||||
|
export const REMOTE_FORBIDDEN = 'remote_forbidden';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class RemoteAccessService {
|
||||||
|
|
||||||
|
private readonly adminUrl = '/api/settings/remote-access';
|
||||||
|
private session$?: Observable<RemoteSession>;
|
||||||
|
|
||||||
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
|
status(): Observable<RemoteAccessStatus> {
|
||||||
|
return this.http.get<RemoteAccessStatus>(this.adminUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
configure(enabled: boolean, port: number): Observable<RemoteAccessStatus> {
|
||||||
|
return this.http.put<RemoteAccessStatus>(this.adminUrl, { enabled, port });
|
||||||
|
}
|
||||||
|
|
||||||
|
newPairingCode(): Observable<PairingCode> {
|
||||||
|
return this.http.post<PairingCode>(`${this.adminUrl}/pairing-code`, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
revoke(deviceId: string): Observable<void> {
|
||||||
|
return this.http.delete<void>(`${this.adminUrl}/devices/${deviceId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
pair(code: string, deviceName: string): Observable<PairedDevice> {
|
||||||
|
return this.http.post<PairedDevice>('/api/remote-access/pair', { code, deviceName });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suis-je une tablette ? Mis en cache pour la durée de la page. Sans la route (Docker,
|
||||||
|
* ancienne version), on se considère sur la machine elle-même.
|
||||||
|
*/
|
||||||
|
session(): Observable<RemoteSession> {
|
||||||
|
this.session$ ??= this.http.get<RemoteSession>('/api/remote-access/session').pipe(
|
||||||
|
catchError(() => of({ remote: false, paired: true } as RemoteSession)),
|
||||||
|
shareReplay(1)
|
||||||
|
);
|
||||||
|
return this.session$;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** À appeler après un appairage : l'état de session a changé. */
|
||||||
|
resetSession(): void {
|
||||||
|
this.session$ = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
@if (status; as s) {
|
||||||
|
<section class="card remote-access" id="remote-access">
|
||||||
|
<h2>{{ 'remoteAccess.settings.title' | translate }}</h2>
|
||||||
|
<p class="hint">{{ 'remoteAccess.settings.hint' | translate }}</p>
|
||||||
|
|
||||||
|
@if (error || s.lastError) {
|
||||||
|
<div class="alert alert-error" role="alert">
|
||||||
|
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
|
||||||
|
<span>{{ error || s.lastError }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<label class="switch-row">
|
||||||
|
<input type="checkbox" [ngModel]="s.enabled" (ngModelChange)="toggle($event)" [disabled]="busy" />
|
||||||
|
<span>{{ 'remoteAccess.settings.enable' | translate }}</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
@if (!s.enabled) {
|
||||||
|
<p class="note">
|
||||||
|
<lucide-icon [img]="ShieldCheck" [size]="15"></lucide-icon>
|
||||||
|
{{ 'remoteAccess.settings.firewallNote' | translate }}
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (s.running) {
|
||||||
|
<div class="remote-block">
|
||||||
|
<h3>{{ 'remoteAccess.settings.addressTitle' | translate }}</h3>
|
||||||
|
@if (s.urls.length > 0) {
|
||||||
|
<ul class="url-list">
|
||||||
|
@for (url of s.urls; track url) {
|
||||||
|
<li><code>{{ url }}</code></li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
} @else {
|
||||||
|
<p class="note">{{ 'remoteAccess.settings.noAddress' | translate }}</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="remote-block">
|
||||||
|
<h3>{{ 'remoteAccess.settings.pairTitle' | translate }}</h3>
|
||||||
|
@if (pairing) {
|
||||||
|
<div class="pairing">
|
||||||
|
@if (qrDataUrl) {
|
||||||
|
<img class="qr" [src]="qrDataUrl" [alt]="'remoteAccess.settings.qrAlt' | translate" width="220" height="220" />
|
||||||
|
}
|
||||||
|
<div class="pairing-info">
|
||||||
|
<p class="pairing-steps">{{ 'remoteAccess.settings.pairSteps' | translate }}</p>
|
||||||
|
<div class="code" [attr.aria-label]="'remoteAccess.settings.codeAria' | translate: { code: pairing.code }">
|
||||||
|
{{ pairing.code.slice(0, 3) }} {{ pairing.code.slice(3) }}
|
||||||
|
</div>
|
||||||
|
<p class="expires">{{ 'remoteAccess.settings.expiresIn' | translate: { time: countdownLabel } }}</p>
|
||||||
|
<button type="button" class="btn-secondary" (click)="newCode()" [disabled]="busy">
|
||||||
|
<lucide-icon [img]="RefreshCw" [size]="14"></lucide-icon>
|
||||||
|
{{ 'remoteAccess.settings.newCode' | translate }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<button type="button" class="btn-primary" (click)="newCode()" [disabled]="busy">
|
||||||
|
<lucide-icon [img]="Tablet" [size]="16"></lucide-icon>
|
||||||
|
{{ 'remoteAccess.settings.connectDevice' | translate }}
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="remote-block">
|
||||||
|
<h3>{{ 'remoteAccess.settings.devicesTitle' | translate }}</h3>
|
||||||
|
@if (s.devices.length === 0) {
|
||||||
|
<p class="note">{{ 'remoteAccess.settings.noDevices' | translate }}</p>
|
||||||
|
} @else {
|
||||||
|
<ul class="device-list">
|
||||||
|
@for (d of s.devices; track d.id) {
|
||||||
|
<li>
|
||||||
|
<div class="device-info">
|
||||||
|
<span class="device-name">{{ d.name }}</span>
|
||||||
|
<span class="device-meta">{{ 'remoteAccess.settings.lastSeen' | translate: { date: formatDate(d.lastSeenAt) } }}</span>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn-icon-danger" (click)="revoke(d)"
|
||||||
|
[title]="'remoteAccess.settings.revoke' | translate"
|
||||||
|
[attr.aria-label]="('remoteAccess.settings.revoke' | translate) + ' : ' + d.name">
|
||||||
|
<lucide-icon [img]="Trash2" [size]="16"></lucide-icon>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<details class="advanced">
|
||||||
|
<summary>{{ 'remoteAccess.settings.advanced' | translate }}</summary>
|
||||||
|
<div class="port-row">
|
||||||
|
<label for="remote-port">{{ 'remoteAccess.settings.portLabel' | translate }}</label>
|
||||||
|
<input id="remote-port" type="number" min="1024" max="65535" [(ngModel)]="port" />
|
||||||
|
<button type="button" class="btn-secondary" (click)="applyPort()" [disabled]="busy || port === s.port">
|
||||||
|
{{ 'remoteAccess.settings.applyPort' | translate }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p class="note">{{ 'remoteAccess.settings.outsideNote' | translate }}</p>
|
||||||
|
</details>
|
||||||
|
</section>
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
// Complète les styles partagés de la page Paramètres (.card, .hint, .alert).
|
||||||
|
.remote-access {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 0.5rem;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.45rem;
|
||||||
|
min-height: 44px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.7rem;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
input { accent-color: #6c63ff; width: 20px; height: 20px; margin: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.note {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.45rem;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
|
||||||
|
lucide-icon { flex-shrink: 0; margin-top: 0.15rem; color: #86efac; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.remote-block {
|
||||||
|
padding-top: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.url-list {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-size: 1.05rem;
|
||||||
|
color: #c7d2fe;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pairing {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr {
|
||||||
|
border-radius: 8px;
|
||||||
|
background: white;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pairing-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.5rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pairing-steps {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: rgba(255, 255, 255, 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
.code {
|
||||||
|
font-size: 2.2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.12em;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expires {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: rgba(255, 255, 255, 0.55);
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-list {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.4rem;
|
||||||
|
|
||||||
|
li {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.55rem 0.75rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-info {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-name { font-weight: 600; overflow-wrap: anywhere; }
|
||||||
|
.device-meta { font-size: 0.8rem; color: rgba(255, 255, 255, 0.5); }
|
||||||
|
|
||||||
|
.btn-icon-danger {
|
||||||
|
justify-content: center;
|
||||||
|
width: 44px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: transparent;
|
||||||
|
color: #fca5a5;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover { background: rgba(239, 68, 68, 0.12); }
|
||||||
|
&:focus-visible { outline: 2px solid #6c63ff; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.advanced {
|
||||||
|
summary {
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
min-height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[open] summary { margin-bottom: 0.75rem; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.port-row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.6rem;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 8rem;
|
||||||
|
padding: 0.6rem 0.8rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid #374151;
|
||||||
|
background: #1f2937;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,185 @@
|
|||||||
|
import { Component, ElementRef, OnDestroy, OnInit, inject } from '@angular/core';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||||
|
import { LucideAngularModule, Tablet, Trash2, RefreshCw, AlertCircle, ShieldCheck } from 'lucide-angular';
|
||||||
|
import QRCode from 'qrcode';
|
||||||
|
|
||||||
|
import {
|
||||||
|
PairedDevice, PairingCode, RemoteAccessService, RemoteAccessStatus
|
||||||
|
} from '../../services/remote-access.service';
|
||||||
|
import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètres > Accès depuis une tablette (mode bureau). Active le connecteur réseau local,
|
||||||
|
* affiche l'adresse + un code d'appairage (et son QR code), liste les appareils appairés.
|
||||||
|
* Masquée quand le Core ne connaît pas ces routes (Docker : 404).
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'app-remote-access-section',
|
||||||
|
imports: [FormsModule, TranslatePipe, LucideAngularModule],
|
||||||
|
templateUrl: './remote-access-section.component.html',
|
||||||
|
styleUrls: ['../settings.component.scss', './remote-access-section.component.scss']
|
||||||
|
})
|
||||||
|
export class RemoteAccessSectionComponent implements OnInit, OnDestroy {
|
||||||
|
readonly Tablet = Tablet;
|
||||||
|
readonly Trash2 = Trash2;
|
||||||
|
readonly RefreshCw = RefreshCw;
|
||||||
|
readonly AlertCircle = AlertCircle;
|
||||||
|
readonly ShieldCheck = ShieldCheck;
|
||||||
|
|
||||||
|
private readonly remoteAccess = inject(RemoteAccessService);
|
||||||
|
private readonly translate = inject(TranslateService);
|
||||||
|
private readonly confirmDialog = inject(ConfirmDialogService);
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly host = inject(ElementRef<HTMLElement>);
|
||||||
|
|
||||||
|
/** Null tant que non chargé, ou si la fonctionnalité n'existe pas (Docker). */
|
||||||
|
status: RemoteAccessStatus | null = null;
|
||||||
|
port = 0;
|
||||||
|
busy = false;
|
||||||
|
error: string | null = null;
|
||||||
|
|
||||||
|
pairing: PairingCode | null = null;
|
||||||
|
qrDataUrl: string | null = null;
|
||||||
|
secondsLeft = 0;
|
||||||
|
private countdown?: ReturnType<typeof setInterval>;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.remoteAccess.status().subscribe({
|
||||||
|
next: status => {
|
||||||
|
this.apply(status);
|
||||||
|
if (this.route.snapshot.queryParamMap.get('section') === 'remote-access') {
|
||||||
|
setTimeout(() => this.host.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'start' }));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: () => { this.status = null; }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.stopCountdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
get primaryUrl(): string | null {
|
||||||
|
return this.status?.urls[0] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle(enabled: boolean): void {
|
||||||
|
this.save(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
applyPort(): void {
|
||||||
|
this.save(this.status?.enabled ?? false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private save(enabled: boolean): void {
|
||||||
|
if (!this.status || this.busy) return;
|
||||||
|
this.busy = true;
|
||||||
|
this.error = null;
|
||||||
|
this.remoteAccess.configure(enabled, Number(this.port)).subscribe({
|
||||||
|
next: status => {
|
||||||
|
this.busy = false;
|
||||||
|
this.apply(status);
|
||||||
|
if (!status.running) this.clearPairing();
|
||||||
|
},
|
||||||
|
error: (err: HttpErrorResponse) => {
|
||||||
|
this.busy = false;
|
||||||
|
this.error = err.error?.error ?? this.translate.instant('remoteAccess.settings.saveError');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
newCode(): void {
|
||||||
|
if (this.busy) return;
|
||||||
|
this.busy = true;
|
||||||
|
this.error = null;
|
||||||
|
this.remoteAccess.newPairingCode().subscribe({
|
||||||
|
next: async code => {
|
||||||
|
this.busy = false;
|
||||||
|
this.pairing = code;
|
||||||
|
this.startCountdown();
|
||||||
|
await this.renderQr(code.code);
|
||||||
|
},
|
||||||
|
error: (err: HttpErrorResponse) => {
|
||||||
|
this.busy = false;
|
||||||
|
this.error = err.error?.error ?? this.translate.instant('remoteAccess.settings.codeError');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async revoke(device: PairedDevice): Promise<void> {
|
||||||
|
const ok = await this.confirmDialog.confirm({
|
||||||
|
title: this.translate.instant('remoteAccess.settings.revokeTitle'),
|
||||||
|
message: this.translate.instant('remoteAccess.settings.revokeMessage', { name: device.name }),
|
||||||
|
confirmLabel: this.translate.instant('remoteAccess.settings.revoke'),
|
||||||
|
variant: 'danger'
|
||||||
|
});
|
||||||
|
if (!ok) return;
|
||||||
|
this.remoteAccess.revoke(device.id).subscribe({
|
||||||
|
next: () => {
|
||||||
|
if (this.status) this.status = { ...this.status, devices: this.status.devices.filter(d => d.id !== device.id) };
|
||||||
|
},
|
||||||
|
error: () => { this.error = this.translate.instant('remoteAccess.settings.revokeError'); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh(): void {
|
||||||
|
this.remoteAccess.status().subscribe({ next: s => this.apply(s), error: () => undefined });
|
||||||
|
}
|
||||||
|
|
||||||
|
formatDate(value?: string | null): string {
|
||||||
|
if (!value) return '—';
|
||||||
|
const lang = this.translate.currentLang;
|
||||||
|
return new Date(value).toLocaleString(lang ? String(lang) : undefined, { dateStyle: 'medium', timeStyle: 'short' });
|
||||||
|
}
|
||||||
|
|
||||||
|
private apply(status: RemoteAccessStatus): void {
|
||||||
|
this.status = status;
|
||||||
|
this.port = status.port;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Le QR code ouvre directement l'écran d'appairage avec le code pré-rempli. */
|
||||||
|
private async renderQr(code: string): Promise<void> {
|
||||||
|
this.qrDataUrl = null;
|
||||||
|
if (!this.primaryUrl) return;
|
||||||
|
try {
|
||||||
|
this.qrDataUrl = await QRCode.toDataURL(`${this.primaryUrl}/pair?code=${code}`,
|
||||||
|
{ margin: 1, width: 220, color: { dark: '#111827', light: '#ffffff' } });
|
||||||
|
} catch {
|
||||||
|
this.qrDataUrl = null; // le code et l'adresse restent affichés
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private startCountdown(): void {
|
||||||
|
this.stopCountdown();
|
||||||
|
const tick = () => {
|
||||||
|
const left = this.pairing ? Math.max(0, Math.round((Date.parse(this.pairing.expiresAt) - Date.now()) / 1000)) : 0;
|
||||||
|
this.secondsLeft = left;
|
||||||
|
if (left === 0) {
|
||||||
|
this.clearPairing();
|
||||||
|
this.refresh(); // l'appareil vient peut-être de s'appairer
|
||||||
|
}
|
||||||
|
};
|
||||||
|
tick();
|
||||||
|
this.countdown = setInterval(tick, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private stopCountdown(): void {
|
||||||
|
if (this.countdown) clearInterval(this.countdown);
|
||||||
|
this.countdown = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
private clearPairing(): void {
|
||||||
|
this.stopCountdown();
|
||||||
|
this.pairing = null;
|
||||||
|
this.qrDataUrl = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get countdownLabel(): string {
|
||||||
|
const m = Math.floor(this.secondsLeft / 60);
|
||||||
|
const s = String(this.secondsLeft % 60).padStart(2, '0');
|
||||||
|
return `${m}:${s}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@if (remoteDevice) {
|
||||||
|
<div class="alert alert-warn">
|
||||||
|
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
|
||||||
|
<span>{{ 'remoteAccess.settings.onDevice' | translate }}</span>
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<!-- Accès depuis une tablette (mode bureau ; masqué en Docker). -->
|
||||||
|
<app-remote-access-section></app-remote-access-section>
|
||||||
|
}
|
||||||
|
|
||||||
@if (errorMessage) {
|
@if (errorMessage) {
|
||||||
<div class="alert alert-error">
|
<div class="alert alert-error">
|
||||||
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
|
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import { UpdatesSectionComponent } from './updates-section/updates-section.compo
|
|||||||
import { OllamaModelManagerComponent } from './ollama-model-manager/ollama-model-manager.component';
|
import { OllamaModelManagerComponent } from './ollama-model-manager/ollama-model-manager.component';
|
||||||
import { LanguageSwitcherComponent } from '../shared/language-switcher/language-switcher.component';
|
import { LanguageSwitcherComponent } from '../shared/language-switcher/language-switcher.component';
|
||||||
import { FileDropDirective } from '../shared/file-drop.directive';
|
import { FileDropDirective } from '../shared/file-drop.directive';
|
||||||
|
import { RemoteAccessSectionComponent } from './remote-access-section/remote-access-section.component';
|
||||||
|
import { RemoteAccessService } from '../services/remote-access.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ecran de parametrage du LLM utilise par le Brain.
|
* Ecran de parametrage du LLM utilise par le Brain.
|
||||||
@@ -29,7 +31,7 @@ import { FileDropDirective } from '../shared/file-drop.directive';
|
|||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-settings',
|
selector: 'app-settings',
|
||||||
imports: [CommonModule, FormsModule, LucideAngularModule, TranslatePipe, UpdatesSectionComponent, OllamaModelManagerComponent, LanguageSwitcherComponent, FileDropDirective],
|
imports: [CommonModule, FormsModule, LucideAngularModule, TranslatePipe, UpdatesSectionComponent, OllamaModelManagerComponent, LanguageSwitcherComponent, FileDropDirective, RemoteAccessSectionComponent],
|
||||||
templateUrl: './settings.component.html',
|
templateUrl: './settings.component.html',
|
||||||
styleUrls: ['./settings.component.scss']
|
styleUrls: ['./settings.component.scss']
|
||||||
})
|
})
|
||||||
@@ -100,14 +102,21 @@ export class SettingsComponent implements OnInit {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
private layoutService: LayoutService,
|
private layoutService: LayoutService,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private campaignService: CampaignService
|
private campaignService: CampaignService,
|
||||||
|
private remoteAccess: RemoteAccessService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
/** Ouvert depuis une tablette (accès distant) : les Paramètres restent réservés au PC. */
|
||||||
|
remoteDevice = false;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// Page racine : on s'assure de ne pas heriter de la sidebar d'une
|
// Page racine : on s'assure de ne pas heriter de la sidebar d'une
|
||||||
// section precedente (cf. fix CampaignsComponent / LoreComponent).
|
// section precedente (cf. fix CampaignsComponent / LoreComponent).
|
||||||
this.layoutService.hide();
|
this.layoutService.hide();
|
||||||
this.loadSettings();
|
this.remoteAccess.session().subscribe(session => {
|
||||||
|
this.remoteDevice = session.remote;
|
||||||
|
if (!session.remote) this.loadSettings();
|
||||||
|
});
|
||||||
// Campagnes proposées pour un export ciblé (silencieux en cas d'échec).
|
// Campagnes proposées pour un export ciblé (silencieux en cas d'échec).
|
||||||
this.campaignService.getAllCampaigns().subscribe({
|
this.campaignService.getAllCampaigns().subscribe({
|
||||||
next: (list) => this.campaigns = list,
|
next: (list) => this.campaigns = list,
|
||||||
|
|||||||
@@ -2385,5 +2385,53 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"remoteAccess": {
|
||||||
|
"settings": {
|
||||||
|
"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.",
|
||||||
|
"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.",
|
||||||
|
"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.",
|
||||||
|
"pairTitle": "Connect a device",
|
||||||
|
"connectDevice": "Connect a device",
|
||||||
|
"pairSteps": "On the tablet, scan the QR code, or open the address above and enter this code:",
|
||||||
|
"codeAria": "Pairing code {{code}}",
|
||||||
|
"qrAlt": "QR code to connect the tablet",
|
||||||
|
"expiresIn": "Valid for {{time}} more, for a single device",
|
||||||
|
"newCode": "New code",
|
||||||
|
"codeError": "Unable to create a pairing code.",
|
||||||
|
"saveError": "Unable to save the setting.",
|
||||||
|
"devicesTitle": "Authorized devices",
|
||||||
|
"noDevices": "No authorized device yet.",
|
||||||
|
"lastSeen": "Last connection: {{date}}",
|
||||||
|
"revoke": "Remove access",
|
||||||
|
"revokeTitle": "Remove access?",
|
||||||
|
"revokeMessage": "\"{{name}}\" will no longer be able to access DM Loremind. A new code will be needed to reconnect it.",
|
||||||
|
"revokeError": "Unable to remove this device's access.",
|
||||||
|
"advanced": "Advanced settings",
|
||||||
|
"portLabel": "Network port",
|
||||||
|
"applyPort": "Apply",
|
||||||
|
"outsideNote": "To reach it away from home (on 4G, at a friend's), the documentation explains how to use Tailscale, a free encrypted private network. Don't open this port to the Internet on your router.",
|
||||||
|
"onDevice": "You are connected from a tablet: settings can only be changed on the PC where DM Loremind is installed."
|
||||||
|
},
|
||||||
|
"pair": {
|
||||||
|
"title": "Connect this device",
|
||||||
|
"text": "On the PC, open Settings > Access from a tablet, then \"Connect a device\". Enter the 6-digit code shown there.",
|
||||||
|
"codeLabel": "Pairing code",
|
||||||
|
"nameLabel": "Name of this device",
|
||||||
|
"nameHint": "To recognize it in the list of authorized devices.",
|
||||||
|
"submit": "Connect",
|
||||||
|
"submitting": "Connecting…",
|
||||||
|
"rejected": "Code rejected: check it, or show a new code on the PC.",
|
||||||
|
"failed": "Connection failed. Check that the PC is on and on the same network.",
|
||||||
|
"defaultTablet": "Tablet",
|
||||||
|
"defaultPhone": "Phone",
|
||||||
|
"defaultDevice": "Device",
|
||||||
|
"onHostTitle": "You're on the PC",
|
||||||
|
"onHostText": "This page is for connecting a tablet. On this PC, access is managed from Settings.",
|
||||||
|
"onHostLink": "Open access settings"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2385,5 +2385,53 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"remoteAccess": {
|
||||||
|
"settings": {
|
||||||
|
"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.",
|
||||||
|
"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.",
|
||||||
|
"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.",
|
||||||
|
"pairTitle": "Connecter un appareil",
|
||||||
|
"connectDevice": "Connecter un appareil",
|
||||||
|
"pairSteps": "Sur la tablette, scanne le QR code, ou ouvre l'adresse ci-dessus et saisis ce code :",
|
||||||
|
"codeAria": "Code d'appairage {{code}}",
|
||||||
|
"qrAlt": "QR code pour connecter la tablette",
|
||||||
|
"expiresIn": "Valable encore {{time}}, pour un seul appareil",
|
||||||
|
"newCode": "Nouveau code",
|
||||||
|
"codeError": "Impossible de créer un code d'appairage.",
|
||||||
|
"saveError": "Impossible d'enregistrer le réglage.",
|
||||||
|
"devicesTitle": "Appareils autorisés",
|
||||||
|
"noDevices": "Aucun appareil autorisé pour le moment.",
|
||||||
|
"lastSeen": "Dernière connexion : {{date}}",
|
||||||
|
"revoke": "Retirer l'accès",
|
||||||
|
"revokeTitle": "Retirer l'accès ?",
|
||||||
|
"revokeMessage": "« {{name}} » ne pourra plus accéder à DM Loremind. Il faudra un nouveau code pour le reconnecter.",
|
||||||
|
"revokeError": "Impossible de retirer l'accès de cet appareil.",
|
||||||
|
"advanced": "Réglages avancés",
|
||||||
|
"portLabel": "Port réseau",
|
||||||
|
"applyPort": "Appliquer",
|
||||||
|
"outsideNote": "Pour y accéder hors de chez toi (en 4G, chez un ami), la documentation explique comment passer par Tailscale, un réseau privé chiffré et gratuit. N'ouvre pas ce port sur Internet depuis ta box.",
|
||||||
|
"onDevice": "Tu es connecté depuis une tablette : les paramètres se modifient uniquement sur le PC où DM Loremind est installé."
|
||||||
|
},
|
||||||
|
"pair": {
|
||||||
|
"title": "Connecter cet appareil",
|
||||||
|
"text": "Sur le PC, ouvre Paramètres > Accès depuis une tablette, puis « Connecter un appareil ». Saisis ici le code à 6 chiffres affiché.",
|
||||||
|
"codeLabel": "Code d'appairage",
|
||||||
|
"nameLabel": "Nom de cet appareil",
|
||||||
|
"nameHint": "Pour le reconnaître dans la liste des appareils autorisés.",
|
||||||
|
"submit": "Connecter",
|
||||||
|
"submitting": "Connexion…",
|
||||||
|
"rejected": "Code refusé : vérifie-le, ou affiche un nouveau code sur le PC.",
|
||||||
|
"failed": "La connexion a échoué. Vérifie que le PC est allumé et sur le même réseau.",
|
||||||
|
"defaultTablet": "Tablette",
|
||||||
|
"defaultPhone": "Téléphone",
|
||||||
|
"defaultDevice": "Appareil",
|
||||||
|
"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.",
|
||||||
|
"onHostLink": "Ouvrir les réglages d'accès"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"remoteAccess": {
|
||||||
|
"settings": {
|
||||||
|
"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.",
|
||||||
|
"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.",
|
||||||
|
"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.",
|
||||||
|
"pairTitle": "Connect a device",
|
||||||
|
"connectDevice": "Connect a device",
|
||||||
|
"pairSteps": "On the tablet, scan the QR code, or open the address above and enter this code:",
|
||||||
|
"codeAria": "Pairing code {{code}}",
|
||||||
|
"qrAlt": "QR code to connect the tablet",
|
||||||
|
"expiresIn": "Valid for {{time}} more, for a single device",
|
||||||
|
"newCode": "New code",
|
||||||
|
"codeError": "Unable to create a pairing code.",
|
||||||
|
"saveError": "Unable to save the setting.",
|
||||||
|
"devicesTitle": "Authorized devices",
|
||||||
|
"noDevices": "No authorized device yet.",
|
||||||
|
"lastSeen": "Last connection: {{date}}",
|
||||||
|
"revoke": "Remove access",
|
||||||
|
"revokeTitle": "Remove access?",
|
||||||
|
"revokeMessage": "\"{{name}}\" will no longer be able to access DM Loremind. A new code will be needed to reconnect it.",
|
||||||
|
"revokeError": "Unable to remove this device's access.",
|
||||||
|
"advanced": "Advanced settings",
|
||||||
|
"portLabel": "Network port",
|
||||||
|
"applyPort": "Apply",
|
||||||
|
"outsideNote": "To reach it away from home (on 4G, at a friend's), the documentation explains how to use Tailscale, a free encrypted private network. Don't open this port to the Internet on your router.",
|
||||||
|
"onDevice": "You are connected from a tablet: settings can only be changed on the PC where DM Loremind is installed."
|
||||||
|
},
|
||||||
|
"pair": {
|
||||||
|
"title": "Connect this device",
|
||||||
|
"text": "On the PC, open Settings > Access from a tablet, then \"Connect a device\". Enter the 6-digit code shown there.",
|
||||||
|
"codeLabel": "Pairing code",
|
||||||
|
"nameLabel": "Name of this device",
|
||||||
|
"nameHint": "To recognize it in the list of authorized devices.",
|
||||||
|
"submit": "Connect",
|
||||||
|
"submitting": "Connecting…",
|
||||||
|
"rejected": "Code rejected: check it, or show a new code on the PC.",
|
||||||
|
"failed": "Connection failed. Check that the PC is on and on the same network.",
|
||||||
|
"defaultTablet": "Tablet",
|
||||||
|
"defaultPhone": "Phone",
|
||||||
|
"defaultDevice": "Device",
|
||||||
|
"onHostTitle": "You're on the PC",
|
||||||
|
"onHostText": "This page is for connecting a tablet. On this PC, access is managed from Settings.",
|
||||||
|
"onHostLink": "Open access settings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"remoteAccess": {
|
||||||
|
"settings": {
|
||||||
|
"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.",
|
||||||
|
"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.",
|
||||||
|
"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.",
|
||||||
|
"pairTitle": "Connecter un appareil",
|
||||||
|
"connectDevice": "Connecter un appareil",
|
||||||
|
"pairSteps": "Sur la tablette, scanne le QR code, ou ouvre l'adresse ci-dessus et saisis ce code :",
|
||||||
|
"codeAria": "Code d'appairage {{code}}",
|
||||||
|
"qrAlt": "QR code pour connecter la tablette",
|
||||||
|
"expiresIn": "Valable encore {{time}}, pour un seul appareil",
|
||||||
|
"newCode": "Nouveau code",
|
||||||
|
"codeError": "Impossible de créer un code d'appairage.",
|
||||||
|
"saveError": "Impossible d'enregistrer le réglage.",
|
||||||
|
"devicesTitle": "Appareils autorisés",
|
||||||
|
"noDevices": "Aucun appareil autorisé pour le moment.",
|
||||||
|
"lastSeen": "Dernière connexion : {{date}}",
|
||||||
|
"revoke": "Retirer l'accès",
|
||||||
|
"revokeTitle": "Retirer l'accès ?",
|
||||||
|
"revokeMessage": "« {{name}} » ne pourra plus accéder à DM Loremind. Il faudra un nouveau code pour le reconnecter.",
|
||||||
|
"revokeError": "Impossible de retirer l'accès de cet appareil.",
|
||||||
|
"advanced": "Réglages avancés",
|
||||||
|
"portLabel": "Port réseau",
|
||||||
|
"applyPort": "Appliquer",
|
||||||
|
"outsideNote": "Pour y accéder hors de chez toi (en 4G, chez un ami), la documentation explique comment passer par Tailscale, un réseau privé chiffré et gratuit. N'ouvre pas ce port sur Internet depuis ta box.",
|
||||||
|
"onDevice": "Tu es connecté depuis une tablette : les paramètres se modifient uniquement sur le PC où DM Loremind est installé."
|
||||||
|
},
|
||||||
|
"pair": {
|
||||||
|
"title": "Connecter cet appareil",
|
||||||
|
"text": "Sur le PC, ouvre Paramètres > Accès depuis une tablette, puis « Connecter un appareil ». Saisis ici le code à 6 chiffres affiché.",
|
||||||
|
"codeLabel": "Code d'appairage",
|
||||||
|
"nameLabel": "Nom de cet appareil",
|
||||||
|
"nameHint": "Pour le reconnaître dans la liste des appareils autorisés.",
|
||||||
|
"submit": "Connecter",
|
||||||
|
"submitting": "Connexion…",
|
||||||
|
"rejected": "Code refusé : vérifie-le, ou affiche un nouveau code sur le PC.",
|
||||||
|
"failed": "La connexion a échoué. Vérifie que le PC est allumé et sur le même réseau.",
|
||||||
|
"defaultTablet": "Tablette",
|
||||||
|
"defaultPhone": "Téléphone",
|
||||||
|
"defaultDevice": "Appareil",
|
||||||
|
"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.",
|
||||||
|
"onHostLink": "Ouvrir les réglages d'accès"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -10,6 +10,7 @@ import { ConfigService } from './app/services/config.service';
|
|||||||
import { LanguageService } from './app/services/language.service';
|
import { LanguageService } from './app/services/language.service';
|
||||||
import { sessionExpiredInterceptor } from './app/interceptors/session-expired.interceptor';
|
import { sessionExpiredInterceptor } from './app/interceptors/session-expired.interceptor';
|
||||||
import { languageInterceptor } from './app/interceptors/language.interceptor';
|
import { languageInterceptor } from './app/interceptors/language.interceptor';
|
||||||
|
import { remotePairingInterceptor } from './app/interceptors/remote-pairing.interceptor';
|
||||||
|
|
||||||
// withPreloading(PreloadAllModules) : une fois l'app initiale rendue, Angular
|
// withPreloading(PreloadAllModules) : une fois l'app initiale rendue, Angular
|
||||||
// telecharge en arriere-plan tous les chunks lazy-loades. Consequence : la
|
// telecharge en arriere-plan tous les chunks lazy-loades. Consequence : la
|
||||||
@@ -19,7 +20,7 @@ import { languageInterceptor } from './app/interceptors/language.interceptor';
|
|||||||
bootstrapApplication(AppComponent, {
|
bootstrapApplication(AppComponent, {
|
||||||
providers: [
|
providers: [
|
||||||
provideZoneChangeDetection(),provideRouter(routes, withPreloading(PreloadAllModules)),
|
provideZoneChangeDetection(),provideRouter(routes, withPreloading(PreloadAllModules)),
|
||||||
provideHttpClient(withInterceptors([sessionExpiredInterceptor, languageInterceptor])),
|
provideHttpClient(withInterceptors([sessionExpiredInterceptor, languageInterceptor, remotePairingInterceptor])),
|
||||||
provideTranslateService({
|
provideTranslateService({
|
||||||
loader: provideTranslateHttpLoader({
|
loader: provideTranslateHttpLoader({
|
||||||
prefix: 'assets/i18n/',
|
prefix: 'assets/i18n/',
|
||||||
|
|||||||
Reference in New Issue
Block a user