Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a47af1b37d | ||
|
|
3777373d71 | ||
|
|
ef32c23a5d | ||
|
|
e07d389759 | ||
|
|
e31197f649 |
No files matched your search
+1
-4
@@ -4,7 +4,7 @@ root = true
|
|||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
@@ -13,6 +13,3 @@ max_line_length = 100
|
|||||||
[*.md]
|
[*.md]
|
||||||
max_line_length = off
|
max_line_length = off
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[*.{rs,java,kts}]
|
|
||||||
indent_size = 4
|
|
||||||
@@ -76,10 +76,10 @@ const installing = ref(false)
|
|||||||
const onInstall = ref(() => {})
|
const onInstall = ref(() => {})
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
show: (instanceVal, projectVal, projectVersions, callback) => {
|
show: (instanceVal, projectVal, projectVersions, selected, callback) => {
|
||||||
instance.value = instanceVal
|
instance.value = instanceVal
|
||||||
versions.value = projectVersions
|
versions.value = projectVersions
|
||||||
selectedVersion.value = projectVersions[0]
|
selectedVersion.value = selected ?? projectVersions[0]
|
||||||
|
|
||||||
project.value = projectVal
|
project.value = projectVal
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ export const useInstall = defineStore('installStore', {
|
|||||||
setIncompatibilityWarningModal(ref) {
|
setIncompatibilityWarningModal(ref) {
|
||||||
this.incompatibilityWarningModal = ref
|
this.incompatibilityWarningModal = ref
|
||||||
},
|
},
|
||||||
showIncompatibilityWarningModal(instance, project, versions, onInstall) {
|
showIncompatibilityWarningModal(instance, project, versions, selected, onInstall) {
|
||||||
this.incompatibilityWarningModal.show(instance, project, versions, onInstall)
|
this.incompatibilityWarningModal.show(instance, project, versions, selected, onInstall)
|
||||||
},
|
},
|
||||||
setModInstallModal(ref) {
|
setModInstallModal(ref) {
|
||||||
this.modInstallModal = ref
|
this.modInstallModal = ref
|
||||||
@@ -133,7 +133,13 @@ export const install = async (
|
|||||||
callback(version.id)
|
callback(version.id)
|
||||||
} else {
|
} else {
|
||||||
const install = useInstall()
|
const install = useInstall()
|
||||||
install.showIncompatibilityWarningModal(instance, project, projectVersions, callback)
|
install.showIncompatibilityWarningModal(
|
||||||
|
instance,
|
||||||
|
project,
|
||||||
|
projectVersions,
|
||||||
|
version,
|
||||||
|
callback,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const versions = (await get_version_many(project.versions).catch(handleError)).sort(
|
const versions = (await get_version_many(project.versions).catch(handleError)).sort(
|
||||||
|
|||||||
+58
-32
@@ -1,41 +1,67 @@
|
|||||||
!macro NSIS_HOOK_POSTINSTALL
|
; https://nsis.sourceforge.io/ShellExecWait
|
||||||
SetShellVarContext current
|
!macro ShellExecWait verb app param workdir show exitoutvar ;only app and show must be != "", every thing else is optional
|
||||||
|
#define SEE_MASK_NOCLOSEPROCESS 0x40
|
||||||
IfFileExists "$LOCALAPPDATA${PRODUCTNAME}\theseus_gui.exe" file_found file_not_found
|
System::Store S
|
||||||
file_found:
|
!if "${NSIS_PTR_SIZE}" > 4
|
||||||
Delete "$LOCALAPPDATA${PRODUCTNAME}\theseus_gui.exe"
|
!define /ReDef /math SYSSIZEOF_SHELLEXECUTEINFO 14 * ${NSIS_PTR_SIZE}
|
||||||
|
!else ifndef SYSSIZEOF_SHELLEXECUTEINFO
|
||||||
|
!define SYSSIZEOF_SHELLEXECUTEINFO 60
|
||||||
|
!endif
|
||||||
|
System::Call '*(&i${SYSSIZEOF_SHELLEXECUTEINFO})i.r0'
|
||||||
|
System::Call '*$0(i ${SYSSIZEOF_SHELLEXECUTEINFO},i 0x40,p $hwndparent,t "${verb}",t $\'${app}$\',t $\'${param}$\',t "${workdir}",i ${show})p.r0'
|
||||||
|
System::Call 'shell32::ShellExecuteEx(t)(pr0)i.r1 ?e' ; (t) to trigger A/W selection
|
||||||
|
${If} $1 <> 0
|
||||||
|
System::Call '*$0(is,i,p,p,p,p,p,p,p,p,p,p,p,p,p.r1)' ;stack value not really used, just a fancy pop ;)
|
||||||
|
System::Call 'kernel32::WaitForSingleObject(pr1,i-1)'
|
||||||
|
System::Call 'kernel32::GetExitCodeProcess(pr1,*i.s)'
|
||||||
|
System::Call 'kernel32::CloseHandle(pr1)'
|
||||||
|
${EndIf}
|
||||||
|
System::Free $0
|
||||||
|
!if "${exitoutvar}" == ""
|
||||||
|
pop $0
|
||||||
|
!endif
|
||||||
|
System::Store L
|
||||||
|
!if "${exitoutvar}" != ""
|
||||||
|
pop ${exitoutvar}
|
||||||
|
!endif
|
||||||
|
!macroend
|
||||||
|
|
||||||
Delete "$LOCALAPPDATA${PRODUCTNAME}\uninstall.exe"
|
; --------------------------------------------------------------------------------
|
||||||
RMDir "$LOCALAPPDATA${PRODUCTNAME}"
|
|
||||||
|
|
||||||
!insertmacro DeleteAppUserModelId
|
Var /GLOBAL OldInstallDir
|
||||||
|
|
||||||
; Remove start menu shortcut
|
!macro NSIS_HOOK_PREINSTALL
|
||||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $AppStartMenuFolder
|
SetShellVarContext all
|
||||||
!insertmacro IsShortcutTarget "$SMPROGRAMS$AppStartMenuFolder${PRODUCTNAME}.lnk" "$LOCALAPPDATA${PRODUCTNAME}\theseus_gui.exe"
|
${If} ${FileExists} "$SMPROGRAMS\${PRODUCTNAME}.lnk"
|
||||||
|
UserInfo::GetAccountType
|
||||||
Pop $0
|
Pop $0
|
||||||
${If} $0 = 1
|
${If} $0 != "Admin"
|
||||||
!insertmacro UnpinShortcut "$SMPROGRAMS$AppStartMenuFolder${PRODUCTNAME}.lnk"
|
MessageBox MB_ICONINFORMATION|MB_OK "An old installation of the Modrinth App was detected that requires administrator permission to update from. You will be prompted with an admin prompt shortly."
|
||||||
Delete "$SMPROGRAMS$AppStartMenuFolder${PRODUCTNAME}.lnk"
|
|
||||||
RMDir "$SMPROGRAMS$AppStartMenuFolder"
|
|
||||||
${EndIf}
|
${EndIf}
|
||||||
!insertmacro IsShortcutTarget "$SMPROGRAMS${PRODUCTNAME}.lnk" "$LOCALAPPDATA${PRODUCTNAME}\theseus_gui.exe"
|
|
||||||
Pop $0
|
ReadRegStr $4 SHCTX "${MANUPRODUCTKEY}" ""
|
||||||
${If} $0 = 1
|
ReadRegStr $R1 SHCTX "${UNINSTKEY}" "UninstallString"
|
||||||
!insertmacro UnpinShortcut "$SMPROGRAMS${PRODUCTNAME}.lnk"
|
|
||||||
Delete "$SMPROGRAMS${PRODUCTNAME}.lnk"
|
ReadRegStr $OldInstallDir SHCTX "${UNINSTKEY}" "InstallLocation"
|
||||||
${EndIf}
|
StrCpy $OldInstallDir $OldInstallDir "" 1
|
||||||
|
StrCpy $OldInstallDir $OldInstallDir -1 ""
|
||||||
|
|
||||||
!insertmacro IsShortcutTarget "$DESKTOP${PRODUCTNAME}.lnk" "$LOCALAPPDATA${PRODUCTNAME}\theseus_gui.exe"
|
DetailPrint "Executing $R1"
|
||||||
Pop $0
|
!insertmacro ShellExecWait "runas" '$R1' '/P _?=$4' "" ${SW_SHOW} $3
|
||||||
${If} $0 = 1
|
${If} $3 <> 0
|
||||||
!insertmacro UnpinShortcut "$DESKTOP${PRODUCTNAME}.lnk"
|
SetErrorLevel $3
|
||||||
Delete "$DESKTOP${PRODUCTNAME}.lnk"
|
MessageBox MB_ICONEXCLAMATION|MB_OK "Failed to uninstall old global installation"
|
||||||
|
Abort
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
SetShellVarContext current
|
||||||
|
!macroend
|
||||||
|
|
||||||
DeleteRegKey HKCU "${UNINSTKEY}"
|
!macro NSIS_HOOK_POSTINSTALL
|
||||||
|
!insertmacro IsShortcutTarget "$DESKTOP\${PRODUCTNAME}.lnk" "$OldInstallDir\${MAINBINARYNAME}.exe"
|
||||||
goto end_of_test ;<== important for not continuing on the else branch
|
Pop $0
|
||||||
file_not_found:
|
${If} $0 = 1
|
||||||
end_of_test:
|
!insertmacro SetShortcutTarget "$DESKTOP\${PRODUCTNAME}.lnk" "$INSTDIR\${MAINBINARYNAME}.exe"
|
||||||
|
Return
|
||||||
|
${EndIf}
|
||||||
!macroend
|
!macroend
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
"icon": ["icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"],
|
"icon": ["icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"],
|
||||||
"windows": {
|
"windows": {
|
||||||
"nsis": {
|
"nsis": {
|
||||||
"installMode": "perMachine",
|
|
||||||
"installerHooks": "./nsis/hooks.nsi"
|
"installerHooks": "./nsis/hooks.nsi"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user