suppression de la partie patreon

This commit is contained in:
2026-10-29 09:28:48 +01:00
parent 1898e8b1ae
commit bf606c23d1
58 changed files with 627 additions and 2596 deletions
+1 -1
View File
@@ -379,7 +379,7 @@
</section>
}
<!-- Mises a jour conteneurs + licence Patreon + canal beta (sous-composant) -->
<!-- Mises a jour conteneurs + canal beta (sous-composant) -->
<app-settings-updates-section></app-settings-updates-section>
<!-- Sauvegarde / Restauration des donnees (export & import) -->
+1 -47
View File
@@ -456,53 +456,7 @@
gap: 6px;
}
// --- Section Patreon / canal beta ---------------------------------------
.license-info {
list-style: none;
margin: 12px 0 16px;
padding: 0;
display: flex;
flex-direction: column;
gap: 6px;
li {
font-size: 0.9rem;
padding: 6px 10px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 4px;
strong {
color: #c4b8e0;
margin-right: 6px;
}
}
}
.form-row-inline {
display: flex;
align-items: center;
gap: 12px;
margin-top: 12px;
}
.form-row-actions {
display: flex;
gap: 10px;
margin-top: 12px;
flex-wrap: wrap;
}
.btn-secondary.btn-danger {
border-color: rgba(220, 80, 80, 0.4);
color: #ff7878;
&:hover {
background: rgba(220, 80, 80, 0.12);
border-color: rgba(220, 80, 80, 0.6);
}
}
// --- Canal beta -----------------------------------------------------------
.beta-status {
margin-top: 16px;
+1 -1
View File
@@ -22,7 +22,7 @@ import { RemoteAccessService } from '../services/remote-access.service';
* cles API, embeddings RAG, fenetre de contexte, import PDF) + sa sauvegarde.
*
* Les responsabilites voisines sont des sous-composants standalone :
* - UpdatesSectionComponent : mises a jour conteneurs + licence Patreon + canal beta ;
* - UpdatesSectionComponent : mises a jour conteneurs + canal beta ;
* - OllamaModelManagerComponent : pull/suppression des modeles Ollama.
*
* Les modifications sont persistees cote Brain dans data/settings.json
@@ -1,14 +1,9 @@
<!-- Bloc Mises a jour (canal stable + canal beta Patreon fusionnes) -->
@if (config.updateCheckEnabled || licenseStatus?.enabled) {
<!-- Bloc Mises a jour (canal stable + canal beta) : Docker uniquement. En mode bureau,
ni Watchtower ni sidecar switcher : la section reste masquee. -->
@if (config.updateCheckEnabled || channelStatus?.switcherAvailable) {
<section class="card">
<h2>{{ 'updatesSection.title' | translate }}</h2>
<p class="hint">{{ 'updatesSection.hint' | translate }}</p>
@if (licenseSuccess) {
<div class="alert alert-success">
<lucide-icon [img]="Check" [size]="16"></lucide-icon>
<span>{{ licenseSuccess }}</span>
</div>
}
<!-- ====================================================== -->
<!-- Sous-section : canal stable -->
<!-- ====================================================== -->
@@ -64,201 +59,103 @@
</div>
}
<!-- ====================================================== -->
<!-- Sous-section : canal beta (Patreon) -->
<!-- Sous-section : canal beta (libre) -->
<!-- ====================================================== -->
@if (licenseStatus?.enabled) {
@if (channelStatus) {
<div class="channel-block">
<h3 class="channel-title">
<lucide-icon [img]="Heart" [size]="16"></lucide-icon>
<lucide-icon [img]="FlaskConical" [size]="16"></lucide-icon>
{{ 'updatesSection.betaChannelTitle' | translate }}
</h3>
<p class="hint" [innerHTML]="'updatesSection.betaChannelIntro' | translate"></p>
<!-- Pas de licence installee -->
@if (licenseStatus?.status === 'NONE') {
<div class="form-row">
<button type="button" class="btn-primary" (click)="connectPatreon()">
<lucide-icon [img]="Link2" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.connectPatreon' | translate }}</span>
</button>
</div>
<p class="hint">{{ 'updatesSection.connectInstructions' | translate }}</p>
<div class="form-row">
<label for="license-jwt">{{ 'updatesSection.patreonToken' | translate }}</label>
<input
id="license-jwt"
type="text"
[(ngModel)]="licenseJwtInput"
placeholder="eyJhbGciOiJFZERTQS..."
autocomplete="off"
>
</div>
<div class="form-row">
<button type="button" class="btn-primary" (click)="installLicense()" [disabled]="!licenseJwtInput.trim()">
<lucide-icon [img]="Check" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.activateLicense' | translate }}</span>
</button>
</div>
@if (licenseError) {
<div class="alert alert-error">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span>{{ licenseError }}</span>
</div>
}
}
<!-- Licence installee (VALID / GRACE / EXPIRED / UNVERIFIABLE) -->
@if (licenseStatus && licenseStatus.status !== 'NONE') {
@if (licenseStatus.status === 'VALID') {
<div class="alert alert-success">
<lucide-icon [img]="Check" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.licenseValid' | translate:{ tier: tierLabel(licenseStatus.tierId) } }}</span>
</div>
}
@if (licenseStatus.status === 'GRACE') {
<div class="alert alert-warn">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.licenseGrace' | translate }}</span>
</div>
}
@if (licenseStatus.status === 'EXPIRED') {
<div class="alert alert-error">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.licenseExpired' | translate }}</span>
</div>
}
@if (licenseStatus.status === 'UNVERIFIABLE') {
<div class="alert alert-error">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.licenseUnverifiable' | translate }}</span>
</div>
}
<ul class="license-info">
@if (licenseStatus.tierId) {
<li [innerHTML]="'updatesSection.infoTier' | translate:{ tier: tierLabel(licenseStatus.tierId) }"></li>
<p class="hint">{{ 'updatesSection.betaChannelIntro' | translate }}</p>
<!-- En beta : une beta plus recente existe-t-elle ? -->
@if (channelStatus.currentChannel === 'beta') {
<div class="beta-status">
@if (betaChecking) {
<div class="hint">{{ 'updatesSection.checkingBetaImages' | translate }}</div>
}
@if (licenseStatus.expiresAt) {
<li>
<span [innerHTML]="'updatesSection.infoValidity' | translate:{ date: formatDate(licenseStatus.expiresAt) }"></span>
@if (daysUntilExpiry !== null && daysUntilExpiry > 0) {
<span>
{{ (daysUntilExpiry > 1 ? 'updatesSection.renewalDays' : 'updatesSection.renewalDay') | translate:{ n: daysUntilExpiry } }}
</span>
}
</li>
}
@if (licenseStatus.lastRefreshAttemptAt) {
<li>
<span [innerHTML]="'updatesSection.infoLastRefresh' | translate:{ date: formatDate(licenseStatus.lastRefreshAttemptAt) }"></span>
@if (licenseStatus.lastRefreshSucceeded === true) {
<span class="badge-ok">{{ 'updatesSection.refreshOk' | translate }}</span>
}
@if (licenseStatus.lastRefreshSucceeded === false) {
<span class="badge-warn">{{ 'updatesSection.refreshFailed' | translate }}</span>
}
</li>
}
</ul>
<div class="form-row form-row-inline">
<label class="checkbox">
<input
type="checkbox"
[checked]="licenseStatus.betaChannelEnabled"
(change)="toggleBetaChannel(!licenseStatus.betaChannelEnabled)"
[disabled]="licenseStatus.status !== 'VALID' && licenseStatus.status !== 'GRACE'"
>
<span>{{ 'updatesSection.enableBetaChannel' | translate }}</span>
</label>
</div>
<div class="form-row form-row-actions">
<button type="button" class="btn-secondary" (click)="refreshLicense()" [disabled]="licenseLoading">
<lucide-icon [img]="RefreshCw" [size]="14"></lucide-icon>
<span>{{ (licenseLoading ? 'updatesSection.checking' : 'updatesSection.checkNow') | translate }}</span>
</button>
<button type="button" class="btn-secondary btn-danger" (click)="disconnectPatreon()">
<lucide-icon [img]="Unlink" [size]="14"></lucide-icon>
<span>{{ 'updatesSection.disconnectPatreon' | translate }}</span>
</button>
</div>
<!-- Etat du canal beta -->
@if (licenseStatus.betaChannelEnabled) {
<div class="beta-status">
@if (betaChecking) {
<div class="hint">{{ 'updatesSection.checkingBetaImages' | translate }}</div>
}
@if (!betaChecking && betaStatus && !betaStatus.enabled) {
<div class="hint">
{{ 'updatesSection.betaUnavailable' | translate:{ reason: betaStatus.disabledReason } }}
@if (!betaChecking && betaStatus?.enabled) {
@if (betaStatus?.updateAvailable) {
<div class="alert alert-success">
<lucide-icon [img]="Download" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.betaUpdateAvailable' | translate }}</span>
</div>
}
@if (!betaChecking && betaStatus?.enabled) {
<div>
@if (betaStatus?.anyUnknown) {
<div class="alert alert-warn">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.betaCheckImpossible' | translate }}</span>
</div>
}
</div>
}
</div>
}
<!-- Bascule de canal (stable <-> beta) via sidecar switcher -->
@if (channelStatus) {
<div class="channel-switch">
<div class="channel-current">
<span class="channel-label">{{ 'updatesSection.currentChannel' | translate }}</span>
<span class="channel-badge"
[class.channel-stable]="channelStatus.currentChannel === 'stable'"
[class.channel-beta]="channelStatus.currentChannel === 'beta'">
{{ (channelStatus.currentChannel === 'beta' ? 'updatesSection.channelBeta' : 'updatesSection.channelStable') | translate }}
</span>
</div>
<!-- Sidecar dispo : boutons d'action -->
@if (channelStatus.switcherAvailable) {
<!-- On stable -> proposer passage beta (uniquement si licence active) -->
@if (channelStatus.currentChannel === 'stable') {
<button
type="button" class="btn-primary"
[disabled]="switchInFlight"
(click)="requestChannelSwitch('beta')">
<lucide-icon [img]="Download" [size]="14"></lucide-icon>
<span>{{ (switchInFlight ? 'updatesSection.switching' : 'updatesSection.switchToBeta') | translate }}</span>
</button>
}
<!-- On beta -> proposer retour stable -->
@if (channelStatus.currentChannel === 'beta') {
<button
type="button" class="btn-secondary"
[disabled]="switchInFlight"
(click)="requestChannelSwitch('stable')">
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon>
<span>{{ (switchInFlight ? 'updatesSection.switching' : 'updatesSection.switchToStable') | translate }}</span>
</button>
}
<!-- Switch en cours : on prévient que la page va se rendre injoignable -->
@if (switchInFlight) {
<div class="alert alert-warn">
<lucide-icon [img]="RefreshCw" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.switchInProgressNotice' | translate }}</span>
@if (config.updateCheckEnabled) {
<div class="form-row">
<button type="button" class="btn-primary" (click)="applyUpdate()" [disabled]="updateApplying">
<lucide-icon [img]="Download" [size]="16"></lucide-icon>
<span>{{ (updateApplying ? 'updatesSection.applying' : 'updatesSection.applyNow') | translate }}</span>
</button>
</div>
}
<!-- Erreur eventuelle remontee par le sidecar -->
@if (switchError && !switchInFlight) {
<div class="alert alert-error">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span>{{ switchError }}</span>
</div>
}
}
<!-- Sidecar PAS dispo : fallback instructions manuelles (vieilles installs) -->
@if (!channelStatus.switcherAvailable) {
} @else if (betaStatus?.anyUnknown) {
<div class="alert alert-warn">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span [innerHTML]="'updatesSection.switcherUnavailable' | translate"></span>
<span>{{ 'updatesSection.betaCheckImpossible' | translate }}</span>
</div>
} @else {
<div class="hint">
{{ 'updatesSection.betaUpToDate' | translate:{ date: (betaStatus?.checkedAt | date:'short') } }}
</div>
}
}
</div>
}
<!-- Bascule de canal (stable <-> beta) via sidecar switcher -->
<div class="channel-switch">
<div class="channel-current">
<span class="channel-label">{{ 'updatesSection.currentChannel' | translate }}</span>
<span class="channel-badge"
[class.channel-stable]="channelStatus.currentChannel === 'stable'"
[class.channel-beta]="channelStatus.currentChannel === 'beta'">
{{ (channelStatus.currentChannel === 'beta' ? 'updatesSection.channelBeta' : 'updatesSection.channelStable') | translate }}
</span>
</div>
<!-- Sidecar dispo : boutons d'action -->
@if (channelStatus.switcherAvailable) {
<!-- On stable -> proposer passage beta -->
@if (channelStatus.currentChannel === 'stable') {
<button
type="button" class="btn-primary"
[disabled]="switchInFlight"
(click)="requestChannelSwitch('beta')">
<lucide-icon [img]="Download" [size]="14"></lucide-icon>
<span>{{ (switchInFlight ? 'updatesSection.switching' : 'updatesSection.switchToBeta') | translate }}</span>
</button>
}
<!-- On beta -> proposer retour stable -->
@if (channelStatus.currentChannel === 'beta') {
<button
type="button" class="btn-secondary"
[disabled]="switchInFlight"
(click)="requestChannelSwitch('stable')">
<lucide-icon [img]="ArrowLeft" [size]="14"></lucide-icon>
<span>{{ (switchInFlight ? 'updatesSection.switching' : 'updatesSection.switchToStable') | translate }}</span>
</button>
}
<!-- Switch en cours : on prévient que la page va se rendre injoignable -->
@if (switchInFlight) {
<div class="alert alert-warn">
<lucide-icon [img]="RefreshCw" [size]="16"></lucide-icon>
<span>{{ 'updatesSection.switchInProgressNotice' | translate }}</span>
</div>
}
<!-- Erreur eventuelle remontee par le sidecar -->
@if (switchError && !switchInFlight) {
<div class="alert alert-error">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span>{{ switchError }}</span>
</div>
}
}
<!-- Sidecar PAS dispo : fallback instructions manuelles (vieilles installs) -->
@if (!channelStatus.switcherAvailable) {
<div class="alert alert-warn">
<lucide-icon [img]="AlertCircle" [size]="16"></lucide-icon>
<span [innerHTML]="'updatesSection.switcherUnavailable' | translate"></span>
</div>
}
}
</div>
</div>
}
</section>
@@ -2,11 +2,10 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
import { interval, switchMap, Subscription } from 'rxjs';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { LucideAngularModule, ArrowLeft, RefreshCw, Check, AlertCircle, Download, Heart, Link2, Unlink } from 'lucide-angular';
import { LucideAngularModule, ArrowLeft, RefreshCw, Check, AlertCircle, Download, FlaskConical } from 'lucide-angular';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { UpdatesService, UpdateStatus } from '../../services/updates.service';
import { UpdatesService, UpdateStatus, BetaStatusDTO, ChannelStatusDTO, ChannelName } from '../../services/updates.service';
import { ConfigService } from '../../services/config.service';
import { LicenseService, LicenseStatusDTO, BetaStatusDTO, ChannelStatusDTO, ChannelName } from '../../services/license.service';
import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog.service';
/**
@@ -14,8 +13,7 @@ import { ConfirmDialogService } from '../../shared/confirm-dialog/confirm-dialog
*
* Responsabilite unique : tout ce qui touche au CYCLE DE VIE des conteneurs —
* - canal stable : verification + application des mises a jour (Watchtower) ;
* - licence Patreon : connexion OAuth, installation du JWT, refresh, deconnexion ;
* - canal beta : activation + verification des images beta ;
* - canal beta (libre) : verification des images beta quand on y tourne ;
* - bascule de canal stable <-> beta via le sidecar switcher (avec polling).
*
* Autonome : injecte ses propres services, aucun @Input/@Output — le parent
@@ -36,19 +34,9 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
readonly Check = Check;
readonly AlertCircle = AlertCircle;
readonly Download = Download;
readonly Heart = Heart;
readonly Link2 = Link2;
readonly Unlink = Unlink;
readonly FlaskConical = FlaskConical;
// --- Licence Patreon (canal beta) ---
licenseStatus: LicenseStatusDTO | null = null;
licenseLoading = false;
licenseError = '';
/** Message de succes local a la section (connexion/deconnexion Patreon). */
licenseSuccess = '';
/** Token JWT colle par l'utilisateur apres OAuth. */
licenseJwtInput = '';
/** Etat du canal beta (digests des images privees). */
/** Nouvelle beta disponible ? (verifie seulement quand l'instance tourne en beta). */
betaStatus: BetaStatusDTO | null = null;
betaChecking = false;
@@ -72,7 +60,6 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
constructor(
private updatesService: UpdatesService,
public config: ConfigService,
private licenseService: LicenseService,
private confirmDialog: ConfirmDialogService,
private translate: TranslateService
) {}
@@ -81,7 +68,6 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
if (this.config.updateCheckEnabled) {
this.checkUpdates();
}
this.loadLicense();
this.loadChannelStatus();
}
@@ -89,103 +75,9 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
this.stopSwitchPolling();
}
// --- Licence Patreon ---------------------------------------------------
loadLicense(): void {
this.licenseLoading = true;
this.licenseService.getStatus().subscribe({
next: (s) => {
this.licenseStatus = s;
this.licenseLoading = false;
if (s?.enabled && (s.status === 'VALID' || s.status === 'GRACE') && s.betaChannelEnabled) {
this.checkBeta();
}
},
error: () => { this.licenseLoading = false; }
});
}
/**
* Ouvre la page OAuth Patreon dans une nouvelle fenetre.
* L'utilisateur copie ensuite le JWT et le colle dans l'input ci-dessous.
*/
connectPatreon(): void {
this.licenseError = '';
this.licenseService.getConnectUrl().subscribe({
next: (r) => {
if (!r?.url) {
this.licenseError = this.translate.instant('updatesSection.connectUrlError');
return;
}
window.open(r.url, '_blank', 'noopener');
}
});
}
installLicense(): void {
const jwt = this.licenseJwtInput.trim();
if (!jwt) {
this.licenseError = this.translate.instant('updatesSection.pasteTokenFirst');
return;
}
this.licenseError = '';
this.licenseService.install(jwt).subscribe((res) => {
// install() renvoie une union typée : le garde `in` suffit à discriminer.
if ('error' in res) {
this.licenseError = res.error;
return;
}
this.licenseStatus = res;
this.licenseJwtInput = '';
this.licenseSuccess = this.translate.instant('updatesSection.patreonConnectedSuccess');
if (this.licenseStatus.betaChannelEnabled) {
this.checkBeta();
}
});
}
refreshLicense(): void {
this.licenseLoading = true;
this.licenseService.refresh().subscribe({
next: (s) => {
this.licenseStatus = s;
this.licenseLoading = false;
},
error: () => { this.licenseLoading = false; }
});
}
disconnectPatreon(): void {
this.confirmDialog.confirm({
title: this.translate.instant('updatesSection.disconnectTitle'),
message: this.translate.instant('updatesSection.disconnectMessage'),
details: [this.translate.instant('updatesSection.disconnectDetail')],
confirmLabel: this.translate.instant('updatesSection.disconnectConfirm'),
variant: 'warning'
}).then(ok => {
if (!ok) return;
this.licenseService.disconnect().subscribe(() => {
this.licenseStatus = null;
this.betaStatus = null;
this.licenseSuccess = this.translate.instant('updatesSection.patreonDisconnected');
this.loadLicense();
});
});
}
toggleBetaChannel(enabled: boolean): void {
this.licenseService.setBetaChannel(enabled).subscribe({
next: (s) => {
if (s) this.licenseStatus = s;
if (enabled) this.checkBeta();
else this.betaStatus = null;
}
});
}
checkBeta(): void {
this.betaChecking = true;
this.licenseService.checkBeta().subscribe({
this.updatesService.checkBeta().subscribe({
next: (s) => {
this.betaStatus = s;
this.betaChecking = false;
@@ -197,11 +89,11 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
// --- Bascule de canal stable <-> beta --------------------------------------
loadChannelStatus(): void {
this.licenseService.getChannelStatus().subscribe({
this.updatesService.getChannelStatus().subscribe({
next: (s) => {
this.channelStatus = s;
// Si on revient sur l'ecran apres un reload (post-switch reussi),
// on affiche le dernier resultat eventuel jusqu'a interaction utilisateur.
// En beta, on verifie aussi s'il existe une beta plus recente.
if (s?.currentChannel === 'beta') this.checkBeta();
},
error: () => { this.channelStatus = null; }
});
@@ -210,8 +102,8 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
/**
* Declenche un switch de canal. La sequence cote UI :
* 1. Confirm modal (action destructrice : recreate des containers)
* 2. POST /api/license/channel/switch -> 202 avec l'ID de la commande
* 3. Polling /api/license/channel toutes les 2s jusqu'a status != IN_PROGRESS
* 2. POST /api/admin/updates/channel/switch -> 202 avec l'ID de la commande
* 3. Polling /api/admin/updates/channel toutes les 2s jusqu'a status != IN_PROGRESS
* 4. Si SUCCESS : la page va se rendre injoignable (Core recree). On affiche
* "Recharge la page dans quelques secondes" et on essaie de poll quand
* meme — au retour de Core, on detectera SUCCESS et on rechargera auto.
@@ -244,7 +136,7 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
private doChannelSwitch(target: ChannelName): void {
this.switchInFlight = true;
this.switchError = '';
this.licenseService.switchChannel(target).subscribe((res) => {
this.updatesService.switchChannel(target).subscribe((res) => {
if ('error' in res) {
this.switchError = res.error;
this.switchInFlight = false;
@@ -256,14 +148,14 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
}
/**
* Poll /api/license/channel toutes les 2s. S'arrete quand on detecte un
* Poll /api/admin/updates/channel toutes les 2s. S'arrete quand on detecte un
* resultat avec un ID >= a celui qu'on a soumis (le sidecar le met a jour
* a la fin de son traitement).
*/
private startSwitchPolling(): void {
this.stopSwitchPolling();
this.switchPollSub = interval(2000).pipe(
switchMap(() => this.licenseService.getChannelStatus())
switchMap(() => this.updatesService.getChannelStatus())
).subscribe((status) => {
if (!status) return;
this.channelStatus = status;
@@ -291,40 +183,6 @@ export class UpdatesSectionComponent implements OnInit, OnDestroy {
}
}
/**
* Mapping tier_id Patreon → nom lisible. Les IDs viennent du dashboard
* Patreon de LoreMind (Settings -> Tiers). Sans entree dans la map, on
* affiche l'ID brut pour rester debuggable.
*
* Si tu ajoutes un nouveau tier Patreon, complete cette map et redeploie.
* (Pas besoin de toucher au backend — c'est juste un libelle d'UI.)
*/
private static readonly TIER_LABELS: Record<string, string> = {
'28448887': 'Compagnon',
// '0000000': 'Aventurier',
// '0000000': 'Heros',
};
/** Libelle lisible d'un tier Patreon, fallback sur l'ID brut. */
tierLabel(tierId: string | null | undefined): string {
if (!tierId) return '';
return UpdatesSectionComponent.TIER_LABELS[tierId] ?? tierId;
}
/** Format human-readable des dates renvoyees par le backend. */
formatDate(iso: string | null | undefined): string {
if (!iso) return '';
try { return new Date(iso).toLocaleString(); } catch { return iso; }
}
/** Nombre de jours restants avant expiration JWT (peut etre negatif). */
get daysUntilExpiry(): number | null {
if (!this.licenseStatus?.expiresAt) return null;
const exp = new Date(this.licenseStatus.expiresAt).getTime();
const now = Date.now();
return Math.ceil((exp - now) / (1000 * 60 * 60 * 24));
}
// --- Mises a jour conteneurs (canal stable) -----------------------------
checkUpdates(): void {