Skip to content

Commit

Permalink
require firewall permission at install for node.exe - fixes #1200 (re…
Browse files Browse the repository at this point in the history
…lies on local copy of nsis firewall plugin)
  • Loading branch information
Dane Springmeyer committed Jan 23, 2012
1 parent 9997b75 commit 4ddd389
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions platforms/windows/installer/nsis_script.nsi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; Script generated by the HM NIS Edit Script Wizard.
; TileMill nsis installer script

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "TileMill"
Expand All @@ -9,6 +9,12 @@
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"

; firewall extras
!addplugindir "nsisFirewall"
!include "FileFunc.nsh"

RequestExecutionLevel admin

; MUI 1.67 compatible ------
!include "MUI.nsh"

Expand Down Expand Up @@ -61,6 +67,16 @@ Section "MainSection" SEC01

SectionEnd

; Add firewall rule
Section "Add Windows Firewall Rule"
; Add TileMill to the authorized list
nsisFirewall::AddAuthorizedApplication "$INSTDIR\node.exe" "Evented I/O for V8 JavaScript"
Pop $0
IntCmp $0 0 +3
MessageBox MB_OK "A problem happened while adding Node.exe (used by TileMill) to the Firewall exception list (result=$0)"
Return
SectionEnd

Section -AdditionalIcons
SetOutPath $INSTDIR
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
Expand All @@ -71,7 +87,7 @@ Section -AdditionalIcons
SW_SHOWNORMAL \
ALT|CONTROL|t "TileMill"

CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\Uninstall-TileMill.exe"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall TileMill.lnk" "$INSTDIR\Uninstall-TileMill.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Expand All @@ -96,12 +112,20 @@ Function un.onInit
FunctionEnd

Section Uninstall
SetShellVarContext all
; Remove Node.js from the authorized list
nsisFirewall::RemoveAuthorizedApplication "$INSTDIR\node.exe"
Pop $0
IntCmp $0 0 +3
MessageBox MB_OK "A problem happened while removing Node.exe (used by TileMill) from the Firewall exception list (result=$0)"
Return

Delete "$INSTDIR\Uninstall-TileMill.exe"
RMDir /r "$INSTDIR\*.*"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall TileMill.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Start TileMill.lnk"
RMDir /r "$SMPROGRAMS\$ICONS_GROUP"
!insertmacro MUI_STARTMENU_WRITE_END
Expand Down

0 comments on commit 4ddd389

Please sign in to comment.