v1.0.0 - version initiale

This commit is contained in:
POL Mickaël 2026-03-24 01:32:55 +01:00
commit 9abc1aa434
10 changed files with 6032 additions and 0 deletions

5
.gitignore vendored Executable file
View File

@ -0,0 +1,5 @@
node_modules/
dist/
*.log
.DS_Store
Thumbs.db

131
README.md Executable file
View File

@ -0,0 +1,131 @@
# ⚔ Minuteur Dragodinde — Dofus 3
Outil de gestion d'élevage de Dragodindes pour Dofus 3.
Application desktop Windows construite avec Electron.
🔗 **Repo** : https://gitea.mickael-pol.fr/mickael/dd-timer
## Fonctionnalités
- 🐦 Gestion de **6 enclos indépendants** avec jusqu'à 10 Dragodindes chacun
- ⏱ **Timer en temps réel** avec calcul automatique par tier de jauge (1→4)
- 📊 **Dashboard** vue d'ensemble multi-enclos
- 🔔 **Notifications natives Windows** même application en arrière-plan
- 🔊 **5 sons d'alarme** au choix (Arpège, Pulsation, Fanfare, Sirène, Cloche)
- 🐉 **Jauges** : Baffeur, Caresseur, Foudroyeur, Abreuvoir, Dragofesse, Mangeoire (XP)
- 🖱 **Drag & drop** des enclos et des Dragodindes pour les réordonner
- ⬆ **Mise à jour automatique** via Gitea Releases
- 💾 Sauvegarde automatique locale
## Installation (utilisateurs)
1. Télécharger `Minuteur Dragodinde Setup x.x.x.exe` depuis la section [Releases](https://gitea.mickael-pol.fr/mickael/dd-timer/releases)
2. **Clic droit → Propriétés → cocher "Débloquer" → OK** (important, une seule fois)
3. Double-cliquer pour lancer l'installation
4. L'app apparaît dans le menu Démarrer et sur le Bureau
> **Si Windows affiche "Application inconnue"** : cliquer **"Informations complémentaires" → "Exécuter quand même"**
## Build (développeurs)
### Prérequis
- [Node.js LTS](https://nodejs.org)
### Compiler
```bash
# Double-cliquer sur build.bat (admin auto)
# ou manuellement :
npm install
npm run build
```
L'installeur est généré dans `dist/`.
## Publier une nouvelle version
```bash
# 1. Modifier la version dans package.json ("version": "1.x.x")
# 2. Committer et tagger
git add .
git commit -m "v1.x.x - description"
git tag v1.x.x
git push && git push --tags
# 3. Sur Gitea : Releases → Nouvelle release → tag v1.x.x → attacher Setup.exe
```
## Structure
```
dd-timer/
├── src/index.html # Interface (HTML/CSS/JS)
├── main.js # Processus principal Electron + auto-update
├── preload.js # Bridge Electron ↔ renderer
├── icon.png # Icône (256x256)
├── package.json # Config et dépendances
└── build.bat # Script de build Windows (admin auto)
```
## Changelog
### v1.0.0
- Version initiale
Outil de gestion d'élevage de Dragodindes pour Dofus 3.
Application desktop Windows construite avec Electron.
## Fonctionnalités
- 🐦 Gestion de **6 enclos indépendants** avec jusqu'à 10 Dragodindes chacun
- ⏱ **Timer en temps réel** avec calcul automatique par tier de jauge (1→4)
- 📊 **Dashboard** vue d'ensemble multi-enclos
- 🔔 **Notifications natives Windows** même application en arrière-plan
- 🔊 **5 sons d'alarme** au choix (Arpège, Pulsation, Fanfare, Sirène, Cloche)
- 🐉 **Jauges** : Baffeur, Caresseur, Foudroyeur, Abreuvoir, Dragofesse, Mangeoire (XP)
- 🖱 **Drag & drop** des enclos et des Dragodindes pour les réordonner
- 💾 Sauvegarde automatique locale
## Installation (utilisateurs)
1. Télécharger `Minuteur Dragodinde Setup x.x.x.exe` depuis la section [Releases](../../releases)
2. **Clic droit → Propriétés → cocher "Débloquer" → OK** (important, une seule fois)
3. Double-cliquer pour lancer l'installation → suivre l'assistant
4. L'app apparaît dans le menu Démarrer et sur le Bureau
> **Si Windows affiche "Application inconnue"** : cliquer **"Informations complémentaires" → "Exécuter quand même"**
> **Si Smart App Control bloque** : Sécurité Windows → Contrôle des applications → Smart App Control → Évaluation, puis retélécharger
## Build (développeurs)
### Prérequis
- [Node.js LTS](https://nodejs.org)
### Compiler l'application
```bash
# Double-cliquer sur build.bat (se relance automatiquement en admin)
# ou manuellement :
npm install
npm run build
```
L'exécutable est généré dans `dist/`.
## Structure du projet
```
dd-timer/
├── src/
│ └── index.html # Interface complète (HTML/CSS/JS)
├── main.js # Processus principal Electron
├── preload.js # Pont sécurisé Electron ↔ renderer
├── icon.png # Icône application (256x256)
├── package.json # Config et dépendances
└── build.bat # Script de build Windows
```
## Changelog
### v1.0.0
- Version initiale

50
build.bat Executable file
View File

@ -0,0 +1,50 @@
@echo off
net session >nul 2>&1
if %errorlevel% neq 0 (
powershell -Command "Start-Process -FilePath '%~f0' -Verb RunAs -Wait"
exit /b
)
cd /d "%~dp0"
set CSC_IDENTITY_AUTO_DISCOVERY=false
set CSC_LINK=
set WIN_CSC_LINK=
echo.
echo ================================================
echo MINUTEUR DRAGODINDE - Construction du .exe
echo ================================================
echo.
node -v >nul 2>&1
if %errorlevel% neq 0 (
echo [ERREUR] Node.js introuvable.
echo Installez depuis https://nodejs.org
start https://nodejs.org
pause
exit /b 1
)
for /f "tokens=*" %%v in ('node -v') do echo [OK] Node.js %%v
echo Nettoyage cache...
if exist "%LOCALAPPDATA%\electron-builder\Cache\winCodeSign" rmdir /s /q "%LOCALAPPDATA%\electron-builder\Cache\winCodeSign"
echo [OK] Cache nettoye
echo.
echo [1/3] Installation des dependances...
call npm install
if %errorlevel% neq 0 ( echo [ERREUR] npm install & pause & exit /b 1 )
echo [OK] Dependances OK
echo.
echo [2/3] Construction du setup .exe (2-5 minutes)...
call npm run build
if %errorlevel% neq 0 ( echo [ERREUR] Build echoue & pause & exit /b 1 )
echo.
echo [3/3] Termine !
echo.
echo ================================================
echo Installeur pret dans le dossier dist\
echo Fichier : Minuteur Dragodinde Setup 1.0.0.exe
echo ================================================
echo.
if exist dist explorer dist
pause

71
build.ps1 Executable file
View File

@ -0,0 +1,71 @@
# Minuteur Dragodinde - Script de construction
$ErrorActionPreference = 'Stop'
$Host.UI.RawUI.WindowTitle = 'Minuteur Dragodinde - Construction'
Write-Host ''
Write-Host '================================================' -ForegroundColor Cyan
Write-Host ' MINUTEUR DRAGODINDE - Construction du .exe' -ForegroundColor Cyan
Write-Host '================================================' -ForegroundColor Cyan
Write-Host ''
Set-Location $PSScriptRoot
# Verification Node.js
try {
$nodeVer = node -v 2>&1
Write-Host "[OK] Node.js : $nodeVer" -ForegroundColor Green
} catch {
Write-Host '[ERREUR] Node.js introuvable. Installez depuis https://nodejs.org' -ForegroundColor Red
Start-Process 'https://nodejs.org'
Read-Host 'Appuyez sur Entree pour fermer'
exit 1
}
# Verification npm
try {
$npmVer = npm -v 2>&1
Write-Host "[OK] npm : $npmVer" -ForegroundColor Green
} catch {
Write-Host '[ERREUR] npm introuvable.' -ForegroundColor Red
Read-Host 'Appuyez sur Entree pour fermer'
exit 1
}
Write-Host ''
Write-Host '[1/3] Installation des dependances (~150 Mo, premiere fois)...' -ForegroundColor Yellow
Write-Host ''
npm install
if ($LASTEXITCODE -ne 0) {
Write-Host '[ERREUR] npm install a echoue.' -ForegroundColor Red
Read-Host 'Appuyez sur Entree pour fermer'
exit 1
}
Write-Host ''
Write-Host '[OK] Dependances installees' -ForegroundColor Green
Write-Host ''
Write-Host '[2/3] Construction du logiciel Windows (2-5 minutes)...' -ForegroundColor Yellow
Write-Host ''
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Host '[ERREUR] Build echoue - voir messages ci-dessus.' -ForegroundColor Red
Read-Host 'Appuyez sur Entree pour fermer'
exit 1
}
Write-Host ''
Write-Host '[3/3] Termine !' -ForegroundColor Green
Write-Host ''
Write-Host '================================================' -ForegroundColor Cyan
Write-Host ' Installeur pret dans le dossier dist' -ForegroundColor Cyan
Write-Host ' Minuteur Dragodinde Setup 1.0.0.exe' -ForegroundColor Cyan
Write-Host '================================================' -ForegroundColor Cyan
Write-Host ''
if (Test-Path 'dist') {
Invoke-Item 'dist'
}
Read-Host 'Appuyez sur Entree pour fermer'

BIN
icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

316
main.js Executable file
View File

@ -0,0 +1,316 @@
const { app, BrowserWindow, Tray, Menu, nativeImage, ipcMain, Notification, dialog, shell } = require('electron');
const path = require('path');
const https = require('https');
const fs = require('fs');
const os = require('os');
// ─── CONFIG GITEA ─────────────────────────────────────────────────────────────
const GITEA_HOST = 'gitea.mickael-pol.fr'; // ton instance Gitea
const GITEA_USER = 'mickael'; // ton user Gitea
const GITEA_REPO = 'dd-timer'; // ton repo
const CURRENT_VERSION = app.getVersion(); // lu depuis package.json
let mainWindow;
let tray;
let isQuitting = false;
let updateInfo = null; // { version, downloadUrl } si mise à jour dispo
let downloading = false;
// ─── ICÔNE ───────────────────────────────────────────────────────────────────
function getTrayIcon() {
const fs = require('fs');
const iconPath = path.join(__dirname, 'icon.png');
if (fs.existsSync(iconPath)) return nativeImage.createFromPath(iconPath);
return nativeImage.createEmpty();
}
// ─── FENÊTRE ─────────────────────────────────────────────────────────────────
function createWindow() {
mainWindow = new BrowserWindow({
width: 1280, height: 900, minWidth: 960, minHeight: 650,
title: 'Minuteur Dragodinde - Dofus 3',
backgroundColor: '#0b0b14',
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
backgroundThrottling: false,
preload: path.join(__dirname, 'preload.js'),
},
});
mainWindow.loadFile(path.join(__dirname, 'src', 'index.html'));
mainWindow.on('close', (e) => {
if (!isQuitting) {
e.preventDefault();
mainWindow.hide();
if (tray) tray.displayBalloon({
iconType: 'info',
title: 'Minuteur Dragodinde',
content: "Tourne en arriere-plan. Les alarmes sonneront normalement.",
});
}
});
// Envoyer les infos de version au renderer une fois chargé
mainWindow.webContents.on('did-finish-load', () => {
mainWindow.webContents.send('app-version', CURRENT_VERSION);
if (updateInfo) {
mainWindow.webContents.send('update-available', updateInfo);
}
});
}
// ─── TRAY ─────────────────────────────────────────────────────────────────────
function createTray() {
tray = new Tray(getTrayIcon());
tray.setToolTip(`Minuteur Dragodinde v${CURRENT_VERSION}`);
rebuildTrayMenu();
tray.on('double-click', () => { mainWindow.show(); mainWindow.focus(); });
}
function rebuildTrayMenu() {
if (!tray) return;
const items = [
{ label: `Minuteur Dragodinde v${CURRENT_VERSION}`, enabled: false },
{ type: 'separator' },
{ label: 'Ouvrir', click: () => { mainWindow.show(); mainWindow.focus(); } },
];
if (updateInfo) {
items.push({ type: 'separator' });
items.push({
label: `⬆ Mise a jour v${updateInfo.version} disponible !`,
click: () => startDownload(),
});
}
items.push({ type: 'separator' });
items.push({ label: 'Quitter', click: () => { isQuitting = true; app.quit(); } });
tray.setContextMenu(Menu.buildFromTemplate(items));
}
// ─── NOTIFICATIONS ────────────────────────────────────────────────────────────
function fireNotification(title, body) {
if (!Notification.isSupported()) return;
const n = new Notification({ title, body, timeoutType: 'never' });
n.on('click', () => { mainWindow.show(); mainWindow.focus(); });
n.show();
}
// ─── IPC ──────────────────────────────────────────────────────────────────────
ipcMain.on('trigger-alarm', (event, { enclosName }) => {
fireNotification('Dragodindes pretes !', enclosName + ' - Toutes les cibles ont ete atteintes !');
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('play-alarm-sound');
}
});
ipcMain.on('show-notification', (event, { title, body }) => {
fireNotification(title, body);
});
ipcMain.on('focus-window', () => { mainWindow.show(); mainWindow.focus(); });
// Renderer demande à installer la mise à jour
ipcMain.on('install-update', () => startDownload());
// Renderer demande la version
ipcMain.handle('get-version', () => CURRENT_VERSION);
// ─── VÉRIFICATION DE MISE À JOUR ─────────────────────────────────────────────
function compareVersions(a, b) {
// Retourne > 0 si b > a (b est plus récent)
const pa = a.replace(/^v/, '').split('.').map(Number);
const pb = b.replace(/^v/, '').split('.').map(Number);
for (let i = 0; i < 3; i++) {
if ((pb[i] || 0) > (pa[i] || 0)) return 1;
if ((pb[i] || 0) < (pa[i] || 0)) return -1;
}
return 0;
}
function checkForUpdates(silent = false) {
// API Gitea : GET /api/v1/repos/{user}/{repo}/releases?limit=1
// Retourne un tableau — le premier élément est la release la plus récente
const options = {
hostname: GITEA_HOST,
port: 443,
path: `/api/v1/repos/${GITEA_USER}/${GITEA_REPO}/releases?limit=1`,
method: 'GET',
headers: {
'User-Agent': `MinuteurDragodinde/${CURRENT_VERSION}`,
'Accept': 'application/json',
},
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', chunk => { data += chunk; });
res.on('end', () => {
try {
const releases = JSON.parse(data);
// Gitea renvoie un tableau, on prend le premier (le plus récent)
if (!Array.isArray(releases) || releases.length === 0) return;
const release = releases[0];
const latestVersion = release.tag_name;
if (!latestVersion) return;
if (compareVersions(CURRENT_VERSION, latestVersion) > 0) {
// Chercher l'asset installeur (.exe contenant "Setup")
const asset = release.assets && release.assets.find(a =>
a.name.includes('Setup') && a.name.endsWith('.exe')
);
if (!asset) return;
updateInfo = {
version: latestVersion,
downloadUrl: asset.browser_download_url,
assetName: asset.name,
releaseNotes: release.body || '',
};
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('update-available', updateInfo);
}
fireNotification(
`Mise a jour v${latestVersion} disponible !`,
'Cliquez pour mettre a jour Minuteur Dragodinde.'
);
rebuildTrayMenu();
} else if (!silent) {
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('update-not-available');
}
}
} catch (e) {
console.error('Update check parse error:', e.message);
}
});
});
req.on('error', (e) => console.error('Update check error:', e.message));
req.end();
}
// ─── TÉLÉCHARGEMENT ET REMPLACEMENT ──────────────────────────────────────────
function startDownload() {
if (!updateInfo || downloading) return;
downloading = true;
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('update-downloading', { version: updateInfo.version });
}
const tmpDir = os.tmpdir();
const tmpExe = path.join(tmpDir, updateInfo.assetName);
const file = fs.createWriteStream(tmpExe);
const currentExe = process.execPath;
// Suivre les redirections manuellement (GitHub assets redirigent)
function download(url, redirectCount = 0) {
if (redirectCount > 5) {
sendUpdateError('Trop de redirections.');
return;
}
const urlObj = new URL(url);
const mod = urlObj.protocol === 'https:' ? https : require('http');
const opts = {
hostname: urlObj.hostname,
path: urlObj.pathname + urlObj.search,
method: 'GET',
headers: { 'User-Agent': `MinuteurDragodinde/${CURRENT_VERSION}` },
};
mod.request(opts, (res) => {
if (res.statusCode === 302 || res.statusCode === 301) {
download(res.headers.location, redirectCount + 1);
return;
}
if (res.statusCode !== 200) {
sendUpdateError(`Erreur HTTP ${res.statusCode}`);
return;
}
const total = parseInt(res.headers['content-length'] || '0', 10);
let received = 0;
res.on('data', chunk => {
received += chunk.length;
file.write(chunk);
if (total > 0 && mainWindow && !mainWindow.isDestroyed()) {
const pct = Math.round((received / total) * 100);
mainWindow.webContents.send('update-progress', { percent: pct });
}
});
res.on('end', () => {
file.end();
file.on('finish', () => {
// Lancer le script de remplacement
launchUpdater(tmpExe, currentExe);
});
});
res.on('error', e => sendUpdateError(e.message));
}).on('error', e => sendUpdateError(e.message)).end();
}
download(updateInfo.downloadUrl);
}
function sendUpdateError(msg) {
downloading = false;
console.error('Update error:', msg);
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('update-error', { message: msg });
}
}
function launchUpdater(newExe, currentExe) {
// Pour un installeur NSIS : on le lance directement avec /S pour silent install
// L'installeur gère lui-même le remplacement de l'ancienne version
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('update-ready');
}
const { spawn } = require('child_process');
// Petit délai pour laisser le message s'afficher
setTimeout(() => {
// Lancer l'installeur NSIS en mode silencieux
// /S = silent, /D= permet de spécifier le dossier d'installation
spawn(newExe, ['/S'], {
detached: true,
stdio: 'ignore',
windowsHide: false, // L'installeur peut avoir besoin d'être visible pour UAC
}).unref();
isQuitting = true;
app.quit();
}, 1500);
}
// ─── CYCLE DE VIE ────────────────────────────────────────────────────────────
app.whenReady().then(() => {
createWindow();
createTray();
// Vérifier les mises à jour au démarrage (silencieux)
setTimeout(() => checkForUpdates(true), 3000);
// Revérifier toutes les heures
setInterval(() => checkForUpdates(true), 60 * 60 * 1000);
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', () => {
if (process.platform === 'darwin') app.quit();
});
app.on('before-quit', () => { isQuitting = true; });

4102
package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

55
package.json Executable file
View File

@ -0,0 +1,55 @@
{
"name": "minuteur-dragodinde",
"version": "1.0.0",
"description": "Minuteur elevage Dragodinde Dofus 3",
"main": "main.js",
"author": "Mickael",
"scripts": {
"start": "electron .",
"build": "electron-builder --win --x64"
},
"build": {
"appId": "com.dofus3.minuteur-dragodinde",
"productName": "Minuteur Dragodinde",
"directories": {
"output": "dist"
},
"files": [
"main.js",
"preload.js",
"src/**/*",
"icon.png"
],
"win": {
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"sign": null,
"signingHashAlgorithms": [],
"icon": "icon.png",
"requestedExecutionLevel": "asInvoker"
},
"nsis": {
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"shortcutName": "Minuteur Dragodinde",
"deleteAppDataOnUninstall": false
}
},
"devDependencies": {
"electron": "32.2.7",
"electron-builder": "24.13.3"
},
"repository": {
"type": "git",
"url": "https://gitea.mickael-pol.fr/mickael/dd-timer.git"
}
}

24
preload.js Executable file
View File

@ -0,0 +1,24 @@
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
isElectron: true,
// Alarme
triggerAlarm: (enclosName) => ipcRenderer.send('trigger-alarm', { enclosName }),
showNotification: (title, body) => ipcRenderer.send('show-notification', { title, body }),
focusWindow: () => ipcRenderer.send('focus-window'),
onPlayAlarmSound: (cb) => ipcRenderer.on('play-alarm-sound', () => cb()),
// Version
getVersion: () => ipcRenderer.invoke('get-version'),
onAppVersion: (cb) => ipcRenderer.on('app-version', (e, v) => cb(v)),
// Mises à jour
installUpdate: () => ipcRenderer.send('install-update'),
onUpdateAvailable: (cb) => ipcRenderer.on('update-available', (e, info) => cb(info)),
onUpdateNotAvailable: (cb) => ipcRenderer.on('update-not-available', () => cb()),
onUpdateDownloading: (cb) => ipcRenderer.on('update-downloading', (e, info) => cb(info)),
onUpdateProgress: (cb) => ipcRenderer.on('update-progress', (e, info) => cb(info)),
onUpdateReady: (cb) => ipcRenderer.on('update-ready', () => cb()),
onUpdateError: (cb) => ipcRenderer.on('update-error', (e, info) => cb(info)),
});

1278
src/index.html Executable file

File diff suppressed because it is too large Load Diff