Make nsis match better

This commit is contained in:
K4sum1 2025-03-24 18:11:32 -07:00
commit b43a601654
5 changed files with 42 additions and 100 deletions

View file

@ -34,6 +34,7 @@ RequestExecutionLevel user
Var TmpVal
Var InstallType
Var AddStartMenuSC
Var AddTaskbarSC
Var AddQuickLaunchSC
Var AddDesktopSC
Var InstallMaintenanceService
@ -92,6 +93,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe"
!insertmacro InitHashAppModelId
!insertmacro IsHandlerForInstallDir
!insertmacro IsPinnedToTaskBar
!insertmacro IsUserAdmin
!insertmacro LogDesktopShortcut
!insertmacro LogQuickLaunchShortcut
!insertmacro LogStartMenuShortcut
@ -399,10 +401,12 @@ Section "-Application" APP_IDX
; If we are writing to HKLM and create either the desktop or start menu
; shortcuts set IconsVisible to 1 otherwise to 0.
; Taskbar shortcuts imply having a start menu shortcut.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
${If} $AddDesktopSC == 1
${OrIf} $AddStartMenuSC == 1
${OrIf} $AddTaskbarSC == 1
WriteRegDWORD HKLM "$0" "IconsVisible" 1
${Else}
WriteRegDWORD HKLM "$0" "IconsVisible" 0
@ -416,10 +420,12 @@ Section "-Application" APP_IDX
; If we create either the desktop or start menu shortcuts, then
; set IconsVisible to 1 otherwise to 0.
; Taskbar shortcuts imply having a start menu shortcut.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
${If} $AddDesktopSC == 1
${OrIf} $AddStartMenuSC == 1
${OrIf} $AddTaskbarSC == 1
WriteRegDWORD HKCU "$0" "IconsVisible" 1
${Else}
WriteRegDWORD HKCU "$0" "IconsVisible" 0
@ -1088,7 +1094,9 @@ Function .onInit
; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
; removed after we require NSIS 3.0a2 or greater.
!ifndef NSIS_PACKEDVERSION
System::Call 'user32::SetProcessDPIAware()'
${If} ${AtLeastWinVista}
System::Call 'user32::SetProcessDPIAware()'
${EndIf}
!endif
!insertmacro InitInstallOptionsFile "options.ini"

View file

@ -322,9 +322,11 @@
WriteRegStr SHCTX "$0\.xhtml" "" "PaleMoonHTML"
${EndIf}
${AddAssociationIfNoneExist} ".pdf"
${AddAssociationIfNoneExist} ".oga"
${AddAssociationIfNoneExist} ".ogg"
${AddAssociationIfNoneExist} ".ogv"
${AddAssociationIfNoneExist} ".pdf"
${AddAssociationIfNoneExist} ".webm"
; An empty string is used for the 5th param because PaleMoonHTML is not a
@ -620,9 +622,11 @@
${EndIf}
; Remove possibly badly associated file types
${FixBadFileAssociation} ".pdf"
${FixBadFileAssociation} ".oga"
${FixBadFileAssociation} ".ogg"
${FixBadFileAssociation} ".ogv"
${FixBadFileAssociation} ".pdf"
${FixBadFileAssociation} ".webm"
!macroend
!define FixClassKeys "!insertmacro FixClassKeys"
@ -840,17 +844,24 @@
ClearErrors
WriteIniStr "$0" "TASKBAR" "Migrated" "true"
${If} ${AtLeastWin7}
; No need to check the default on Win8 and later
${If} ${AtMostWin2008R2}
; Check if the Pale Moon is the http handler for this user
SetShellVarContext current ; Set SHCTX to the current user
${IsHandlerForInstallDir} "http" $R9
${If} $TmpVal == "HKLM"
SetShellVarContext all ; Set SHCTX to all users
; If we didn't run the stub installer, AddTaskbarSC will be empty.
; We determine whether to pin based on whether we're the default
; browser, or if we're on win8 or later, we always pin.
${If} $AddTaskbarSC == ""
; No need to check the default on Win8 and later
${If} ${AtMostWin2008R2}
; Check if the Basilisk is the http handler for this user
SetShellVarContext current ; Set SHCTX to the current user
${IsHandlerForInstallDir} "http" $R9
${If} $TmpVal == "HKLM"
SetShellVarContext all ; Set SHCTX to all users
${EndIf}
${EndIf}
${EndIf}
${If} "$R9" == "true"
${OrIf} ${AtLeastWin8}
${If} "$R9" == "true"
${OrIf} ${AtLeastWin8}
${PinToTaskBar}
${EndIf}
${ElseIf} $AddTaskbarSC == "1"
${PinToTaskBar}
${EndIf}
${EndIf}

View file

@ -75,6 +75,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe"
!insertmacro InitHashAppModelId
!insertmacro IsHandlerForInstallDir
!insertmacro IsPinnedToTaskBar
!insertmacro IsUserAdmin
!insertmacro LogDesktopShortcut
!insertmacro LogQuickLaunchShortcut
!insertmacro LogStartMenuShortcut
@ -245,6 +246,7 @@ Section "Uninstall"
${un.RegCleanFileHandler} ".oga" "PaleMoonHTML"
${un.RegCleanFileHandler} ".ogg" "PaleMoonHTML"
${un.RegCleanFileHandler} ".ogv" "PaleMoonHTML"
${un.RegCleanFileHandler} ".pdf" "PaleMoonHTML"
${un.RegCleanFileHandler} ".webm" "PaleMoonHTML"
${EndIf}