Fix broken download button

This commit is contained in:
Telesphoreo 2023-06-11 01:41:16 -05:00
parent cb316bbed7
commit ad6f1cadc2
No known key found for this signature in database
GPG Key ID: 68B745F7F8C2FADA
2 changed files with 40 additions and 14 deletions

21
fetch.js Normal file
View File

@ -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';
});
}

View File

@ -5,14 +5,15 @@
<title>Scissors</title> <title>Scissors</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous"> integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<meta name="description" <meta name="description"
content="The official website for the Minecraft server software, Scissors, which aims to patch creative mode exploits"> content="The official website for the Minecraft server software, Scissors, which aims to patch creative mode exploits">
<script src="script.js"></script> <script src="script.js"></script>
<script src="fetch.js"></script>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
</head> </head>
@ -67,13 +68,12 @@
<li><a class="dropdown-item" href="https://javadoc.scissors.gg/1.17.1">1.17.1</a></li> <li><a class="dropdown-item" href="https://javadoc.scissors.gg/1.17.1">1.17.1</a></li>
</ul> </ul>
</li> </li>
<li class="nav-item">
<a class="nav-link" href="https://ci.plex.us.org/job/Scissors">Jenkins</a>
</li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="https://status.scissors.gg">Status</a> <a class="nav-link" href="https://status.scissors.gg">Status</a>
</li> </li>
<form action="https://ci.scissors.gg/job/Scissors" class="container-fluid">
<button class="btn btn-outline-primary ms-auto justify-content-end"
type="submit">Download</button>
</form>
</ul> </ul>
</div> </div>
</div> </div>
@ -81,12 +81,17 @@
<h1>Scissors</h1> <h1>Scissors</h1>
<h4>Minecraft server software oriented towards patching Creative Mode exploits.</h4> <h4>Minecraft server software oriented towards patching Creative Mode exploits.</h4>
<h4>Latest version: 1.20</h4> <h4>Latest version: 1.20</h4>
<form <div class="container-fluid download-button">
action="https://ci.scissors.gg/job/Scissors/job/1.19.4/lastSuccessfulBuild/artifact/build/libs/Scissors-paperclip-1.19.4-R0.1-SNAPSHOT-reobf.jar" <button class="btn btn-success dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
class="container-fluid download-button"> Download latest build
<button class="btn btn-success" type="submit">Download latest build</button> </button>
</form> <ul class="dropdown-menu">
<h5>Previous versions: 1.17.1, 1.18.2, 1.19.4</h5> <li><button class="dropdown-item" type="button" onclick="generateURL('1.20')">1.20</button></li>
<li><button class="dropdown-item" type="button" onclick="generateURL('1.19.4')">1.19.4</button></li>
<li><button class="dropdown-item" type="button" onclick="generateURL('1.18.2')">1.18.2</button></li>
<li><button class="dropdown-item" type="button" onclick="generateURL('1.17.1')">1.17.1</button></li>
</ul>
</div>
</body> </body>
</html> </html>