diff --git a/css/style.css b/css/style.css index a1747ac..d831c38 100644 --- a/css/style.css +++ b/css/style.css @@ -17,6 +17,7 @@ #msdl-ms-content, #msdl-please-wait, #msdl-processing-error, -#back-to-products { +#back-to-products, +#use-shared-session { display: none; } diff --git a/data/products.json b/data/products.json index 811f056..4786437 100644 --- a/data/products.json +++ b/data/products.json @@ -29,26 +29,15 @@ "362": "Windows 10 1703 N", "363": "Windows 10 1703 Single Language", "364": "Windows 10 1703 Home China", - "388": "Windows Desktop App Converter Insider Preview", - "389": "Windows Desktop App Converter Insider Preview - 14393", - "390": "Windows Desktop App Converter Insider Preview - 15063", "484": "Windows 10 1709", "485": "Windows 10 1709 Home China", "488": "Windows 10 Education 1709", - "489": "Media Feature Pack for N versions of Windows 10", - "490": "Windows Desktop App Converter Insider Preview", "491": "Windows 10 IoT Core - Build 16299", - "493": "Windows Desktop App Converter Insider Preview - 16299", "578": "Windows 10 IoT Core - Build 17110", "590": "Windows 10 IoT Core - Build 17115", - "612": "Windows Desktop App Converter Base Image - 14393", - "613": "Windows Desktop App Converter Base Image -16299", - "614": "Windows Desktop App Converter Base Image - 15063", "637": "Windows 10 1803", "638": "Windows 10 1803 Home China", "641": "Windows 10 Education 1803", - "642": "Media Feature - Version 1803 (April 2018)", - "643": "Windows Desktop App Converter Insider Preview", "644": "Windows 10 IoT Core - Build 16299", "651": "Windows 10 1803_1", "652": "Windows 10 1803_1 Home China", @@ -58,10 +47,8 @@ "1019": "Windows 10 1809", "1020": "Windows 10 1809 Home China", "1021": "Windows 10 Education 1809", - "1022": "Media Feature - Version 1809 (October 2018)", "1024": "Windows 10 IoT Core - Build 17763", "1056": "Windows 10 Education 1809 October", - "1057": "Media Feature - Version 1809 (October 2018) October", "1059": "Windows 10 IoT Core - Build 17763 October", "1060": "Windows 10 1809 October", "1061": "Windows 10 1809 Home China October", @@ -72,15 +59,12 @@ "1214": "Windows 10 1903", "1215": "Windows 10 1903 Home China", "1216": "Windows 10 Education 1903", - "1217": "Media Feature - Version 1903 (May 2019)", - "1218": "Windows Desktop App Converter Base Image - 18362", "1384": "Windows 10 1903 V2", "1385": "Windows 10 1903 V2 Home China", "1386": "Windows 10 Education 1903 V2", "1429": "Windows 10 1909", "1430": "Windows 10 1909 Home China", "1431": "Windows 10 Education 1909", - "1460": "Media Feature - Version 1709 (October 2017)", "1625": "Windows 10 Education 2004", "1626": "Windows 10 2004", "1627": "Windows 10 2004 Home China", @@ -93,7 +77,6 @@ "1882": "Windows 10 20H2 v2", "1883": "Windows 10 20H2 v2 Home China", "1884": "Windows 10 Education 20H2 v2", - "1890": "Windows Desktop App Converter Base Image - 1803 - Redo", "2032": "Windows 10 Education 21H1", "2033": "Windows 10 21H1", "2034": "Windows 10 21H1 Home China", @@ -103,8 +86,6 @@ "2085": "Windows 10 21H2 Home China", "2093": "Windows 11 21H2 v1", "2094": "Windows 11 21H2 v1 Home China", - "2360": "Windows 11 22H2", - "2361": "Windows 11 22H2 Home China", "2370": "Windows 11 22H2 v1", "2371": "Windows 11 22H2 v1 Home China", "2377": "Windows 10 22H2", diff --git a/index.html b/index.html index 1f0f35e..0db4505 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,8 @@

Error

-

An error has occurred while processing your request.

+

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

@@ -71,6 +72,10 @@
+
+ +
+ diff --git a/js/msdl.js b/js/msdl.js index 4fba404..a1c0f6e 100644 --- a/js/msdl.js +++ b/js/msdl.js @@ -1,5 +1,6 @@ const langsUrl = "https://www.microsoft.com/en-us/api/controls/contentinclude/html?pageId=cd06bda8-ff9c-4a6e-912a-b92a21f42526&host=www.microsoft.com&segments=software-download%2cwindows11&query=&action=getskuinformationbyproductedition&sdVersion=2"; const downUrl = "https://www.microsoft.com/en-us/api/controls/contentinclude/html?pageId=cfa9e580-a81e-4a4b-a846-7b21bf4e2e5b&host=www.microsoft.com&segments=software-download%2Cwindows11&query=&action=GetProductDownloadLinksBySku&sdVersion=2"; +const sessionUrl = "https://vlscppe.microsoft.com/fp/tags?org_id=y6jn8c31&session_id=" const sessionId = document.getElementById('msdl-session-id'); const msContent = document.getElementById('msdl-ms-content'); @@ -8,11 +9,16 @@ 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"; var msdlXhr = new XMLHttpRequest(); var availableProducts = {}; +var sharedSession = false; + function uuidv4() { return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) @@ -37,6 +43,7 @@ function checkForError(content) { if (errorMessage) { processingError.style.display = "block"; + useSharedSessionDiv.style.display = "block"; return true; } @@ -49,13 +56,15 @@ function updateContent(content, response) { } function abortAndHide() { + backToProductsDiv.style.display = 'none'; + useSharedSessionDiv.style.display = 'none'; + productsList.style.display = 'block'; + msdlXhr.abort(); msContent.style.display = 'none'; pleaseWait.style.display = 'none'; processingError.style.display = 'none'; - - window.location.hash = ""; } function fixSubmitSku() { @@ -100,8 +109,9 @@ function onDownloadsXhrChange() { pleaseWait.style.display = "none"; msContent.style.display = "block"; - if (!updateContent(msContent, this.responseText)) - return; + if (updateContent(msContent, this.responseText) && !sharedSession) { + fetch(sessionUrl + sharedSessionGUID); + } } function getLanguages(productId) { @@ -109,7 +119,7 @@ function getLanguages(productId) { pleaseWait.style.display = "block"; var url = langsUrl + "&productEditionId=" + encodeURIComponent(productId) + - "&sessionId=" + encodeURIComponent(sessionId.value); + "&sessionId=" + (sharedSession ? sharedSessionGUID : sessionId.value); msdlXhr.abort(); msdlXhr.onreadystatechange = onLanguageXhrChange; @@ -125,7 +135,7 @@ function getDownload() { var url = downUrl + "&skuId=" + encodeURIComponent(id['id']) + "&language=" + encodeURIComponent(id['language']) + - "&sessionId=" + encodeURIComponent(sessionId.value); + "&sessionId=" + (sharedSession ? sharedSessionGUID : sessionId.value); msdlXhr.abort(); msdlXhr.onreadystatechange = onDownloadsXhrChange; @@ -135,20 +145,22 @@ function getDownload() { function backToProducts() { abortAndHide(); + window.location.hash = ""; +} - backToProductsDiv.style.display = 'none'; - productsList.style.display = 'block'; +function useSharedSession() { + sharedSession = true; + abortAndHide(); + prepareDownload(window.location.hash.substring(1)) } function prepareDownload(id) { productsList.style.display = 'none'; backToProductsDiv.style.display = 'block'; - sessionId.value = uuidv4(); - const xhr = new XMLHttpRequest(); xhr.onreadystatechange = () => { getLanguages(id) }; - xhr.open("GET", "https://vlscppe.microsoft.com/fp/tags?org_id=y6jn8c31&session_id=" + sessionId.value, true); + xhr.open("GET", sessionUrl + sessionId.value, true); xhr.send(); } @@ -232,6 +244,8 @@ xhr.onreadystatechange = function () { preparePage(this.responseText); }; +sessionId.value = uuidv4(); + xhr.open("GET", 'data/products.json', true); xhr.send();