refactor: prevent callback send to /Tools/Update

This commit is contained in:
Zack Spear
2023-10-11 15:21:22 -05:00
committed by Zack Spear
parent 86d4defa3e
commit 749eab85bd

View File

@@ -147,6 +147,10 @@ export const useCallbackStoreGeneric = (
// build and go to url
const destinationUrl = new URL(url);
destinationUrl.searchParams.set('data', encodeURI(encryptedMessage));
// becacuse this route redirects to account.unraid.net/server/update-os we need to change it
if (destinationUrl.pathname === '/Tools/Update') {
destinationUrl.pathname = '/Main'; // don't go to "/" because that auto redirects to /Main or /Dashboard
}
console.debug('[callback.send]', encryptedMessage, destinationUrl);
if (newTab) {
window.open(destinationUrl.toString(), '_blank');