From 347b14c84b6f0440f09473eeca0dce6791d60dc8 Mon Sep 17 00:00:00 2001 From: Ave <112294121+Ave9858@users.noreply.github.com> Date: Mon, 29 May 2023 01:59:31 +0000 Subject: [PATCH] automatically use shared session when needed --- index.html | 8 ++------ js/msdl.js | 11 ++++++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 3a5a8bd..7beaba3 100644 --- a/index.html +++ b/index.html @@ -63,8 +63,8 @@

Error

-

An error has occurred while processing your request. Try clicking the use shared session button if reloading - the page does not work.

+

An error has occurred while processing your request. If reloading the page does not work, contact us or create an issue on GitHub.

@@ -72,10 +72,6 @@
-
- -
- diff --git a/js/msdl.js b/js/msdl.js index ffe40d1..a9be893 100644 --- a/js/msdl.js +++ b/js/msdl.js @@ -9,7 +9,6 @@ const processingError = document.getElementById('msdl-processing-error'); const productsList = document.getElementById('products-list'); const backToProductsDiv = document.getElementById('back-to-products'); -const useSharedSessionDiv = document.getElementById('use-shared-session'); const sharedSessionGUID = "47cbc254-4a79-4be6-9866-9c625eb20911"; @@ -41,7 +40,6 @@ function updateContent(content, response) { if (errorMessage) { processingError.style.display = "block"; - useSharedSessionDiv.style.display = "block"; return false; } @@ -80,9 +78,14 @@ function onDownloadsXhrChange() { pleaseWait.style.display = "none"; msContent.style.display = "block"; - if (updateContent(msContent, this.responseText) && !sharedSession) { + let wasSuccessful = updateContent(msContent, this.responseText); + + if (wasSuccessful && !sharedSession) { fetch(sessionUrl + sharedSessionGUID); } + else if (!sharedSession) { + useSharedSession() + } } function getLanguages(productId) { @@ -111,7 +114,6 @@ function getDownload() { function backToProducts() { backToProductsDiv.style.display = 'none'; - useSharedSessionDiv.style.display = 'none'; productsList.style.display = 'block'; msContent.style.display = 'none'; pleaseWait.style.display = 'none'; @@ -124,7 +126,6 @@ function backToProducts() { function useSharedSession() { sharedSession = true; pleaseWait.style.display = "block"; - useSharedSessionDiv.style.display = 'none'; processingError.style.display = 'none'; let url = langsUrl + "&productEditionId=" + window.location.hash.substring(1) + "&sessionId=" + sharedSessionGUID;