Stuff #1

Merged
Ecorous merged 3 commits from TheKodeToad/upload into mistress 2024-06-12 13:07:49 -04:00
3 changed files with 68 additions and 75 deletions
Showing only changes of commit 8fa8fbf8e8 - Show all commits

View file

@ -24,74 +24,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
fun Application.configureRouting() {
routing {
staticResources("/static", "static")
get("/") {
call.respondHtml {
head {
title { +"FrogMC API" }
link { rel = "stylesheet"; type = "text/css"; href = "/static/style.css" }
}
body {
h1 { +"FrogMC API" }
p { +"This is the FrogMC Meta API." }
p { +"Use this to fetch versions of FrogMC library and loader." }
br()
p { +"Current API version: v1" }
br()
div(classes = "routes") {
div(classes = "route") {
code { +"GET /v1/loader/versions" }
p { +"Fetches all versions of FrogMC loader." }
}
br()
div(classes = "route") {
code { +"GET /v1/loader/versions/latest" }
p { +"Fetches the latest version of FrogMC loader." }
}
br()
div(classes = "route") {
code { +"GET /v1/loader/versions/{version}" }
p { +"Fetches a specific version of FrogMC loader." }
}
br()
div(classes = "route") {
code { +"GET /v1/loader/versions/{version}/download" }
p { +"Fetches the download URL of a specific version of FrogMC loader." }
}
br()
div(classes = "route") {
code { +"POST /v1/loader/versions" }
p { +"Uploads a version of the loader. This endpoint requires authorization." }
}
br()
div(classes = "route") {
code { +"DELETE /v1/loader/versions/{version}" }
p { +"Deletes a version of the loader. This endpoint requires authorization." }
}
br()
div(classes = "route") {
code { +"GET /v1/library/versions" }
p { +"Fetches all versions of FrogMC library." }
}
br()
div(classes = "route") {
code { +"GET /v1/library/versions/latest" }
p { +"Fetches the latest version of FrogMC library." }
}
br()
div(classes = "route") {
code { +"GET /v1/library/versions/{version}" }
p { +"Fetches a specific version of FrogMC library." }
}
br()
div(classes = "route") {
code { +"GET /v1/library/versions/{version}/download" }
p { +"Fetches the download URL of a specific version of FrogMC library." }
}
}
}
}
}
staticResources("/", "static")
route("/v1") {
route("/loader") {
get("/versions") {
@ -150,7 +83,7 @@ fun Application.configureRouting() {
)
)
}
route("/versions/add") {
route("/versions/upload") {
install(authPlugin)
post {
val versionObj = call.receive<LoaderVersion>()

View file

@ -1,7 +1,68 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Hello Ktor!</h1>
</body>
<head>
<title>FrogMC API</title>
<link rel="stylesheet" type="text/css" href="/style.css">
</head>
<body>
<h1>FrogMC API</h1>
<p>This is the FrogMC Meta API.</p>
<p>Use this to fetch versions of FrogMC library and loader.</p>
<br>
<p>Current API version: v1</p>
<br>
<div class="routes">
<div class="route">
<code>GET /v1/loader/versions</code>
<p>Fetches all versions of FrogMC loader.</p>
</div>
<br>
<div class="route">
<code>GET /v1/loader/versions/latest</code>
<p>Fetches the latest version of FrogMC loader.</p>
</div>
<br>
<div class="route">
<code>GET /v1/loader/versions/{version}</code>
<p>Fetches a specific version of FrogMC loader.</p>
</div>
<br>
<div class="route">
<code>GET /v1/loader/versions/{version}/download</code>
<p>Fetches the download URL of a specific version of FrogMC loader.</p>
</div>
<br>
<div class="route">
<code>POST /v1/loader/versions/upload</code>
<p>Uploads a version of the loader.</p>
<p><strong>This endpoint requires authorization.</strong></p>
</div>
<br>
<div class="route">
<code>DELETE /v1/loader/versions/delete/{version}</code>
<p>Deletes a version of the loader.</p>
<p><strong>This endpoint requires authorization.</strong></p>
</div>
<br>
<div class="route">
<code>GET /v1/library/versions</code>
<p>Fetches all versions of FrogMC library.</p>
</div>
<br>
<div class="route">
<code>GET /v1/library/versions/latest</code>
<p>Fetches the latest version of FrogMC library.</p>
</div>
<br>
<div class="route">
<code>GET /v1/library/versions/{version}</code>
<p>Fetches a specific version of FrogMC library.</p>
</div>
<br>
<div class="route">
<code>GET /v1/library/versions/{version}/download</code>
<p>Fetches the download URL of a specific version of FrogMC library.</p>
</div>
</div>
</body>
</html>

View file

@ -18,7 +18,6 @@ div.routes {
padding: 1em;
background-color: var(--ctp-mocha-surface0);
max-width: 400px;
margin-left: 38.5%;
border-radius: 10px;
}