Enable tray icon and fix build scripts
CI / lint (push) Successful in 25s
CI / security (push) Successful in 15s
CI / test (push) Successful in 30s
CI / build (push) Successful in 14s
CI / e2e (push) Failing after 25s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled

This commit is contained in:
2026-07-26 12:41:29 -04:00
parent 1b4a6ff0cf
commit ed50aef6f7
11 changed files with 18641 additions and 24 deletions
+5598
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -9,7 +9,7 @@ edition = "2021"
tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2", features = [] }
tauri = { version = "2", features = ["tray-icon"] }
tauri-plugin-shell = "2"
tauri-plugin-dialog = "2"
tauri-plugin-notification = "2"
+35 -3
View File
@@ -122,10 +122,42 @@ Produits :
### Premier lancement
1. **Lance l'application** (menu ou ligne de commande)
- 💡 *Premier lancement recommandé depuis un terminal* pour voir le mot de passe admin généré
2. Le backend Python démarre automatiquement → health check sur `127.0.0.1:17890`
3. La fenêtre s'ouvre sur l'interface ObsiGate
4. **Sélectionne le dossier parent de tes vaults** Obsidian via le sélecteur natif
5. L'indexation démarre automatiquement
3. La fenêtre s'ouvre sur l'interface ObsiGate (écran de connexion si l'auth est activée)
4. **Connecte-toi** avec le compte admin créé automatiquement (voir [Compte administrateur](#compte-administrateur))
5. **Sélectionne le dossier parent de tes vaults** Obsidian via le sélecteur natif
6. L'indexation démarre automatiquement
### Compte administrateur
Au premier démarrage, un compte administrateur est créé automatiquement :
- **Login** : `admin` (modifiable via la variable d'environnement `OBSIGATE_ADMIN_USER`)
- **Mot de passe** : généré aléatoirement (16 caractères) et affiché **une seule fois** dans les logs
Le mot de passe apparaît dans la sortie du terminal sous cette forme :
```
============================================================
PREMIER DÉMARRAGE — Compte admin créé automatiquement
Utilisateur : admin
Mot de passe : XXXXXXXXXXXXXXXX
CHANGEZ CE MOT DE PASSE dès la première connexion !
============================================================
```
> ⚠️ **Note le mot de passe immédiatement** — il n'est affiché qu'une seule fois.
> Si tu rates les logs, supprime le dossier `data/` et relance l'application pour
> régénérer un nouveau compte.
**Prédéfinir le mot de passe** (recommandé) :
Avant le premier lancement, définis les variables d'environnement suivantes :
- **Windows** (PowerShell) : `$env:OBSIGATE_ADMIN_PASSWORD="MonMotDePasse"`
- **Linux** : `export OBSIGATE_ADMIN_PASSWORD="MonMotDePasse"`
Tu peux aussi définir `OBSIGATE_ADMIN_USER` pour changer le nom d'utilisateur.
### Lancements suivants
+14 -5
View File
@@ -11,7 +11,7 @@ echo "========================================"
echo ""
# ── 1. Vérifier les prérequis ─────────────────────────────────
echo "[1/4] Verifying prerequisites..."
echo "[1/5] Verifying prerequisites..."
command -v cargo >/dev/null 2>&1 || { echo "❌ Rust/Cargo not found. Install: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"; exit 1; }
command -v tauri >/dev/null 2>&1 || cargo install tauri-cli
@@ -22,7 +22,7 @@ fi
echo "✅ Dependencies OK"
# ── 2. Préparer Python 3.11 ────────────────────────────────────
echo "[2/4] Preparing Python environment..."
echo "[2/5] Preparing Python environment..."
python3 -m venv python-embed/venv
source python-embed/venv/bin/activate
pip install --upgrade pip -q
@@ -30,13 +30,22 @@ pip install -r ../backend/requirements.txt -q
echo "✅ Python environment ready"
# ── 3. Build Tauri ────────────────────────────────────────────
echo "[3/4] Building Tauri application..."
echo "[3/5] Building Tauri application..."
cargo tauri build --target x86_64-unknown-linux-gnu --bundles deb,appimage
echo "✅ Build successful"
# ── 4. Résultats ───────────────────────────────────────────────
# ── 4. Copier le runtime à côté de l'exécutable ───────────────
OUTDIR="target/x86_64-unknown-linux-gnu/release"
echo "[4/4] Results:"
echo "[4/5] Copying runtime to $OUTDIR..."
rm -rf "$OUTDIR/python-embed" "$OUTDIR/backend" "$OUTDIR/frontend"
cp -r python-embed "$OUTDIR/"
cp -r ../backend "$OUTDIR/"
cp -r ../frontend "$OUTDIR/"
echo "✅ Runtime + frontend copied"
# ── 5. Résultats ───────────────────────────────────────────────
OUTDIR="target/x86_64-unknown-linux-gnu/release"
echo "[5/5] Results:"
ls -lh "$OUTDIR/bundle/deb/"*.deb 2>/dev/null
ls -lh "$OUTDIR/bundle/appimage/"*.AppImage 2>/dev/null
echo ""
+12 -4
View File
@@ -24,11 +24,14 @@ curl -L -o python-embed.zip "https://www.python.org/ftp/python/3.11.9/python-3.1
powershell Expand-Archive -Path python-embed.zip -DestinationPath python-embed\
del python-embed.zip
REM Enable pip in embedded Python
REM Enable pip and site-packages in embedded Python
echo import site >> python-embed\python311._pth
REM Bootstrap pip (embed Python doesn't include it)
python-embed\python.exe -m ensurepip --upgrade
REM Download get-pip.py (embed Python doesn't include ensurepip)
echo 📥 Downloading get-pip.py...
curl -L -o get-pip.py "https://bootstrap.pypa.io/get-pip.py"
python-embed\python.exe get-pip.py --no-cache-dir
del get-pip.py
REM Install dependencies
python-embed\python.exe -m pip install --no-cache-dir -r ..\backend\requirements.txt
@@ -48,9 +51,14 @@ echo [4/5] Copying runtime to output dir...
set "OUTDIR=target\x86_64-pc-windows-msvc\release"
if exist "%OUTDIR%\python-embed" rmdir /s /q "%OUTDIR%\python-embed"
if exist "%OUTDIR%\backend" rmdir /s /q "%OUTDIR%\backend"
if exist "%OUTDIR%\frontend" rmdir /s /q "%OUTDIR%\frontend"
xcopy /E /I /Q "python-embed" "%OUTDIR%\python-embed"
xcopy /E /I /Q "..\backend" "%OUTDIR%\backend"
echo ✅ Runtime copied
xcopy /E /I /Q "..\frontend" "%OUTDIR%\frontend"
REM Add parent directory to Python path so 'import backend' works at runtime
echo ..>> "%OUTDIR%\python-embed\python311._pth"
echo ✅ Runtime + frontend copied + sys.path fixed
REM ── 5. Résultats ───────────────────────────────────────────────
echo [5/5] Results:
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"default":{"identifier":"default","description":"Default capabilities for ObsiGate Desktop","local":true,"windows":["main"],"permissions":["core:default","shell:allow-open","shell:allow-execute","dialog:default","notification:default","fs:default","process:default"]}}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+14 -10
View File
@@ -1,7 +1,7 @@
use tauri::Manager;
use std::process::{Child, Command};
use std::sync::Mutex;
use std::time::Duration;
use tauri::Manager;
// ── State ───────────────────────────────────────────────────────────────────
@@ -26,11 +26,15 @@ fn spawn_backend() -> Result<Child, String> {
let child = Command::new(&python)
.current_dir(&exe_dir)
.args([
"-m", "uvicorn",
"-m",
"uvicorn",
"backend.main:app",
"--host", "127.0.0.1",
"--port", "17890",
"--log-level", "info",
"--host",
"127.0.0.1",
"--port",
"17890",
"--log-level",
"info",
])
.spawn()
.map_err(|e| format!("Failed to start Python backend: {}", e))?;
@@ -70,10 +74,7 @@ fn get_backend_url() -> String {
async fn pick_vault_folder(app: tauri::AppHandle) -> Result<String, String> {
use tauri_plugin_dialog::DialogExt;
let path = app
.dialog()
.file()
.blocking_pick_folder();
let path = app.dialog().file().blocking_pick_folder();
match path {
Some(p) => Ok(p.to_string()),
@@ -122,7 +123,10 @@ fn main() {
Ok(()) => {
// Navigate to the main app
if let Some(window) = handle.get_webview_window("main") {
let _ = window.eval("window.location.href = 'http://127.0.0.1:17890'");
match window.eval("window.location.href = 'http://127.0.0.1:17890'") {
Ok(_) => println!("✅ Redirect to backend initiated"),
Err(e) => eprintln!("❌ Redirect eval failed: {}", e),
}
}
}
Err(e) => {
+1 -1
View File
@@ -27,7 +27,7 @@
}
],
"security": {
"csp": "default-src 'self' http://127.0.0.1:*; script-src 'self' 'unsafe-inline' http://127.0.0.1:* https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://unpkg.com https://esm.sh; style-src 'self' 'unsafe-inline' http://127.0.0.1:* https://cdnjs.cloudflare.com https://fonts.googleapis.com; font-src 'self' http://127.0.0.1:* https://fonts.gstatic.com; img-src 'self' data: blob: http://127.0.0.1:* https:; connect-src 'self' http://127.0.0.1:* ws://127.0.0.1:*;"
"csp": "default-src 'self' http://127.0.0.1:*; script-src 'self' 'unsafe-inline' 'unsafe-eval' http://127.0.0.1:* https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://unpkg.com https://esm.sh; style-src 'self' 'unsafe-inline' http://127.0.0.1:* https://cdnjs.cloudflare.com https://fonts.googleapis.com; font-src 'self' http://127.0.0.1:* https://fonts.gstatic.com; img-src 'self' data: blob: http://127.0.0.1:* https:; connect-src 'self' http://127.0.0.1:* ws://127.0.0.1:*;"
},
"trayIcon": {
"iconPath": "icons/icon.png",