finish migrating to ktor!

- remove http4k
- renamed 'schema' subproject to 'library', because it contains more than just data models
- tiles are now hosted per factorio-server
- changed api base to `kafkatorio/data`
- tidied up some Gradle conf
- remove 'events-processor' subproject - I don't want to set up loads of microservices right now
This commit is contained in:
Adam 2022-07-02 08:45:21 +02:00
parent 8a90c4fb5e
commit c0c82e7c9c
80 changed files with 1878 additions and 1280 deletions

View file

@ -77,12 +77,9 @@ class App(
wsService.packetsFlow
.filterIsInstance<EventServerPacket.ChunkTileSaved>()
.onEach {
println("[packetsFlow] triggering tile refresh ${it.filename.value}")
gameState.map.refreshUpdatedTilePng(
// doc, window,
it.filename
)
.onEach { tileSavedEvent ->
println("[packetsFlow] triggering tile refresh ${tileSavedEvent.filename.value}")
gameState.map.refreshUpdatedTilePng(tileSavedEvent.filename)
}.launchIn(this)
}

View file

@ -8,5 +8,5 @@ object Props {
get() = window.location.href
.replace("http://", "ws://")
.replace("https://", "wss://") +
"ws/foo"
"kafkatorio/ws"
}

View file

@ -14,6 +14,7 @@ inline var TileLayer<TileLayer.TileLayerOptions>.tileOnLoad: TileOnLoadFn?
}
/** @see [tileOnLoad] */
typealias TileOnLoadFn = (done: DoneCallback, tile: HTMLElement) -> Unit

View file

@ -1,6 +1,6 @@
package dev.adamko.kafkatorio.webmap
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
import dev.adamko.kafkatorio.library.jsonMapperKafkatorio
import kotlinx.serialization.json.Json
val jsonMapper = Json {

View file

@ -31,7 +31,7 @@ import org.w3c.fetch.RequestMode
class FactorioMap(
private val tileUrlTemplate: String = """/tiles/s1/z{z}/x{x}/y{y}.png""",
private val tileUrlTemplate: String = """/kafkatorio/data/servers/syslog-test/map/tiles/s1/z{z}/x{x}/y{y}.png""",
) {
val kvMap: Maps = Maps {
@ -89,9 +89,7 @@ class FactorioMap(
.querySelectorAll("img.leaflet-tile-loaded")
.asList()
.filterIsInstance<Image>()
.filter { img ->
tilePngFilename.value in img.src
}
.filter { img -> tilePngFilename.value in img.src }
.forEach { img ->
val imgSrc = img.src