diff --git a/fetch.js b/fetch.js new file mode 100644 index 00000000..b9e218e2 --- /dev/null +++ b/fetch.js @@ -0,0 +1,21 @@ +async function getContentFromWebpage(url) { + try { + const response = await fetch(url); + if (!response.ok) { + throw new Error('Network response was not OK'); + } + const content = await response.text(); + return content; + } catch (error) { + console.error('Error:', error); + return null; + } + } + +function generateURL(version) { + const buildNumber = 'https://ci.plex.us.org/job/Scissors/job/' + version + '/lastBuild/buildNumber'; + getContentFromWebpage(buildNumber) + .then((content) => { + window.location.href = 'https://ci.plex.us.org/job/Scissors/job/' + version + '/' + content + '/artifact/build/libs/scissors-' + version + '-' + content + '.jar'; + }); +} \ No newline at end of file diff --git a/index.html b/index.html index aebb2608..fecb0948 100644 --- a/index.html +++ b/index.html @@ -5,14 +5,15 @@