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