mirror of
https://github.com/ReVanced/revanced-api.git
synced 2026-01-30 06:31:03 +00:00
feat: Convert static about file to documented route & add key parameter to about route
This commit is contained in:
@@ -8,6 +8,7 @@ import app.revanced.api.configuration.routes.oldApiRoute
|
||||
import app.revanced.api.configuration.routes.patchesRoute
|
||||
import io.bkbn.kompendium.core.routes.redoc
|
||||
import io.bkbn.kompendium.core.routes.swagger
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.routing.*
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
@@ -25,7 +26,32 @@ internal fun Application.configureRouting() = routing {
|
||||
apiRoute()
|
||||
}
|
||||
|
||||
staticFiles("/", configuration.staticFilesPath)
|
||||
staticFiles("/", configuration.staticFilesPath) {
|
||||
contentType {
|
||||
when (it.extension) {
|
||||
"json" -> ContentType.Application.Json
|
||||
"asc" -> ContentType.Text.Plain
|
||||
"ico" -> ContentType.Image.XIcon
|
||||
"svg" -> ContentType.Image.SVG
|
||||
"jpg", "jpeg" -> ContentType.Image.JPEG
|
||||
"png" -> ContentType.Image.PNG
|
||||
"gif" -> ContentType.Image.GIF
|
||||
"mp4" -> ContentType.Video.MP4
|
||||
"ogg" -> ContentType.Video.OGG
|
||||
"mp3" -> ContentType.Audio.MPEG
|
||||
"css" -> ContentType.Text.CSS
|
||||
"js" -> ContentType.Application.JavaScript
|
||||
"html" -> ContentType.Text.Html
|
||||
"xml" -> ContentType.Application.Xml
|
||||
"pdf" -> ContentType.Application.Pdf
|
||||
"zip" -> ContentType.Application.Zip
|
||||
"gz" -> ContentType.Application.GZip
|
||||
else -> ContentType.Application.OctetStream
|
||||
}
|
||||
}
|
||||
|
||||
extensions("json", "asc")
|
||||
}
|
||||
|
||||
swagger(pageTitle = "ReVanced API", path = "/")
|
||||
redoc(pageTitle = "ReVanced API", path = "/redoc")
|
||||
|
||||
Reference in New Issue
Block a user