Add syntax highlighting and config
parent
00111efb27
commit
624320b8b1
@ -1,3 +1,4 @@
|
||||
.gradle/
|
||||
*gradle*
|
||||
build/
|
||||
kodeshare.log
|
||||
.idea/
|
||||
|
@ -0,0 +1 @@
|
||||
database.password=12345
|
@ -0,0 +1,15 @@
|
||||
package moe.kageru.kodeshare.config
|
||||
|
||||
import com.uchuhimo.konf.Config
|
||||
import com.uchuhimo.konf.ConfigSpec
|
||||
|
||||
val config = Config { addSpec(DatabaseSpec) }
|
||||
.from.properties.file("kodeshare.properties")
|
||||
.from.env()
|
||||
|
||||
object DatabaseSpec : ConfigSpec() {
|
||||
val port by optional(3306)
|
||||
val password by required<String>()
|
||||
val user by optional("kodeshare")
|
||||
val database by optional("kode")
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package moe.kageru.kodeshare.pages
|
||||
|
||||
import io.ktor.html.HtmlContent
|
||||
import io.ktor.http.HttpStatusCode
|
||||
import kotlinx.html.*
|
||||
|
||||
object PastePage {
|
||||
fun build(content: String) = HtmlContent(HttpStatusCode.OK) {
|
||||
head {
|
||||
link(rel = "stylesheet", href = "/style.css", type = "text/css")
|
||||
link(
|
||||
rel = "stylesheet",
|
||||
href = "https://p.kageru.moe/static/hljs.css",
|
||||
type = "text/css"
|
||||
)
|
||||
script(src = "https://p.kageru.moe/static/hl.js") {}
|
||||
unsafe { +"<script>hljs.initHighlightingOnLoad();</script>" }
|
||||
}
|
||||
body {
|
||||
pre {
|
||||
code {
|
||||
+content
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue