|
| 1 | +# DO NOT EDIT - Generated automatically by `wails build` |
| 2 | + |
| 3 | +!include "x64.nsh" |
| 4 | +!include "WinVer.nsh" |
| 5 | +!include "FileFunc.nsh" |
| 6 | + |
| 7 | +!ifndef INFO_PROJECTNAME |
| 8 | + !define INFO_PROJECTNAME "MarkViewPro" |
| 9 | +!endif |
| 10 | +!ifndef INFO_COMPANYNAME |
| 11 | + !define INFO_COMPANYNAME "MarkViewPro" |
| 12 | +!endif |
| 13 | +!ifndef INFO_PRODUCTNAME |
| 14 | + !define INFO_PRODUCTNAME "MarkViewPro" |
| 15 | +!endif |
| 16 | +!ifndef INFO_PRODUCTVERSION |
| 17 | + !define INFO_PRODUCTVERSION "1.4.5" |
| 18 | +!endif |
| 19 | +!ifndef INFO_COPYRIGHT |
| 20 | + !define INFO_COPYRIGHT "Copyright © 2024 MarkViewPro Contributors" |
| 21 | +!endif |
| 22 | +!ifndef PRODUCT_EXECUTABLE |
| 23 | + !define PRODUCT_EXECUTABLE "${INFO_PROJECTNAME}.exe" |
| 24 | +!endif |
| 25 | +!ifndef UNINST_KEY_NAME |
| 26 | + !define UNINST_KEY_NAME "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}" |
| 27 | +!endif |
| 28 | +!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINST_KEY_NAME}" |
| 29 | + |
| 30 | +!ifndef REQUEST_EXECUTION_LEVEL |
| 31 | + !define REQUEST_EXECUTION_LEVEL "admin" |
| 32 | +!endif |
| 33 | + |
| 34 | +RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}" |
| 35 | + |
| 36 | +!ifdef ARG_WAILS_AMD64_BINARY |
| 37 | + !define SUPPORTS_AMD64 |
| 38 | +!endif |
| 39 | + |
| 40 | +!ifdef ARG_WAILS_ARM64_BINARY |
| 41 | + !define SUPPORTS_ARM64 |
| 42 | +!endif |
| 43 | + |
| 44 | +!ifdef SUPPORTS_AMD64 |
| 45 | + !ifdef SUPPORTS_ARM64 |
| 46 | + !define ARCH "amd64_arm64" |
| 47 | + !else |
| 48 | + !define ARCH "amd64" |
| 49 | + !endif |
| 50 | +!else |
| 51 | + !ifdef SUPPORTS_ARM64 |
| 52 | + !define ARCH "arm64" |
| 53 | + !else |
| 54 | + !error "Wails: Undefined ARCH, please provide at least one of ARG_WAILS_AMD64_BINARY or ARG_WAILS_ARM64_BINARY" |
| 55 | + !endif |
| 56 | +!endif |
| 57 | + |
| 58 | +!macro wails.checkArchitecture |
| 59 | + !ifndef WAILS_WIN10_REQUIRED |
| 60 | + !define WAILS_WIN10_REQUIRED "This product is only supported on Windows 10 (Server 2016) and later." |
| 61 | + !endif |
| 62 | + |
| 63 | + !ifndef WAILS_ARCHITECTURE_NOT_SUPPORTED |
| 64 | + !define WAILS_ARCHITECTURE_NOT_SUPPORTED "This product can't be installed on the current Windows architecture. Supports: ${ARCH}" |
| 65 | + !endif |
| 66 | + |
| 67 | + ${If} ${AtLeastWin10} |
| 68 | + !ifdef SUPPORTS_AMD64 |
| 69 | + ${if} ${IsNativeAMD64} |
| 70 | + Goto ok |
| 71 | + ${EndIf} |
| 72 | + !endif |
| 73 | + |
| 74 | + !ifdef SUPPORTS_ARM64 |
| 75 | + ${if} ${IsNativeARM64} |
| 76 | + Goto ok |
| 77 | + ${EndIf} |
| 78 | + !endif |
| 79 | + |
| 80 | + IfSilent silentArch notSilentArch |
| 81 | + silentArch: |
| 82 | + SetErrorLevel 65 |
| 83 | + Abort |
| 84 | + notSilentArch: |
| 85 | + MessageBox MB_OK "${WAILS_ARCHITECTURE_NOT_SUPPORTED}" |
| 86 | + Quit |
| 87 | + ${else} |
| 88 | + IfSilent silentWin notSilentWin |
| 89 | + silentWin: |
| 90 | + SetErrorLevel 64 |
| 91 | + Abort |
| 92 | + notSilentWin: |
| 93 | + MessageBox MB_OK "${WAILS_WIN10_REQUIRED}" |
| 94 | + Quit |
| 95 | + ${EndIf} |
| 96 | + |
| 97 | + ok: |
| 98 | +!macroend |
| 99 | + |
| 100 | +!macro wails.files |
| 101 | + !ifdef SUPPORTS_AMD64 |
| 102 | + ${if} ${IsNativeAMD64} |
| 103 | + File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_AMD64_BINARY}" |
| 104 | + ${EndIf} |
| 105 | + !endif |
| 106 | + |
| 107 | + !ifdef SUPPORTS_ARM64 |
| 108 | + ${if} ${IsNativeARM64} |
| 109 | + File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_ARM64_BINARY}" |
| 110 | + ${EndIf} |
| 111 | + !endif |
| 112 | +!macroend |
| 113 | + |
| 114 | +!macro wails.writeUninstaller |
| 115 | + WriteUninstaller "$INSTDIR\uninstall.exe" |
| 116 | + |
| 117 | + SetRegView 64 |
| 118 | + WriteRegStr HKLM "${UNINST_KEY}" "Publisher" "${INFO_COMPANYNAME}" |
| 119 | + WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "${INFO_PRODUCTNAME}" |
| 120 | + WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${INFO_PRODUCTVERSION}" |
| 121 | + WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXECUTABLE}" |
| 122 | + WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" |
| 123 | + WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" |
| 124 | + |
| 125 | + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 |
| 126 | + IntFmt $0 "0x%08X" $0 |
| 127 | + WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0" |
| 128 | +!macroend |
| 129 | + |
| 130 | +!macro wails.deleteUninstaller |
| 131 | + Delete "$INSTDIR\uninstall.exe" |
| 132 | + |
| 133 | + SetRegView 64 |
| 134 | + DeleteRegKey HKLM "${UNINST_KEY}" |
| 135 | +!macroend |
| 136 | + |
| 137 | +!macro wails.setShellContext |
| 138 | + ${If} ${REQUEST_EXECUTION_LEVEL} == "admin" |
| 139 | + SetShellVarContext all |
| 140 | + ${else} |
| 141 | + SetShellVarContext current |
| 142 | + ${EndIf} |
| 143 | +!macroend |
| 144 | + |
| 145 | +# Install webview2 by launching the bootstrapper |
| 146 | +# See https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment |
| 147 | +!macro wails.webview2runtime |
| 148 | + !ifndef WAILS_INSTALL_WEBVIEW_DETAILPRINT |
| 149 | + !define WAILS_INSTALL_WEBVIEW_DETAILPRINT "Installing: WebView2 Runtime" |
| 150 | + !endif |
| 151 | + |
| 152 | + SetRegView 64 |
| 153 | + # If the admin key exists and is not empty then webview2 is already installed |
| 154 | + ReadRegStr $0 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv" |
| 155 | + ${If} $0 != "" |
| 156 | + Goto ok |
| 157 | + ${EndIf} |
| 158 | + |
| 159 | + ${If} ${REQUEST_EXECUTION_LEVEL} == "user" |
| 160 | + # If the installer is run in user level, check the user specific key exists and is not empty then webview2 is already installed |
| 161 | + ReadRegStr $0 HKCU "Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv" |
| 162 | + ${If} $0 != "" |
| 163 | + Goto ok |
| 164 | + ${EndIf} |
| 165 | + ${EndIf} |
| 166 | + |
| 167 | + SetDetailsPrint both |
| 168 | + DetailPrint "${WAILS_INSTALL_WEBVIEW_DETAILPRINT}" |
| 169 | + SetDetailsPrint listonly |
| 170 | + |
| 171 | + InitPluginsDir |
| 172 | + CreateDirectory "$pluginsdir\webview2bootstrapper" |
| 173 | + SetOutPath "$pluginsdir\webview2bootstrapper" |
| 174 | + File "tmp\MicrosoftEdgeWebview2Setup.exe" |
| 175 | + ExecWait '"$pluginsdir\webview2bootstrapper\MicrosoftEdgeWebview2Setup.exe" /silent /install' |
| 176 | + |
| 177 | + SetDetailsPrint both |
| 178 | + ok: |
| 179 | +!macroend |
| 180 | + |
| 181 | +# Copy of APP_ASSOCIATE and APP_UNASSOCIATE macros from here https://gist.github.com/nikku/281d0ef126dbc215dd58bfd5b3a5cd5b |
| 182 | +!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND |
| 183 | + ; Backup the previously associated file class |
| 184 | + ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" "" |
| 185 | + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0" |
| 186 | + |
| 187 | + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}" |
| 188 | + |
| 189 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}` |
| 190 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}` |
| 191 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" "open" |
| 192 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}` |
| 193 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}` |
| 194 | +!macroend |
| 195 | + |
| 196 | +!macro APP_UNASSOCIATE EXT FILECLASS |
| 197 | + ; Backup the previously associated file class |
| 198 | + ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup` |
| 199 | + WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0" |
| 200 | + |
| 201 | + DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}` |
| 202 | +!macroend |
| 203 | + |
| 204 | +!macro wails.associateFiles |
| 205 | + ; Create file associations |
| 206 | + |
| 207 | +!macroend |
| 208 | + |
| 209 | +!macro wails.unassociateFiles |
| 210 | + ; Delete app associations |
| 211 | + |
| 212 | +!macroend |
| 213 | + |
| 214 | +!macro CUSTOM_PROTOCOL_ASSOCIATE PROTOCOL DESCRIPTION ICON COMMAND |
| 215 | + DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}" |
| 216 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "" "${DESCRIPTION}" |
| 217 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "URL Protocol" "" |
| 218 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\DefaultIcon" "" "${ICON}" |
| 219 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell" "" "" |
| 220 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open" "" "" |
| 221 | + WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open\command" "" "${COMMAND}" |
| 222 | +!macroend |
| 223 | + |
| 224 | +!macro CUSTOM_PROTOCOL_UNASSOCIATE PROTOCOL |
| 225 | + DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}" |
| 226 | +!macroend |
| 227 | + |
| 228 | +!macro wails.associateCustomProtocols |
| 229 | + ; Create custom protocols associations |
| 230 | + |
| 231 | +!macroend |
| 232 | + |
| 233 | +!macro wails.unassociateCustomProtocols |
| 234 | + ; Delete app custom protocol associations |
| 235 | + |
| 236 | +!macroend |
0 commit comments