Skip to content

Commit

Permalink
Update lib-info.js
Browse files Browse the repository at this point in the history
  • Loading branch information
yevgen-nykytenko committed Dec 19, 2023
1 parent e39501e commit 5c58654
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion themes/hugo-geekdoc/static/js/lib-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
net: {

getInfo: function(productName){

return fetch('https://api-v2v3search-0.nuget.org/query?q=packageid:GroupDocs.'+ productName)
.catch((error) => {
console.log(error)
Expand All @@ -23,6 +23,9 @@

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

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

return fetch(metadataUrl)
.catch((error) => {
console.log(error)
Expand All @@ -31,10 +34,15 @@
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,
Expand Down Expand Up @@ -116,6 +124,9 @@ function init(){
const product = segments[startIndex];
const platform = segments[startIndex + 1];

console.log('product: ' + product);
console.log('platform: ' + platform);

updateLibInfo(platform, product);
}

Expand Down

0 comments on commit 5c58654

Please sign in to comment.