This commit is contained in:
2026-05-16 20:33:36 +02:00
parent 96c1029d91
commit 968bf7d102
212 changed files with 954195 additions and 658 deletions

View File

@@ -0,0 +1,4 @@
backup_profile_sync_empfang_shell_20260514_141559
Kopien: basis14.py, empfang_routes.py, installer/aza_installer.iss, build_installer.ps1
Rollback: Dateien aus diesem Ordner ins Projekt zurueckkopieren.

View File

@@ -0,0 +1,112 @@
#define MyAppName "AZA Desktop"
#ifndef MyAppVersion
#define MyAppVersion "0.1.0"
#endif
#define MyAppPublisher "AZA MedWork"
#define MyAppExeName "aza_desktop.exe"
#define MyAppSourceDir SourcePath + "\..\dist\aza_desktop"
[Setup]
AppId={{B7E4C0D2-6B5D-4D39-9D7C-5B0D5E8C2A11}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL=https://aza-medwork.ch
DefaultDirName={autopf}\AZA Desktop
DefaultGroupName=AZA Desktop
DisableProgramGroupPage=yes
OutputDir={#MyAppSourceDir}\..\..\dist\installer
OutputBaseFilename=aza_desktop_setup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
PrivilegesRequired=admin
ArchitecturesInstallIn64BitMode=x64
UninstallDisplayIcon={app}\{#MyAppExeName}
SetupIconFile={#MyAppSourceDir}\..\..\logo.ico
SetupMutex=AZADesktopSetupMutex
CloseApplications=no
RestartApplications=no
[Languages]
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
[Tasks]
Name: "desktopicon"; Description: "Desktop-Verknuepfung erstellen"; GroupDescription: "Zusaetzliche Aufgaben:"
[Dirs]
Name: "{app}\config"; Permissions: users-modify
[InstallDelete]
Type: filesandordirs; Name: "{app}\_internal\*.pyd"
Type: filesandordirs; Name: "{app}\_internal\*.dll"
Type: files; Name: "{app}\_internal\*.tmp"
[Files]
Source: "{#MyAppSourceDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete
Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs restartreplace; Excludes: "config\aza_runtime.env,{#MyAppExeName}"
Source: "{#MyAppSourceDir}\_internal\backend_url.txt"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist
Source: "{#MyAppSourceDir}\_internal\backend_token.txt"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist
Source: "{#MyAppSourceDir}\..\..\setup_openai_runtime.ps1"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyAppSourceDir}\..\..\logo.ico"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{group}\AZA Desktop"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\logo.ico"
Name: "{autodesktop}\AZA Desktop"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\logo.ico"; Tasks: desktopicon
Name: "{group}\AZA - OpenAI Schluessel einrichten"; Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\setup_openai_runtime.ps1"""
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "AZA Desktop starten"; Flags: nowait postinstall skipifsilent
[UninstallRun]
Filename: "netsh.exe"; Parameters: "advfirewall firewall delete rule name=""AZA Desktop - Lokale Kommunikation"""; Flags: runhidden; RunOnceId: "DelFirewallRule"
[Code]
function InitializeSetup(): Boolean;
var
R: Integer;
begin
Result := True;
Exec('taskkill.exe', '/F /IM aza_desktop.exe', '', SW_HIDE, ewWaitUntilTerminated, R);
Sleep(500);
end;
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
R: Integer;
begin
Result := '';
Exec('taskkill.exe', '/F /IM aza_desktop.exe', '', SW_HIDE, ewWaitUntilTerminated, R);
Sleep(500);
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
R: Integer;
AppPath, ExePath, Cmd: String;
begin
if CurStep = ssPostInstall then
begin
AppPath := ExpandConstant('{app}');
ExePath := AddBackslash(AppPath) + 'aza_desktop.exe';
if FileExists(ExePath) then
begin
Exec('netsh.exe', 'advfirewall firewall delete rule name="AZA Desktop - Lokale Kommunikation"', '', SW_HIDE, ewWaitUntilTerminated, R);
Sleep(200);
Cmd := 'advfirewall firewall add rule name="AZA Desktop - Lokale Kommunikation" dir=in action=allow program="' + ExePath + '" localport=8000 protocol=tcp remoteip=127.0.0.1';
if not Exec('netsh.exe', Cmd, '', SW_HIDE, ewWaitUntilTerminated, R) or (R <> 0) then
Log('Firewall-Regel konnte nicht angelegt werden (Code: ' + IntToStr(R) + ')');
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
UserDataDir: String;
begin
if CurUninstallStep = usPostUninstall then
begin
UserDataDir := ExpandConstant('{userappdata}\AZA Desktop');
Log('AZA Desktop deinstalliert. Persoenliche Daten bleiben unter "' + UserDataDir + '" erhalten (kein automatisches Loeschen).');
end;
end;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,198 @@
$projectRoot = $PSScriptRoot
$innoScript = Join-Path $projectRoot "installer\aza_installer.iss"
$setupOutput = Join-Path $projectRoot "dist\installer\aza_desktop_setup.exe"
$versionMetaDir = Join-Path $projectRoot "dist\installer_meta"
$versionMetaFile = Join-Path $versionMetaDir "aza_version_info.txt"
$azaVersionPy = Join-Path $projectRoot "aza_version.py"
function Find-InnoSetup {
$candidates = @(
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
"${env:ProgramFiles}\Inno Setup 6\ISCC.exe",
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
"C:\Program Files\Inno Setup 6\ISCC.exe",
"${env:LOCALAPPDATA}\Programs\Inno Setup 6\ISCC.exe"
)
foreach ($path in $candidates) {
if ($path -and (Test-Path $path)) {
return $path
}
}
$regPaths = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1",
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1",
"HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1"
)
foreach ($regPath in $regPaths) {
try {
$installLocation = (Get-ItemProperty $regPath -ErrorAction SilentlyContinue).InstallLocation
if ($installLocation) {
$iscc = Join-Path $installLocation "ISCC.exe"
if (Test-Path $iscc) {
return $iscc
}
}
} catch {}
}
$isccInPath = Get-Command "ISCC.exe" -ErrorAction SilentlyContinue
if ($isccInPath) {
return $isccInPath.Source
}
return $null
}
function Install-InnoSetup {
$innoUrl = "https://jrsoftware.org/download.php/is.exe"
$installerPath = Join-Path $env:TEMP "innosetup6_installer.exe"
Write-Host ""
Write-Host "Inno Setup 6 wird automatisch heruntergeladen und installiert..."
Write-Host "Quelle: $innoUrl"
try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $innoUrl -OutFile $installerPath -UseBasicParsing
} catch {
Write-Error "Download von Inno Setup fehlgeschlagen: $_"
return $false
}
if (-not (Test-Path $installerPath)) {
Write-Error "Inno Setup Installer wurde nicht heruntergeladen."
return $false
}
Write-Host "Installiere Inno Setup 6 (silent)..."
$process = Start-Process -FilePath $installerPath -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART" -Wait -PassThru
if ($process.ExitCode -ne 0) {
Write-Error "Inno Setup Installation fehlgeschlagen (Exit Code: $($process.ExitCode))."
return $false
}
Write-Host "Inno Setup 6 wurde erfolgreich installiert."
return $true
}
# --- Voraussetzungen pruefen ---
if (-not (Test-Path $innoScript)) {
Write-Error "Installer-Script nicht gefunden: $innoScript"
exit 1
}
if (-not (Test-Path $azaVersionPy)) {
Write-Error "aza_version.py nicht gefunden: $azaVersionPy"
exit 1
}
if (-not (Test-Path (Join-Path $projectRoot "dist\aza_desktop\aza_desktop.exe"))) {
Write-Error "Desktop-Build nicht gefunden. Bitte zuerst build_exe.ps1 ausfuehren."
exit 1
}
# --- Inno Setup finden oder automatisch installieren ---
$innoCompiler = Find-InnoSetup
if (-not $innoCompiler) {
$installed = Install-InnoSetup
if ($installed) {
$innoCompiler = Find-InnoSetup
}
if (-not $innoCompiler) {
Write-Host ""
Write-Error "Inno Setup 6 konnte nicht gefunden oder installiert werden."
Write-Host ""
Write-Host "Bitte Inno Setup 6 manuell installieren:"
Write-Host " https://jrsoftware.org/isdl.php"
Write-Host ""
Write-Host "Danach dieses Script erneut ausfuehren."
exit 1
}
}
Write-Host "Inno Setup Compiler: $innoCompiler"
# --- Version lesen ---
if (-not (Test-Path $versionMetaDir)) {
New-Item -ItemType Directory -Path $versionMetaDir | Out-Null
}
Write-Host "Lese zentrale AZA-Version aus aza_version.py..."
$versionContent = Get-Content $azaVersionPy -Raw
if ($versionContent -match 'APP_VERSION\s*=\s*"([^"]+)"') {
$appVersion = $matches[1].Trim()
} else {
$appVersion = $null
}
if (-not $appVersion) {
Write-Error "Konnte APP_VERSION nicht aus aza_version.py lesen."
exit 1
}
Set-Content -Path $versionMetaFile -Value $appVersion -Encoding ASCII
# --- Build-Zeitstempel lesen ---
$buildTimestamp = ""
$buildInfoPy = Join-Path $projectRoot "_build_info.py"
if (Test-Path $buildInfoPy) {
$biContent = Get-Content $buildInfoPy -Raw
if ($biContent -match 'BUILD_TIMESTAMP\s*=\s*"([^"]+)"') {
$buildTimestamp = $matches[1].Trim()
}
}
if (-not $buildTimestamp) {
$buildTimestamp = (Get-Date -Format "yyyyMMdd_HHmmss")
}
# --- Ausgabe-Ordner sicherstellen ---
$outputDir = Join-Path $projectRoot "dist\installer"
if (-not (Test-Path $outputDir)) {
New-Item -ItemType Directory -Path $outputDir | Out-Null
}
# --- Installer bauen ---
Write-Host "Baue AZA Installer (Version $appVersion, Build $buildTimestamp)..."
& $innoCompiler "/DMyAppVersion=$appVersion" $innoScript
if ($LASTEXITCODE -ne 0) {
Write-Error "Installer-Build fehlgeschlagen."
exit 1
}
if (-not (Test-Path $setupOutput)) {
Write-Error "Installer wurde nicht gefunden: $setupOutput"
exit 1
}
# Installer mit Zeitstempel umbenennen
$stampedName = "aza_desktop_setup_${buildTimestamp}.exe"
$stampedPath = Join-Path $outputDir $stampedName
Copy-Item $setupOutput $stampedPath -Force
Write-Host " Installer mit Zeitstempel: $stampedName"
# BUILD_INFO.txt neben den Installer legen
$distBuildInfo = Join-Path $projectRoot "dist\aza_desktop\BUILD_INFO.txt"
if (Test-Path $distBuildInfo) {
Copy-Item $distBuildInfo (Join-Path $outputDir "BUILD_INFO.txt") -Force
Write-Host " BUILD_INFO.txt -> dist\installer\ kopiert"
}
Write-Host ""
Write-Host "Installer erfolgreich erstellt:"
Write-Host " Standard: $setupOutput"
Write-Host " Zeitstempel: $stampedPath"
Write-Host "Verwendete Version:"
Write-Host " $appVersion (Build $buildTimestamp)"