Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added resources/Archivo-Regular.ttf
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dependencies:
- openjdk==22.0.1
- git==2.46.2
- pip:
- ./aymurai-1.1.10-py3-none-any.whl
- ./aymurai-1.1.11-py3-none-any.whl
4 changes: 2 additions & 2 deletions scripts/headers/install_backend.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
SetOutPath $INSTDIR

; Copy installation files
File "${SOURCE_DIR}\aymurai-1.1.10-py3-none-any.whl"
File "${SOURCE_DIR}\aymurai-1.1.11-py3-none-any.whl"
File "${SOURCE_DIR}\environment.yml"
File "${SOURCE_DIR}\install.bat"
File "${SOURCE_DIR}\run_server.bat"
Expand All @@ -34,7 +34,7 @@

; Remove installation files
DetailPrint "Removing installation files..."
Delete "$INSTDIR\aymurai-1.1.10-py3-none-any.whl"
Delete "$INSTDIR\aymurai-1.1.11-py3-none-any.whl"
Delete "$INSTDIR\install.bat"

; Write installation path to registry
Expand Down
28 changes: 26 additions & 2 deletions scripts/headers/install_frontend.nsh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
; Frontend Installation Header

!define FRONTEND_URL "https://github.com/AymurAI/desktop-app/releases/download/1.20.2/AymurAI-win32-x64-1-20-2.zip"
!define ARCHIVO_FONT "..\resources\Archivo-Regular.ttf"

!macro InstallFrontend
; Check if frontend is already installed
IfFileExists "$INSTDIR\${APP_NAME}.exe" frontend_skip_download frontend_download

frontend_skip_download:
DetailPrint "Frontend is already installed."
Goto finish
Goto install_archivo_font

frontend_download:
; Set output path
Expand Down Expand Up @@ -57,7 +58,30 @@

frontend_success:
DetailPrint "Frontend installation successful."


install_archivo_font:
; Check if any Archivo font already exists in Windows Fonts
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy Bypass -Command "$props = (Get-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\").PSObject.Properties.Name | Where-Object { $_ -like \"Archivo*\" }; if ($props) { exit 0 } else { exit 1 }"'
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using -ExecutionPolicy Bypass disables PowerShell's execution policy security feature. Consider using a more restrictive execution policy or implementing alternative font detection methods.

Suggested change
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy Bypass -Command "$props = (Get-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\").PSObject.Properties.Name | Where-Object { $_ -like \"Archivo*\" }; if ($props) { exit 0 } else { exit 1 }"'
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy RemoteSigned -Command "$props = (Get-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\").PSObject.Properties.Name | Where-Object { $_ -like \"Archivo*\" }; if ($props) { exit 0 } else { exit 1 }"'

Copilot uses AI. Check for mistakes.
Pop $0
StrCmp $0 "0" finish archivo_font_install
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): PowerShell registry check may require elevation and could fail silently.

Since HKLM access often requires admin rights, the registry check may fail or give incorrect results if run without elevation. Please ensure permission errors are detected and communicated to the user.


archivo_font_install:
; Copy Archivo font file
DetailPrint "Installing Archivo font..."
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"

; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Copying directly to C:\Windows\Fonts may fail without admin rights.

Check for administrator privileges before copying the font, or implement a fallback if elevation is not available.

Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded system path 'C:\Windows\Fonts' may not work on all Windows installations. Consider using environment variables like '%WINDIR%\Fonts' or PowerShell's $env:SystemRoot for better compatibility.

Suggested change
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"$env:SystemRoot\Fonts\" -Force"'

Copilot uses AI. Check for mistakes.

; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."

; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"

Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying HKLM registry requires administrator privileges. The installation should verify elevated permissions before attempting registry modifications, or handle potential access denied errors gracefully.

Suggested change
archivo_font_install:
; Copy Archivo font file
DetailPrint "Installing Archivo font..."
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"
; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."
; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"
archivo_font_install:
; Check for administrator privileges before modifying HKLM
UserInfo::GetAccountType
Pop $0
StrCmp $0 "admin" 0 not_admin
; Copy Archivo font file
DetailPrint "Installing Archivo font..."
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"
; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
; Add registry entry for the font
nsExec::ExecToStack 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
Pop $1
StrCmp $1 "0" font_reg_success font_reg_fail
font_reg_fail:
MessageBox MB_OK|MB_ICONEXCLAMATION "Failed to add font registry entry. Please run the installer as administrator."
Abort
font_reg_success:
DetailPrint "Archivo font installed successfully."
; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"
Goto finish
not_admin:
MessageBox MB_OK|MB_ICONEXCLAMATION "Administrator privileges are required to install the Archivo font. Please run the installer as administrator."
Abort

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The font file is copied to $INSTDIR temporarily and then deleted. Consider copying directly to the destination to avoid unnecessary file operations and potential cleanup issues if the installation fails.

Suggested change
SetOutPath $INSTDIR
File "${ARCHIVO_FONT}"
; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"$INSTDIR\Archivo-Regular.ttf\" -Destination \"C:\Windows\Fonts\" -Force"'
; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."
; Remove Archivo font file
DetailPrint "Removing temporary Archivo font file..."
Delete "$INSTDIR\Archivo-Regular.ttf"
; Copy Archivo font file to Windows Fonts
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "Copy-Item -Path \"${ARCHIVO_FONT}\" -Destination \"C:\Windows\Fonts\" -Force"'
; Add registry entry for the font
nsExec::ExecToLog 'powershell -NoProfile -ExecutionPolicy Bypass -Command "New-ItemProperty -Path \"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" -Name \"Archivo (TrueType)\" -PropertyType String -Value \"Archivo-Regular.ttf\" -Force"'
DetailPrint "Archivo font installed successfully."

Copilot uses AI. Check for mistakes.
finish:
; No further actions needed here
!macroend