Remove /keys/submit endpoint

This was actually only compatible with OpenOSRS's code (RuneLite uses a
completely different API). Furthermore, I don't think it's really going
to be necessary as we've arranged access to RuneLite's XTEA API.

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent e1f33158f2
commit 704687e262
  1. 29
      archive/src/main/kotlin/org/openrs2/archive/web/KeysController.kt
  2. 4
      archive/src/main/kotlin/org/openrs2/archive/web/WebServer.kt

@ -1,29 +0,0 @@
package org.openrs2.archive.web
import io.ktor.application.ApplicationCall
import io.ktor.http.HttpStatusCode
import io.ktor.response.respond
import org.openrs2.archive.key.KeyImporter
import org.openrs2.crypto.XteaKey
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
public class KeysController @Inject constructor(
private val importer: KeyImporter
) {
public suspend fun create(call: ApplicationCall) {
val k0 = call.request.queryParameters["key1"]?.toIntOrNull()
val k1 = call.request.queryParameters["key2"]?.toIntOrNull()
val k2 = call.request.queryParameters["key3"]?.toIntOrNull()
val k3 = call.request.queryParameters["key4"]?.toIntOrNull()
if (k0 == null || k1 == null || k2 == null || k3 == null) {
call.respond(HttpStatusCode.BadRequest)
return
}
importer.import(listOf(XteaKey(k0, k1, k2, k3)))
call.respond(HttpStatusCode.NoContent)
}
}

@ -21,7 +21,6 @@ import javax.inject.Singleton
@Singleton
public class WebServer @Inject constructor(
private val cachesController: CachesController,
private val keysController: KeysController,
@Json private val mapper: ObjectMapper
) {
public fun start() {
@ -43,9 +42,6 @@ public class WebServer @Inject constructor(
get("/caches") { cachesController.index(call) }
get("/caches/{id}.zip") { cachesController.export(call) }
get("/caches/{id}.json") { cachesController.exportKeys(call) }
// ideally we'd use POST /keys here, but I want to be compatible with the RuneLite/OpenOSRS API
get("/keys/submit") { keysController.create(call) }
}
}.start(wait = true)
}

Loading…
Cancel
Save