mirror of
https://github.com/ReVanced/revanced-api.git
synced 2026-01-31 15:11:03 +00:00
feat: Add static file paths to remove env specific files in resources
This commit is contained in:
@@ -4,8 +4,12 @@ import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
||||
import io.ktor.http.*
|
||||
import io.ktor.http.content.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.http.content.*
|
||||
import io.ktor.server.plugins.cachingheaders.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
import kotlin.time.Duration
|
||||
|
||||
internal suspend fun ApplicationCall.respondOrNotFound(value: Any?) = respond(value ?: HttpStatusCode.NotFound)
|
||||
@@ -25,3 +29,14 @@ internal fun ApplicationCallPipeline.installCache(cacheControl: CacheControl) =
|
||||
|
||||
internal fun ApplicationCallPipeline.installNotarizedRoute(configure: NotarizedRoute.Config.() -> Unit = {}) =
|
||||
install(NotarizedRoute(), configure)
|
||||
|
||||
internal fun Route.staticFiles(
|
||||
remotePath: String,
|
||||
dir: Path,
|
||||
block: StaticContentConfig<File>.() -> Unit = {
|
||||
contentType {
|
||||
ContentType.Application.Json
|
||||
}
|
||||
extensions("json")
|
||||
},
|
||||
) = staticFiles(remotePath, dir.toFile(), null, block)
|
||||
|
||||
Reference in New Issue
Block a user