diff --git a/README.md b/README.md index 9849a56..b006619 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,15 @@ dotnet test tests\Anrufmonitor.Tests\Anrufmonitor.Tests.csproj dotnet run --project src\Anrufmonitor.App\Anrufmonitor.App.csproj ``` +## Autostart (Windows) + +```powershell +.\scripts\setup-autostart.ps1 +``` + +Baut eine Release-Version und legt eine Verknuepfung im Windows-Autostart-Ordner an +(`shell:startup`). Idempotent, kann nach jedem Update erneut ausgefuehrt werden. + ## Konfiguration `src\Anrufmonitor.App\appsettings.json` enthält nur die Struktur (keine Secrets, wird committet). @@ -42,9 +51,13 @@ Für echte Werte `appsettings.Local.json.example` nach `appsettings.Local.json` (liegt in `.gitignore`, wird beim Build automatisch mitkopiert falls vorhanden) und ausfüllen: - **Sip:** Server, Username, Password der Telefonanlage. -- **Contacts:Office365:** App-Registration in Azure/Entra (Typ *Public client*, Delegated Permission - `Contacts.Read`), `ClientId` eintragen. Anmeldung erfolgt beim ersten Sync per Device-Code-Flow - (Code wird geloggt, im Browser unter microsoft.com/devicelogin eingeben). +- **Contacts:Office365Accounts:** Liste von Office365/Outlook-Accounts (Firmen-Tenant und/oder + outlook.com/persoenliche Konten koennen parallel laufen). Pro Account: App-Registration in + Azure/Entra (Typ *Public client*, Delegated Permission `Contacts.Read`), `Name`/`TenantId`/`ClientId` + eintragen. Fuer outlook.com: `TenantId: "common"` oder `"consumers"`, und die App-Registration muss + unter Authentifizierung -> Unterstuetzte Kontotypen auch persoenliche Microsoft-Konten erlauben. + Anmeldung per Device-Code-Flow (Code wird per Tray-Benachrichtigung und im Log angezeigt, unter + microsoft.com/devicelogin eingeben). Login und Kontakt-Cache sind pro Account getrennt. - **Contacts:Google:** OAuth-Client (Typ *Desktop app*) in der Google Cloud Console, People API aktivieren, `ClientId`/`ClientSecret` eintragen. Anmeldung per Browser-Login beim ersten Sync, Token wird danach lokal zwischengespeichert. diff --git a/scripts/setup-autostart.ps1 b/scripts/setup-autostart.ps1 new file mode 100644 index 0000000..1753bba --- /dev/null +++ b/scripts/setup-autostart.ps1 @@ -0,0 +1,27 @@ +# Richtet den Windows-Autostart fuer Anrufmonitor ein (Release-Build + Verknuepfung im +# Startup-Ordner). Idempotent - kann nach jedem Update erneut ausgefuehrt werden. +$ErrorActionPreference = 'Stop' +$repoRoot = Split-Path $PSScriptRoot -Parent +$exePath = Join-Path $repoRoot "src\Anrufmonitor.App\bin\Release\net10.0-windows\Anrufmonitor.App.exe" + +Write-Host "== Release-Build ==" -ForegroundColor Cyan +dotnet build (Join-Path $repoRoot "src\Anrufmonitor.App\Anrufmonitor.App.csproj") -c Release + +if (-not (Test-Path $exePath)) { + throw "Build-Ausgabe nicht gefunden: $exePath" +} + +$startupDir = [Environment]::GetFolderPath('Startup') +$shortcutPath = Join-Path $startupDir "Anrufmonitor.lnk" + +Write-Host "== Autostart-Verknuepfung ==" -ForegroundColor Cyan +$shell = New-Object -ComObject WScript.Shell +$shortcut = $shell.CreateShortcut($shortcutPath) +$shortcut.TargetPath = $exePath +$shortcut.WorkingDirectory = Split-Path $exePath +$shortcut.Description = "Anrufmonitor - SIP Caller-ID" +$shortcut.Save() + +Write-Host "Fertig: $shortcutPath -> $exePath" -ForegroundColor Green +Write-Host "Hinweis: appsettings.Local.json muss im Release-Ordner liegen (wird beim Build" -ForegroundColor Yellow +Write-Host " automatisch mitkopiert, falls sie in src\Anrufmonitor.App\ vorhanden ist)." -ForegroundColor Yellow