diff --git a/build.gradle.kts b/build.gradle.kts index 1c14ff8..562802e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ plugins { kotlin("jvm") version "1.9.22" application - id("io.ktor.plugin") version "2.3.7" + id("io.ktor.plugin") version "2.3.8" } group = "net.taehui" @@ -44,7 +44,6 @@ implementation("org.seleniumhq.selenium:selenium-java:4.17.0") implementation("org.tukaani:xz:1.9") implementation(kotlin("stdlib-jdk8")) - runtimeOnly("com.squareup.okio:okio-jvm:3.7.0") testImplementation(kotlin("test")) } diff --git a/msedgedriver.exe b/msedgedriver.exe index 92a8cd5..170ee24 100644 --- a/msedgedriver.exe +++ b/msedgedriver.exe Binary files differ diff --git a/src/main/kotlin/net/taehui/twilight/qwilight/QwilightBoot.kt b/src/main/kotlin/net/taehui/twilight/qwilight/QwilightBoot.kt index c26b670..73c40cc 100644 --- a/src/main/kotlin/net/taehui/twilight/qwilight/QwilightBoot.kt +++ b/src/main/kotlin/net/taehui/twilight/qwilight/QwilightBoot.kt @@ -18,24 +18,20 @@ eventChannel: Class, sslContext: SSLContext ) : Logger, Runnable { - private val mainBootstrap: ServerBootstrap - - init { - mainBootstrap = ServerBootstrap().group(eventLoopGroup).channel(eventChannel) - .childHandler(object : ChannelInitializer() { - public override fun initChannel(ch: SocketChannel) { - ch.pipeline() - .addLast(SslHandler(sslContext.createSSLEngine().apply { - useClientMode = false - })) - .addLast(ProtobufVarint32FrameDecoder()) - .addLast(ProtobufDecoder(EventOuterClass.Event.getDefaultInstance())) - .addLast(ProtobufVarint32LengthFieldPrepender()) - .addLast(ProtobufEncoder()) - .addLast(QwilightAvatar()) - } - }) - } + private val mainBootstrap: ServerBootstrap = ServerBootstrap().group(eventLoopGroup).channel(eventChannel) + .childHandler(object : ChannelInitializer() { + public override fun initChannel(ch: SocketChannel) { + ch.pipeline() + .addLast(SslHandler(sslContext.createSSLEngine().apply { + useClientMode = false + })) + .addLast(ProtobufVarint32FrameDecoder()) + .addLast(ProtobufDecoder(EventOuterClass.Event.getDefaultInstance())) + .addLast(ProtobufVarint32LengthFieldPrepender()) + .addLast(ProtobufEncoder()) + .addLast(QwilightAvatar()) + } + }) override fun run() { logInfo("Loading Qwilight") diff --git a/src/main/kotlin/net/taehui/twilight/site/SiteBoot.kt b/src/main/kotlin/net/taehui/twilight/site/SiteBoot.kt index 1190950..a6b4d92 100644 --- a/src/main/kotlin/net/taehui/twilight/site/SiteBoot.kt +++ b/src/main/kotlin/net/taehui/twilight/site/SiteBoot.kt @@ -12,21 +12,17 @@ import net.taehui.twilight.Logger class SiteBoot(eventLoopGroup: EventLoopGroup, eventChannel: Class) : Logger, Runnable { - private val mainBootstrap: ServerBootstrap - - init { - mainBootstrap = ServerBootstrap().group(eventLoopGroup).channel(eventChannel) - .childHandler(object : ChannelInitializer() { - public override fun initChannel(ch: SocketChannel) { - ch.pipeline() - .addLast(HttpServerCodec()) - .addLast(HttpObjectAggregator(Int.MAX_VALUE)) - .addLast(WebSocketServerCompressionHandler()) - .addLast(WebSocketServerProtocolHandler("/qwilight/ws", null, true, Int.MAX_VALUE)) - .addLast(SiteAvatar()) - } - }) - } + private val mainBootstrap: ServerBootstrap = ServerBootstrap().group(eventLoopGroup).channel(eventChannel) + .childHandler(object : ChannelInitializer() { + public override fun initChannel(ch: SocketChannel) { + ch.pipeline() + .addLast(HttpServerCodec()) + .addLast(HttpObjectAggregator(Int.MAX_VALUE)) + .addLast(WebSocketServerCompressionHandler()) + .addLast(WebSocketServerProtocolHandler("/qwilight/ws", null, true, Int.MAX_VALUE)) + .addLast(SiteAvatar()) + } + }) override fun run() { logInfo("Loading Site") diff --git a/src/main/kotlin/net/taehui/twilight/system/DB.kt b/src/main/kotlin/net/taehui/twilight/system/DB.kt index f871843..c8818cd 100644 --- a/src/main/kotlin/net/taehui/twilight/system/DB.kt +++ b/src/main/kotlin/net/taehui/twilight/system/DB.kt @@ -2248,7 +2248,7 @@ } ).use { dbStatement -> if (dbStatement != null) { - dbStatement.setString(1, "*$want*") + dbStatement.setString(1, "+$want*") dbStatement.executeQuery().use { rows -> if (rows.next()) { totalCount = rows.getInt("Total_Count") @@ -2330,7 +2330,7 @@ else -> null } - dbStatement?.setString(1, "*$want*") + dbStatement?.setString(1, "+$want*") dbStatement?.setInt(2, viewUnit * (page - 1)) dbStatement?.setInt(3, viewUnit) } @@ -2517,7 +2517,7 @@ WHERE MATCH(Avatar_Name) AGAINST(? IN BOOLEAN MODE) """.trimIndent() ).use { dbStatement -> - dbStatement.setString(1, "*$wantAvatarName*") + dbStatement.setString(1, "+$wantAvatarName*") dbStatement.executeQuery().use { rows -> while (rows.next()) { wantAvatars.add(object { diff --git a/src/main/kotlin/net/taehui/twilight/taehui/TaehuiBoot.kt b/src/main/kotlin/net/taehui/twilight/taehui/TaehuiBoot.kt index f4ba1aa..cbaeb66 100644 --- a/src/main/kotlin/net/taehui/twilight/taehui/TaehuiBoot.kt +++ b/src/main/kotlin/net/taehui/twilight/taehui/TaehuiBoot.kt @@ -11,20 +11,16 @@ import net.taehui.twilight.Logger class TaehuiBoot(eventLoopGroup: EventLoopGroup, eventChannel: Class) : Logger, Runnable { - private val mainBootstrap: ServerBootstrap - - init { - mainBootstrap = ServerBootstrap().group(eventLoopGroup).channel(eventChannel) - .childHandler(object : ChannelInitializer() { - public override fun initChannel(ch: SocketChannel) { - ch.pipeline() - .addLast(HttpServerCodec()) - .addLast(HttpObjectAggregator(Int.MAX_VALUE)) - .addLast(HttpClientCodec()) - .addLast(TaehuiAvatar()) - } - }) - } + private val mainBootstrap: ServerBootstrap = ServerBootstrap().group(eventLoopGroup).channel(eventChannel) + .childHandler(object : ChannelInitializer() { + public override fun initChannel(ch: SocketChannel) { + ch.pipeline() + .addLast(HttpServerCodec()) + .addLast(HttpObjectAggregator(Int.MAX_VALUE)) + .addLast(HttpClientCodec()) + .addLast(TaehuiAvatar()) + } + }) override fun run() { logInfo("Loading Taehui") diff --git a/src/main/kotlin/net/taehui/twilight/www/WwwBoot.kt b/src/main/kotlin/net/taehui/twilight/www/WwwBoot.kt index 8e1b778..093ce74 100644 --- a/src/main/kotlin/net/taehui/twilight/www/WwwBoot.kt +++ b/src/main/kotlin/net/taehui/twilight/www/WwwBoot.kt @@ -11,20 +11,16 @@ import net.taehui.twilight.Logger class WwwBoot(eventLoopGroup: EventLoopGroup, eventChannel: Class) : Logger, Runnable { - private val mainBootstrap: ServerBootstrap - - init { - mainBootstrap = ServerBootstrap().group(eventLoopGroup).channel(eventChannel) - .childHandler(object : ChannelInitializer() { - public override fun initChannel(ch: SocketChannel) { - ch.pipeline() - .addLast(HttpServerCodec()) - .addLast(HttpObjectAggregator(Int.MAX_VALUE)) - .addLast(HttpClientCodec()) - .addLast(WwwAvatar()) - } - }) - } + private val mainBootstrap: ServerBootstrap = ServerBootstrap().group(eventLoopGroup).channel(eventChannel) + .childHandler(object : ChannelInitializer() { + public override fun initChannel(ch: SocketChannel) { + ch.pipeline() + .addLast(HttpServerCodec()) + .addLast(HttpObjectAggregator(Int.MAX_VALUE)) + .addLast(HttpClientCodec()) + .addLast(WwwAvatar()) + } + }) override fun run() { logInfo("Loading Www")