Skip to content

Commit

Permalink
Update lib-info.js for Node.js products
Browse files Browse the repository at this point in the history
  • Loading branch information
yevgen-nykytenko committed Dec 25, 2023
1 parent 2759706 commit 743e84e
Showing 1 changed file with 35 additions and 8 deletions.
43 changes: 35 additions & 8 deletions themes/hugo-geekdoc/static/js/lib-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
return response.json()})
.then(info => {
if (!info) return null;
return { 'version': info.data[0].version, 'downloads': info.data[0].totalDownloads}});

return { 'version': info.data[0].version, 'downloads': info.data[0].totalDownloads}});
}
},
java: {
Expand Down Expand Up @@ -47,14 +46,42 @@
'version': verEl.textContent,
'downloads': 0,
'url': 'https://releases.groupdocs.com/java/repo/com/groupdocs/groupdocs-' + productName + '/'+ verEl.textContent + '/'
};

});

};
});
}
},
'nodejs-java': {

}

getInfo: function(productName) {
const metadataUrl = 'https://releases.groupdocs.com/java/repo/com/groupdocs/groupdocs-' + productName + '-nodejs/maven-metadata.xml';

console.log('Trying to fetch from ' + metadataUrl);

return fetch(metadataUrl)
.catch((error) => {
console.log(error)
})
.then(response => {
if (!response) return null;
return response.text()})
.then(text => {

console.log('Data fetched. Parsing data.');

if (!text) return null;
const xml = new DOMParser().parseFromString(text, 'application/xml');
const verEl = xml.querySelector('metadata versioning release');

console.log('Return results.');

return {
'version': verEl.textContent,
'downloads': 0,
'url': 'https://releases.groupdocs.com/java/repo/com/groupdocs/groupdocs-' + productName + '-nodejs/'+ verEl.textContent + '/'
};
});
}
}
}

function updateLibInfo(platform, product){
Expand Down

0 comments on commit 743e84e

Please sign in to comment.