Autostart-Setup-Skript, README aktualisiert

This commit is contained in:
dimedtec 2026-08-28 18:12:43 +02:00
parent cd2cf5d1bb
commit 3500d75b42
2 changed files with 43 additions and 3 deletions

View file

@ -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.

View file

@ -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