mirror of https://github.com/hykilpikonna/AquaDX
[-] Remove unnecessary beans
parent
64a27e5708
commit
db1ffd5091
|
@ -3,24 +3,12 @@ package icu.samnyan.aqua.sega.aimedb
|
|||
import io.netty.buffer.ByteBuf
|
||||
import io.netty.channel.ChannelHandlerContext
|
||||
import io.netty.handler.codec.ByteToMessageDecoder
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.beans.factory.config.BeanDefinition
|
||||
import org.springframework.context.annotation.Scope
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* A new decoder object will be created each time a new request comes in
|
||||
*/
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
class AimeDbDecoder : ByteToMessageDecoder() {
|
||||
var length: Int = 0
|
||||
val logger: Logger = LoggerFactory.getLogger(AimeDbDecoder::class.java)
|
||||
|
||||
init {
|
||||
logger.info("AimeDB Decoder Created")
|
||||
}
|
||||
var length = 0
|
||||
|
||||
/**
|
||||
* Decrypt the incoming request including frame management
|
||||
|
@ -30,10 +18,7 @@ class AimeDbDecoder : ByteToMessageDecoder() {
|
|||
*/
|
||||
override fun decode(ctx: ChannelHandlerContext, input: ByteBuf, out: MutableList<Any>) {
|
||||
if (input.readableBytes() < 16) return
|
||||
if (length == 0) {
|
||||
length = getLength(input)
|
||||
logger.info("AimeDB Request Length: $length")
|
||||
}
|
||||
if (length == 0) length = getLength(input)
|
||||
|
||||
if (input.readableBytes() < length) return
|
||||
|
||||
|
|
|
@ -3,15 +3,10 @@ package icu.samnyan.aqua.sega.aimedb
|
|||
import io.netty.buffer.ByteBuf
|
||||
import io.netty.channel.ChannelHandlerContext
|
||||
import io.netty.handler.codec.MessageToByteEncoder
|
||||
import org.springframework.beans.factory.config.BeanDefinition
|
||||
import org.springframework.context.annotation.Scope
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
class AimeDbEncoder : MessageToByteEncoder<ByteBuf>() {
|
||||
override fun encode(ctx: ChannelHandlerContext, msg: ByteBuf, out: ByteBuf) {
|
||||
msg.writerIndex(0)
|
||||
|
|
|
@ -3,6 +3,8 @@ package icu.samnyan.aqua.sega.aimedb
|
|||
import icu.samnyan.aqua.sega.util.ByteBufUtil
|
||||
import io.netty.buffer.ByteBuf
|
||||
import io.netty.buffer.Unpooled.copiedBuffer
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.nio.charset.StandardCharsets
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
|
@ -19,3 +21,5 @@ object AimeDbEncryption {
|
|||
|
||||
fun encrypt(src: ByteBuf) = copiedBuffer(enc.doFinal(ByteBufUtil.toAllBytes(src)))
|
||||
}
|
||||
|
||||
val logger: Logger = LoggerFactory.getLogger(AimeDbEncryption::class.java)
|
||||
|
|
|
@ -10,7 +10,6 @@ import io.netty.channel.ChannelHandlerContext
|
|||
import io.netty.channel.ChannelInboundHandlerAdapter
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.context.annotation.Scope
|
||||
import org.springframework.stereotype.Component
|
||||
import java.nio.charset.StandardCharsets
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
@ -19,7 +18,6 @@ import kotlin.jvm.optionals.getOrNull
|
|||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component
|
||||
@Scope("prototype")
|
||||
@ChannelHandler.Sharable
|
||||
class AimeDbRequestHandler(
|
||||
val cardService: CardService
|
||||
|
|
|
@ -10,10 +10,8 @@ import io.netty.handler.logging.LogLevel
|
|||
import io.netty.handler.logging.LoggingHandler
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.beans.factory.config.BeanDefinition
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.Scope
|
||||
import org.springframework.stereotype.Component
|
||||
import java.net.InetAddress
|
||||
import java.net.InetSocketAddress
|
||||
|
@ -64,7 +62,6 @@ class AimeDbServer(
|
|||
}
|
||||
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
class AimeDbServerInitializer(
|
||||
val aimeDbRequestHandler: AimeDbRequestHandler
|
||||
) : ChannelInitializer<SocketChannel>() {
|
||||
|
|
Loading…
Reference in New Issue