This commit is contained in:
Telesphoreo 2022-06-23 02:29:38 -05:00
parent 845ae56573
commit 3135f86014
3 changed files with 23 additions and 10 deletions

View File

@ -7,7 +7,7 @@
<meta name="theme-color" content="#000000"/> <meta name="theme-color" content="#000000"/>
<meta <meta
name="description" 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"
/> />
<!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png"/>--> <!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png"/>-->
<!-- <!--

View File

@ -4,10 +4,12 @@ import { Build, getBuilds, getJobs, Job } from "../util/Jenkins";
import "../css/DownloadPage.css" import "../css/DownloadPage.css"
import { Button } from "react-bootstrap"; import { Button } from "react-bootstrap";
import { Alert } from "react-bootstrap";
import { Container } from "react-bootstrap";
const DownloadPage = () => { const DownloadPage = () => {
const [ jobs, setJobs ] = useState(new Map<Job, Build[]>()) const [jobs, setJobs] = useState(new Map<Job, Build[]>())
const [ version, setVersion ] = useState("") const [ version, setVersion ] = useState("1.19")
useEffect(() => { useEffect(() => {
doJobs().then(value => { doJobs().then(value => {
}) })
@ -38,11 +40,21 @@ const DownloadPage = () => {
} }
return ( return (
<Fragment> <Container fluid className="p-4">
<Alert variant="secondary">
<Alert.Heading>Scissors Downloads</Alert.Heading>
<p>
You may download builds of Scissors from here. Select the version you would like below. If the downloads page is not working, please use our <a href="https://ci.scissors.gg/job/Scissors">CI Server</a> instead.
</p>
<hr />
<p className="mb-0">
P.S. If you know React, PLEASE help us make this look better. Our code is <a href="https://github.com/AtlasMediaGroup/Scissors-Website/tree/master">here</a>.
</p>
</Alert>
<ul className={"versions"}> <ul className={"versions"}>
{Array.from(jobs.keys()).map(value => { {Array.from(jobs.keys()).map(value => {
return <li className={version == value.name ? "selected" : "selectable"} return <li className={version === value.name ? "selected" : "selectable"}
onClick={onClick}>{value.name}</li> onClick={onClick}>{value.name}</li>
})} })}
</ul> </ul>
<ul className={"builds"}> <ul className={"builds"}>
@ -58,7 +70,7 @@ const DownloadPage = () => {
</li> </li>
})} })}
</ul> </ul>
</Fragment> </Container >
); );
} }

View File

@ -20,9 +20,10 @@ export type BuildChange = {
comment: string, comment: string,
id: string, id: string,
} }
export function getJobs(): Promise<Job[]> { export function getJobs(): Promise<Job[]> {
let jobs: Job[] = [] let jobs: Job[] = []
let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/api/json`) let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/api/json?pretty=true`)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request.then(value => { request.then(value => {
@ -34,14 +35,14 @@ export function getJobs(): Promise<Job[]> {
export function getBuilds(version: string): Promise<Build[]> { export function getBuilds(version: string): Promise<Build[]> {
let builds: Build[] = [] let builds: Build[] = []
let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/api/json`) let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/api/json?pretty=true`)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request.then(value => { request.then(value => {
builds = value.data.builds as Build[] builds = value.data.builds as Build[]
let count = 0; let count = 0;
for (let build of builds) { for (let build of builds) {
axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/${build.number}/api/json`).then(value1 => { axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/${build.number}/api/json?pretty=true`).then(value1 => {
build.timestamp = value1.data.timestamp build.timestamp = value1.data.timestamp
let changeSet: any[] = value1.data.changeSets let changeSet: any[] = value1.data.changeSets
if (changeSet.length > 0) { if (changeSet.length > 0) {