Skip to content

Commit

Permalink
fix port selection
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-frmr committed Sep 18, 2024
1 parent c2afd67 commit 2e69297
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tauri-wrapper/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,16 @@ <h2>Existing home folders</h2>
window.__TAURI__.invoke('boot')
.catch(console.error);
}, 300);
checkAndRedirect();
checkAndRedirect((nodePort.value) ? nodePort.value : "8080");
});

let port = (nodePort.value) ? nodePort.value : "8080";

function checkAndRedirect() {
function checkAndRedirect(port) {
fetch(`http://localhost:${port}`, { mode: 'no-cors' })
.then(() => {
window.location.href = `http://localhost:${port}`;
})
.catch(() => {
setTimeout(checkAndRedirect, 1000);
setTimeout(() => checkAndRedirect(port), 1000);
});
}

Expand Down

0 comments on commit 2e69297

Please sign in to comment.