Dieser Commit ist enthalten in:
Ursprung
cee09ceebe
Commit
932ad60f0b
@ -1,11 +1,11 @@
|
||||
val ktor_version: String by project
|
||||
val kotlin_version: String by project
|
||||
val logback_version: String by project
|
||||
val ktor_version: String = "2.3.12"
|
||||
val kotlin_version: String = "2.0.10"
|
||||
val logback_version: String = "1.5.6"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.9.22"
|
||||
id("io.ktor.plugin") version "2.3.7"
|
||||
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22"
|
||||
kotlin("jvm") version "2.0.10"
|
||||
id("io.ktor.plugin") version "2.3.12"
|
||||
id("org.jetbrains.kotlin.plugin.serialization") version "2.0.10"
|
||||
application
|
||||
}
|
||||
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -72,7 +72,8 @@ data class SchematicCode(val id: Int, val code: String, val expires: Long)
|
||||
data class UploadSchematic(val name: String, val content: String)
|
||||
|
||||
fun Route.configureSchematic() {
|
||||
get("/download/{code}") {
|
||||
route("/download/{code}") {
|
||||
get {
|
||||
val code = call.parameters["code"] ?: run {
|
||||
call.respond(HttpStatusCode.BadRequest)
|
||||
return@get
|
||||
@ -110,6 +111,25 @@ fun Route.configureSchematic() {
|
||||
call.response.header("Content-Disposition", "attachment; filename=\"${node.name}.${if (data.nodeFormat) "schem" else "schematic"}\"")
|
||||
call.respondBytes(data.schemData().readAllBytes(), contentType = ContentType.Application.OctetStream, status = HttpStatusCode.OK)
|
||||
}
|
||||
get("/info") {
|
||||
val code = call.parameters["code"] ?: run {
|
||||
call.respond(HttpStatusCode.BadRequest)
|
||||
return@get
|
||||
}
|
||||
|
||||
val dl = NodeDownload.get(code) ?: run {
|
||||
call.respond(HttpStatusCode.NotFound)
|
||||
return@get
|
||||
}
|
||||
|
||||
val node = SchematicNode.getSchematicNode(dl.nodeId) ?: run {
|
||||
call.respond(HttpStatusCode.NotFound)
|
||||
return@get
|
||||
}
|
||||
|
||||
call.respond(ResponseSchematic(node))
|
||||
}
|
||||
}
|
||||
route("/schem") {
|
||||
install(SWPermissionCheck)
|
||||
get {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren