mirror of
https://github.com/gravesoft/msdl.git
synced 2026-07-25 08:34:28 +00:00
Merge branch 'ave9858:main' into main
This commit is contained in:
+2
-6
@@ -63,8 +63,8 @@
|
||||
|
||||
<div id="msdl-processing-error">
|
||||
<h2>Error</h2>
|
||||
<p>An error has occurred while processing your request. Try clicking the use shared session button if reloading
|
||||
the page does not work.</p>
|
||||
<p>An error has occurred while processing your request. If reloading the page does not work, <a
|
||||
href="https://massgrave.dev/contactus.html">contact us</a> or create an issue on GitHub.</p>
|
||||
</div>
|
||||
|
||||
<div id="back-to-products">
|
||||
@@ -72,10 +72,6 @@
|
||||
<button onClick="backToProducts();">Go back to the product list</button>
|
||||
</div>
|
||||
|
||||
<div id="use-shared-session">
|
||||
<button onClick="useSharedSession();">Use shared session (use if download keeps failing)</button>
|
||||
</div>
|
||||
|
||||
<input id="msdl-session-id" type="hidden">
|
||||
</body>
|
||||
|
||||
|
||||
+41
-7
@@ -2,6 +2,8 @@ const langsUrl = "https://www.microsoft.com/en-us/api/controls/contentinclude/ht
|
||||
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 apiUrl = "https://massgrave.dev/api/msdl/proxy"
|
||||
|
||||
const sessionId = document.getElementById('msdl-session-id');
|
||||
const msContent = document.getElementById('msdl-ms-content');
|
||||
const pleaseWait = document.getElementById('msdl-please-wait');
|
||||
@@ -9,7 +11,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 +42,6 @@ function updateContent(content, response) {
|
||||
|
||||
if (errorMessage) {
|
||||
processingError.style.display = "block";
|
||||
useSharedSessionDiv.style.display = "block";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -77,12 +77,43 @@ function onDownloadsXhrChange() {
|
||||
if (pleaseWait.style.display != "block")
|
||||
return;
|
||||
|
||||
pleaseWait.style.display = "none";
|
||||
msContent.style.display = "block";
|
||||
|
||||
if (updateContent(msContent, this.responseText) && !sharedSession) {
|
||||
fetch(sessionUrl + sharedSessionGUID);
|
||||
let wasSuccessful = updateContent(msContent, this.responseText);
|
||||
|
||||
if (wasSuccessful) {
|
||||
pleaseWait.style.display = "none";
|
||||
if (!sharedSession) {
|
||||
fetch(sessionUrl + sharedSessionGUID);
|
||||
}
|
||||
}
|
||||
else if (!sharedSession) {
|
||||
useSharedSession();
|
||||
}
|
||||
else {
|
||||
getFromServer();
|
||||
}
|
||||
}
|
||||
|
||||
function getFromServer() {
|
||||
let url = apiUrl + "?product_id=" + window.location.hash.substring(1) +
|
||||
"&sku_id=" + skuId;
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.onload = displayResponseFromServer;
|
||||
xhr.open("GET", url, true);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function displayResponseFromServer() {
|
||||
pleaseWait.style.display = "none";
|
||||
processingError.style.display = "none";
|
||||
|
||||
if (!(this.status == 200)) {
|
||||
processingError.style.display = "block";
|
||||
alert(JSON.parse(this.responseText)["Error"])
|
||||
return;
|
||||
}
|
||||
msContent.innerHTML = this.responseText
|
||||
}
|
||||
|
||||
function getLanguages(productId) {
|
||||
@@ -111,7 +142,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';
|
||||
@@ -123,8 +153,11 @@ function backToProducts() {
|
||||
|
||||
function useSharedSession() {
|
||||
sharedSession = true;
|
||||
retryDownload();
|
||||
}
|
||||
|
||||
function retryDownload() {
|
||||
pleaseWait.style.display = "block";
|
||||
useSharedSessionDiv.style.display = 'none';
|
||||
processingError.style.display = 'none';
|
||||
|
||||
let url = langsUrl + "&productEditionId=" + window.location.hash.substring(1) + "&sessionId=" + sharedSessionGUID;
|
||||
@@ -132,6 +165,7 @@ function useSharedSession() {
|
||||
xhr.onload = getDownload;
|
||||
xhr.open("GET", url);
|
||||
xhr.send();
|
||||
|
||||
}
|
||||
|
||||
function prepareDownload(id) {
|
||||
|
||||
Reference in New Issue
Block a user