Skip to content

Commit

Permalink
remove old invalid installs
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Sep 10, 2024
1 parent 5e7ebbc commit 6e17750
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
53 changes: 53 additions & 0 deletions apps/app/nsis/hooks.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
!macro NSIS_HOOK_POSTINSTALL
; Check if theseus_gui.exe exists
${IfFileExists} "$LOCALAPPDATA\Modrinth App\theseus_gui.exe"

Delete "$LOCALAPPDATA\Modrinth App\theseus_gui.exe"

{{#each file_associations as |association| ~}}
{{#each association.ext as |ext| ~}}
!insertmacro APP_UNASSOCIATE "{{ext}}" "{{or association.name ext}}"
{{/each}}
{{/each}}

{{#each deep_link_protocols as |protocol| ~}}
ReadRegStr $R7 SHCTX "Software\Classes\\{{protocol}}\shell\open\command" ""
${If} $R7 == "$\"$LOCALAPPDATA\Modrinth App\theseus_gui.exe$\" $\"%1$\""
DeleteRegKey SHCTX "Software\Classes\\{{protocol}}"
${EndIf}
{{/each}}

Delete "$LOCALAPPDATA\Modrinth App\uninstall.exe"
RMDir "$LOCALAPPDATA\Modrinth App"

!insertmacro DeleteAppUserModelId

; Remove start menu shortcut
!insertmacro MUI_STARTMENU_GETFOLDER Application $AppStartMenuFolder
!insertmacro IsShortcutTarget "$SMPROGRAMS\$AppStartMenuFolder\${PRODUCTNAME}.lnk" "$LOCALAPPDATA\Modrinth App\theseus_gui.exe"
Pop $0
${If} $0 = 1
!insertmacro UnpinShortcut "$SMPROGRAMS\$AppStartMenuFolder\${PRODUCTNAME}.lnk"
Delete "$SMPROGRAMS\$AppStartMenuFolder\${PRODUCTNAME}.lnk"
RMDir "$SMPROGRAMS\$AppStartMenuFolder"
${EndIf}
!insertmacro IsShortcutTarget "$SMPROGRAMS\${PRODUCTNAME}.lnk" "$LOCALAPPDATA\Modrinth App\theseus_gui.exe"
Pop $0
${If} $0 = 1
!insertmacro UnpinShortcut "$SMPROGRAMS\${PRODUCTNAME}.lnk"
Delete "$SMPROGRAMS\${PRODUCTNAME}.lnk"
${EndIf}

; Remove desktop shortcuts
!insertmacro IsShortcutTarget "$DESKTOP\${PRODUCTNAME}.lnk" "$LOCALAPPDATA\Modrinth App\theseus_gui.exe"
Pop $0
${If} $0 = 1
!insertmacro UnpinShortcut "$DESKTOP\${PRODUCTNAME}.lnk"
Delete "$DESKTOP\${PRODUCTNAME}.lnk"
${EndIf}

DeleteRegKey HKCU "${UNINSTKEY}"

${EndIfFileExists} ; End of file existence check

!macroend
18 changes: 18 additions & 0 deletions apps/app/src/api/ads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
position: None,
}));

/// We refresh the ads window every 5 minutes for performance
let app = app.clone();
tauri::async_runtime::spawn(async move {
loop {
if let Some(webview) = app.webviews().get_mut("ads-window")
{
let _ = webview.navigate(
"https://modrinth.com/wrapper/app-ads-cookie"
.parse()
.unwrap(),
);
}

tokio::time::sleep(std::time::Duration::from_secs(60 * 5))
.await;
}
});

Ok(())
})
.invoke_handler(tauri::generate_handler![
Expand Down
3 changes: 2 additions & 1 deletion apps/app/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"template": "./msi/main.wxs"
},
"nsis": {
"installMode": "both"
"installMode": "perMachine",
"installerHooks": "./nsis/hooks.nsi"
}
},
"longDescription": "",
Expand Down

0 comments on commit 6e17750

Please sign in to comment.