chore: Ktorを非推奨に

This commit is contained in:
usbharu 2023-09-19 13:05:40 +09:00
parent afb606c9e2
commit 4361fb2db5
20 changed files with 50 additions and 0 deletions

View File

@ -39,6 +39,7 @@ import org.koin.ksp.generated.module
import org.koin.ktor.ext.inject
import java.util.concurrent.TimeUnit
@Deprecated("Ktor is deprecated")
fun main(args: Array<String>): Unit = io.ktor.server.cio.EngineMain.main(args)
val Application.property: Application.(propertyName: String) -> String
@ -52,6 +53,7 @@ val Application.propertyOrNull: Application.(propertyName: String) -> String?
}
// application.conf references the main function. This annotation prevents the IDE from marking it as unused.
@Deprecated("Ktor is deprecated")
@Suppress("unused", "LongMethod")
fun Application.parent() {
Config.configData = ConfigData(
@ -136,6 +138,7 @@ fun Application.parent() {
)
}
@Deprecated("Ktor is deprecated")
@Suppress("unused")
fun Application.worker() {
val kJob = kjob(ExposedKJob) {

View File

@ -3,10 +3,12 @@ package dev.usbharu.hideout.config
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
@Deprecated("Config is deprecated")
object Config {
var configData: ConfigData = ConfigData()
}
@Deprecated("Config is deprecated")
data class ConfigData(
val url: String = "",
val domain: String = url.substringAfter("://").substringBeforeLast(":"),
@ -14,12 +16,14 @@ data class ConfigData(
val characterLimit: CharacterLimit = CharacterLimit()
)
@Deprecated("Config is deprecated")
data class CharacterLimit(
val general: General = General.of(),
val post: Post = Post(),
val account: Account = Account(),
val instance: Instance = Instance()
) {
@Deprecated("Config is deprecated")
data class General private constructor(
val url: Int,
val domain: Int,
@ -39,17 +43,20 @@ data class CharacterLimit(
}
}
@Deprecated("Config is deprecated")
data class Post(
val text: Int = 3000,
val overview: Int = 3000
)
@Deprecated("Config is deprecated")
data class Account(
val id: Int = 300,
val name: Int = 300,
val description: Int = 10000
)
@Deprecated("Config is deprecated")
data class Instance(
val name: Int = 600,
val description: Int = 10000

View File

@ -4,6 +4,7 @@ import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.plugins.compression.*
@Deprecated("Ktor is deprecated")
fun Application.configureCompression() {
install(Compression) {
gzip {

View File

@ -4,6 +4,7 @@ import io.ktor.server.application.*
import io.ktor.server.plugins.defaultheaders.*
import io.ktor.server.plugins.forwardedheaders.*
@Deprecated("Ktor is deprecated")
fun Application.configureHTTP() {
// install(CORS) {
// allowMethod(HttpMethod.Options)

View File

@ -5,6 +5,7 @@ import org.koin.core.module.Module
import org.koin.ktor.plugin.Koin
import org.koin.logger.slf4jLogger
@Deprecated("Ktor is deprecated")
fun Application.configureKoin(vararg module: Module) {
install(Koin) {
slf4jLogger()

View File

@ -4,6 +4,7 @@ import io.ktor.server.application.*
import io.ktor.server.plugins.callloging.*
import org.slf4j.event.Level
@Deprecated("Ktor is deprecated")
fun Application.configureMonitoring() {
install(CallLogging) {
level = Level.INFO

View File

@ -22,6 +22,7 @@ import io.ktor.server.application.*
import io.ktor.server.plugins.autohead.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
@Suppress("LongParameterList")
fun Application.configureRouting(
httpSignatureVerifyService: HttpSignatureVerifyService,

View File

@ -13,6 +13,7 @@ import io.ktor.server.routing.*
const val TOKEN_AUTH = "jwt-auth"
@Deprecated("Ktor is deprecated")
@Suppress("MagicNumber")
fun Application.configureSecurity(
jwkProvider: JwkProvider,

View File

@ -8,6 +8,7 @@ import io.ktor.serialization.jackson.*
import io.ktor.server.application.*
import io.ktor.server.plugins.contentnegotiation.*
@Deprecated("Ktor is deprecated")
fun Application.configureSerialization() {
install(ContentNegotiation) {
jackson {

View File

@ -6,6 +6,7 @@ import io.ktor.server.http.content.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Application.configureStaticRouting() {
routing {
get("/") {

View File

@ -6,6 +6,7 @@ import io.ktor.server.application.*
import io.ktor.server.plugins.statuspages.*
import io.ktor.server.response.*
@Deprecated("Ktor is deprecated")
fun Application.configureStatusPages() {
install(StatusPages) {
exception<IllegalArgumentException> { call, cause ->

View File

@ -8,6 +8,7 @@ import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Application.register(userApiService: UserApiService) {
routing {
get("/register") {

View File

@ -11,6 +11,7 @@ import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Routing.inbox(
httpSignatureVerifyService: HttpSignatureVerifyService,
apService: dev.usbharu.hideout.service.ap.APService

View File

@ -5,6 +5,7 @@ import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Routing.outbox() {
route("/outbox") {
get {

View File

@ -15,6 +15,7 @@ import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Routing.usersAP(
apUserService: APUserService,
userQueryService: UserQueryService,
@ -50,6 +51,7 @@ fun Routing.usersAP(
}
}
@Deprecated("Ktor is deprecated")
class ContentTypeRouteSelector(private vararg val contentType: ContentType) : RouteSelector() {
override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation {
context.call.application.log.debug("Accept: ${context.call.request.accept()}")

View File

@ -11,6 +11,7 @@ import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Route.auth(userAuthApiService: UserAuthApiService) {
post("/login") {
val loginUser = call.receive<UserLogin>()

View File

@ -14,6 +14,7 @@ import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
@Suppress("LongMethod")
fun Route.posts(postApiService: PostApiService) {
route("/posts") {

View File

@ -16,6 +16,7 @@ import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
@Suppress("LongMethod", "CognitiveComplexMethod")
fun Route.users(userService: UserService, userApiService: UserApiService) {
route("/users") {

View File

@ -11,6 +11,7 @@ import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Routing.webfinger(webFingerApiService: WebFingerApiService) {
route("/.well-known/webfinger") {
get {

View File

@ -0,0 +1,22 @@
openapi: 3.0.3
info:
title: Hideout Mastodon Compatible API
description: Hideout Mastodon Compatible API
version: 1.0.0
servers:
- url: 'https://test-hideout.usbharu.dev'
paths:
components:
schemas:
Account:
type: object
properties:
id:
type: string
username:
type: string
acct:
type: string
url:
type: string