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:
@@ -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) },
|
||||
// Routes masquees en mode demo : ajouter canActivate: [hiddenInDemoGuard]
|
||||
// (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: '', 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>
|
||||
</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) {
|
||||
<div class="alert alert-error">
|
||||
<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 { LanguageSwitcherComponent } from '../shared/language-switcher/language-switcher.component';
|
||||
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.
|
||||
@@ -29,7 +31,7 @@ import { FileDropDirective } from '../shared/file-drop.directive';
|
||||
*/
|
||||
@Component({
|
||||
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',
|
||||
styleUrls: ['./settings.component.scss']
|
||||
})
|
||||
@@ -100,14 +102,21 @@ export class SettingsComponent implements OnInit {
|
||||
private router: Router,
|
||||
private layoutService: LayoutService,
|
||||
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 {
|
||||
// Page racine : on s'assure de ne pas heriter de la sidebar d'une
|
||||
// section precedente (cf. fix CampaignsComponent / LoreComponent).
|
||||
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).
|
||||
this.campaignService.getAllCampaigns().subscribe({
|
||||
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 { sessionExpiredInterceptor } from './app/interceptors/session-expired.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
|
||||
// telecharge en arriere-plan tous les chunks lazy-loades. Consequence : la
|
||||
@@ -19,7 +20,7 @@ import { languageInterceptor } from './app/interceptors/language.interceptor';
|
||||
bootstrapApplication(AppComponent, {
|
||||
providers: [
|
||||
provideZoneChangeDetection(),provideRouter(routes, withPreloading(PreloadAllModules)),
|
||||
provideHttpClient(withInterceptors([sessionExpiredInterceptor, languageInterceptor])),
|
||||
provideHttpClient(withInterceptors([sessionExpiredInterceptor, languageInterceptor, remotePairingInterceptor])),
|
||||
provideTranslateService({
|
||||
loader: provideTranslateHttpLoader({
|
||||
prefix: 'assets/i18n/',
|
||||
|
||||
Reference in New Issue
Block a user