feat(patcher): patch the native image client and serve it a local main feed

This commit is contained in:
Fiereu committed 2026-08-02 15:39:05 +02:00
1 parent 3b19a81201
commit d36c630d53
12 files changed
+71 -16

No files matched your search

+30 -3
View File
@@ -50,20 +50,47 @@ tasks.register("copyKeysGame") {
dependsOn("copyPublicKeyGame", "copyPrivateKeyGame") dependsOn("copyPublicKeyGame", "copyPrivateKeyGame")
} }
tasks.register<Copy>("copyPublicKeyFeed") {
group = "openmmo"
description = "Copy feed keys from \":keys\" to the current projects resources directory"
from(project(":keys").tasks.getByName("generateFeed").outputs.files) { include("*.public.pem") }
into(project.layout.projectDirectory.dir(KEYS_RESOURCE_LOCATION))
}
tasks.register<Copy>("copyPrivateKeyFeed") {
group = "openmmo"
description = "Copy feed keys from \":keys\" to the current projects resources directory"
from(project(":keys").tasks.getByName("generateFeed").outputs.files) { include("*.private.pem") }
into(project.layout.projectDirectory.dir(KEYS_RESOURCE_LOCATION))
}
tasks.register("copyKeysFeed") {
group = "openmmo"
description = "Copies all feed keys from \":keys\" to the current projects resources directory"
dependsOn("copyPublicKeyFeed", "copyPrivateKeyFeed")
}
tasks.register("copyPublicKeys") { tasks.register("copyPublicKeys") {
group = "openmmo" group = "openmmo"
description = "Copies all public keys from \":keys\" to the current projects resources directory" description = "Copies all public keys from \":keys\" to the current projects resources directory"
dependsOn("copyPublicKeyChat", "copyPublicKeyGame") dependsOn("copyPublicKeyChat", "copyPublicKeyGame", "copyPublicKeyFeed")
} }
tasks.register("copyKeys") { tasks.register("copyKeys") {
group = "openmmo" group = "openmmo"
description = "Copies all keys from \":keys\" to the current projects resources directory" description = "Copies all keys from \":keys\" to the current projects resources directory"
dependsOn("copyKeysChat", "copyKeysGame") dependsOn("copyKeysChat", "copyKeysGame", "copyKeysFeed")
} }
val keyCopyTasks = val keyCopyTasks =
listOf("copyPublicKeyChat", "copyPrivateKeyChat", "copyPublicKeyGame", "copyPrivateKeyGame") listOf(
"copyPublicKeyChat",
"copyPrivateKeyChat",
"copyPublicKeyGame",
"copyPrivateKeyGame",
"copyPublicKeyFeed",
"copyPrivateKeyFeed",
)
tasks.matching { tasks.matching {
it.name.startsWith("spotless") || it.name.startsWith("sonarlint") || it.name == "jooqCodegen" it.name.startsWith("spotless") || it.name.startsWith("sonarlint") || it.name == "jooqCodegen"
-3
View File
@@ -1,9 +1,6 @@
org.gradle.caching=true org.gradle.caching=true
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
# PokeMMO constants
pokemmo.mainClass=com.pokeemu.client.Client
# May be overridden by the user # May be overridden by the user
pokemmo.executable=C:/Program Files/PokeMMO/PokeMMO.exe pokemmo.executable=C:/Program Files/PokeMMO/PokeMMO.exe
pokemmo.workingDir=C:/Program Files/PokeMMO pokemmo.workingDir=C:/Program Files/PokeMMO
-4
View File
@@ -5,7 +5,6 @@ kotlinx-coroutines = "1.11.0"
kotlin-logging = "8.0.4" # sl4j wrapper for Kotlin kotlin-logging = "8.0.4" # sl4j wrapper for Kotlin
logback = "1.5.38" logback = "1.5.38"
slf4j = "2.0.18" slf4j = "2.0.18"
bytebuddy = "1.18.11-jdk5"
jte = "3.2.4" jte = "3.2.4"
spotless = "8.8.0" spotless = "8.8.0"
sonarlint = "7.1.4" sonarlint = "7.1.4"
@@ -38,8 +37,6 @@ kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-t
kotlin-logging = { module = "io.github.oshai:kotlin-logging-jvm", version.ref = "kotlin-logging" } kotlin-logging = { module = "io.github.oshai:kotlin-logging-jvm", version.ref = "kotlin-logging" }
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
bytebuddy = { module = "net.bytebuddy:byte-buddy", version.ref = "bytebuddy" }
bytebuddy-agent = { module = "net.bytebuddy:byte-buddy-agent", version.ref = "bytebuddy" }
jte = { module = "gg.jte:jte", version.ref = "jte" } jte = { module = "gg.jte:jte", version.ref = "jte" }
jte-kotlin = { module = "gg.jte:jte-kotlin", version.ref = "jte" } jte-kotlin = { module = "gg.jte:jte-kotlin", version.ref = "jte" }
bouncycastle-pkix = { module = "org.bouncycastle:bcpkix-jdk18on", version.ref = "bouncycastle" } bouncycastle-pkix = { module = "org.bouncycastle:bcpkix-jdk18on", version.ref = "bouncycastle" }
@@ -68,7 +65,6 @@ ineter = { module = "com.github.maltalex:ineter", version.ref = "ineter" }
[bundles] [bundles]
crypto = ["bouncycastle-pkix", "bouncycastle-provider"] crypto = ["bouncycastle-pkix", "bouncycastle-provider"]
bytebuddy = ["bytebuddy", "bytebuddy-agent"]
jooq = ["jooq", "jooq-kotlin", "jooq-meta", "jooq-codegen"] jooq = ["jooq", "jooq-kotlin", "jooq-meta", "jooq-codegen"]
kotest = ["kotest-core", "kotest-assertions", "kotest-framework"] kotest = ["kotest-core", "kotest-assertions", "kotest-framework"]
+19 -5
View File
@@ -23,6 +23,9 @@ abstract class GenerateCertificateTask : DefaultTask() {
val overwriteCertificates: Property<Boolean> = val overwriteCertificates: Property<Boolean> =
project.objects.property(Boolean::class.java).convention(false) project.objects.property(Boolean::class.java).convention(false)
@get:Input
val algorithm: Property<String> = project.objects.property(String::class.java).convention("EC")
init { init {
group = "openmmo" group = "openmmo"
outputs.upToDateWhen { !overwriteCertificates.get() } outputs.upToDateWhen { !overwriteCertificates.get() }
@@ -37,16 +40,20 @@ abstract class GenerateCertificateTask : DefaultTask() {
return return
} }
// Generate ECDSA key pair using secp256r1 curve val keyPairGenerator = KeyPairGenerator.getInstance(algorithm.get())
val keyPairGenerator = KeyPairGenerator.getInstance("EC") when (val name = algorithm.get()) {
keyPairGenerator.initialize(ECGenParameterSpec("secp256r1")) "EC" -> keyPairGenerator.initialize(ECGenParameterSpec("secp256r1"))
"RSA" -> keyPairGenerator.initialize(3072)
else -> error("Unsupported algorithm: $name")
}
val keyPair = keyPairGenerator.generateKeyPair() val keyPair = keyPairGenerator.generateKeyPair()
// Write private key as PEM // Write private key as PEM
val privateKeyPem = val privateKeyPem =
StringWriter().use { writer -> StringWriter().use { writer ->
PemWriter(writer).use { pemWriter -> PemWriter(writer).use { pemWriter ->
pemWriter.writeObject(PemObject("EC PRIVATE KEY", keyPair.private.encoded)) pemWriter.writeObject(
PemObject("${algorithm.get()} PRIVATE KEY", keyPair.private.encoded))
} }
writer.toString() writer.toString()
} }
@@ -76,7 +83,14 @@ tasks.register<GenerateCertificateTask>("generateChat") {
publicKeyOutput.set(layout.buildDirectory.file("chat.public.pem")) publicKeyOutput.set(layout.buildDirectory.file("chat.public.pem"))
} }
tasks.register<GenerateCertificateTask>("generateFeed") {
description = "Generates a key pair for signing the client's main feed."
algorithm.set("RSA")
privateKeyOutput.set(layout.buildDirectory.file("feed.private.pem"))
publicKeyOutput.set(layout.buildDirectory.file("feed.public.pem"))
}
tasks.register("generate") { tasks.register("generate") {
group = "openmmo" group = "openmmo"
dependsOn("generateGame", "generateChat") dependsOn("generateGame", "generateChat", "generateFeed")
} }
@@ -1,3 +1,3 @@
Removed on request of pokemmo.eu. Removed on request of pokemmo.eu.
Date: 2026-08-17 Date: 2026-08-17
Nonce: 60353ee805a94b4190c1042e7f9288fe Nonce: 046de4127f604c5da3fee2fb911d5770
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: ac0e4ce718fd4df5a5e7f0d6c55bc2f6
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: efb57ec407504b7c8dea8baec60cccb4
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: 884762934db04059872aee9e569d6422
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: 68d817da920e40abb55776133586a48f
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: 66fdaab931e54ca3889d27ed6e3668ae
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: 102a4c64afbc4551903da2ab479c60f4
@@ -0,0 +1,3 @@
Removed on request of pokemmo.eu.
Date: 2026-08-17
Nonce: be582db140fd44c2b8a3e0b2e39d6152