chore: Ktorを非推奨に

This commit is contained in:
usbharu 2023-09-19 13:05:40 +09:00
parent 0cd4546256
commit ca0f9890c2
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
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 org.koin.ktor.ext.inject
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@Deprecated("Ktor is deprecated")
fun main(args: Array<String>): Unit = io.ktor.server.cio.EngineMain.main(args) fun main(args: Array<String>): Unit = io.ktor.server.cio.EngineMain.main(args)
val Application.property: Application.(propertyName: String) -> String 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. // application.conf references the main function. This annotation prevents the IDE from marking it as unused.
@Deprecated("Ktor is deprecated")
@Suppress("unused", "LongMethod") @Suppress("unused", "LongMethod")
fun Application.parent() { fun Application.parent() {
Config.configData = ConfigData( Config.configData = ConfigData(
@ -136,6 +138,7 @@ fun Application.parent() {
) )
} }
@Deprecated("Ktor is deprecated")
@Suppress("unused") @Suppress("unused")
fun Application.worker() { fun Application.worker() {
val kJob = kjob(ExposedKJob) { 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.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
@Deprecated("Config is deprecated")
object Config { object Config {
var configData: ConfigData = ConfigData() var configData: ConfigData = ConfigData()
} }
@Deprecated("Config is deprecated")
data class ConfigData( data class ConfigData(
val url: String = "", val url: String = "",
val domain: String = url.substringAfter("://").substringBeforeLast(":"), val domain: String = url.substringAfter("://").substringBeforeLast(":"),
@ -14,12 +16,14 @@ data class ConfigData(
val characterLimit: CharacterLimit = CharacterLimit() val characterLimit: CharacterLimit = CharacterLimit()
) )
@Deprecated("Config is deprecated")
data class CharacterLimit( data class CharacterLimit(
val general: General = General.of(), val general: General = General.of(),
val post: Post = Post(), val post: Post = Post(),
val account: Account = Account(), val account: Account = Account(),
val instance: Instance = Instance() val instance: Instance = Instance()
) { ) {
@Deprecated("Config is deprecated")
data class General private constructor( data class General private constructor(
val url: Int, val url: Int,
val domain: Int, val domain: Int,
@ -39,17 +43,20 @@ data class CharacterLimit(
} }
} }
@Deprecated("Config is deprecated")
data class Post( data class Post(
val text: Int = 3000, val text: Int = 3000,
val overview: Int = 3000 val overview: Int = 3000
) )
@Deprecated("Config is deprecated")
data class Account( data class Account(
val id: Int = 300, val id: Int = 300,
val name: Int = 300, val name: Int = 300,
val description: Int = 10000 val description: Int = 10000
) )
@Deprecated("Config is deprecated")
data class Instance( data class Instance(
val name: Int = 600, val name: Int = 600,
val description: Int = 10000 val description: Int = 10000

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,7 @@ import io.ktor.server.request.*
import io.ktor.server.response.* import io.ktor.server.response.*
import io.ktor.server.routing.* import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Routing.inbox( fun Routing.inbox(
httpSignatureVerifyService: HttpSignatureVerifyService, httpSignatureVerifyService: HttpSignatureVerifyService,
apService: dev.usbharu.hideout.service.ap.APService 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.response.*
import io.ktor.server.routing.* import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Routing.outbox() { fun Routing.outbox() {
route("/outbox") { route("/outbox") {
get { get {

View File

@ -15,6 +15,7 @@ import io.ktor.server.request.*
import io.ktor.server.response.* import io.ktor.server.response.*
import io.ktor.server.routing.* import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Routing.usersAP( fun Routing.usersAP(
apUserService: APUserService, apUserService: APUserService,
userQueryService: UserQueryService, userQueryService: UserQueryService,
@ -50,6 +51,7 @@ fun Routing.usersAP(
} }
} }
@Deprecated("Ktor is deprecated")
class ContentTypeRouteSelector(private vararg val contentType: ContentType) : RouteSelector() { class ContentTypeRouteSelector(private vararg val contentType: ContentType) : RouteSelector() {
override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation { override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation {
context.call.application.log.debug("Accept: ${context.call.request.accept()}") 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.response.*
import io.ktor.server.routing.* import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
fun Route.auth(userAuthApiService: UserAuthApiService) { fun Route.auth(userAuthApiService: UserAuthApiService) {
post("/login") { post("/login") {
val loginUser = call.receive<UserLogin>() 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.response.*
import io.ktor.server.routing.* import io.ktor.server.routing.*
@Deprecated("Ktor is deprecated")
@Suppress("LongMethod") @Suppress("LongMethod")
fun Route.posts(postApiService: PostApiService) { fun Route.posts(postApiService: PostApiService) {
route("/posts") { route("/posts") {

View File

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

View File

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