More embed stuff
This commit is contained in:
parent
8e5becc777
commit
dfe048bac2
@ -132,7 +132,7 @@ object Routes {
|
||||
if (raw) {
|
||||
respondText(paste.content, ContentType.Text.Plain)
|
||||
} else {
|
||||
respond(HttpStatusCode.OK, PastePage.build(paste.content, ext))
|
||||
respond(HttpStatusCode.OK, PastePage.build(paste.content, paste.uri, ext))
|
||||
}
|
||||
} ?: respond(HttpStatusCode.NotFound, "nothing found for id $uri")
|
||||
}
|
||||
|
@ -10,10 +10,7 @@ object AboutPage {
|
||||
private val domain = "${config[ServerSpec.domain]}"
|
||||
val content = HtmlContent(HttpStatusCode.OK) {
|
||||
head {
|
||||
link(rel = "stylesheet", href = "/style.css", type = "text/css")
|
||||
meta(content = "About Kodeshare – a FOSS [ph]astebin alternative") {
|
||||
attributes["property"] = "og:title"
|
||||
}
|
||||
defaultHead("About kodeshare")
|
||||
}
|
||||
body {
|
||||
div("wrapper") {
|
||||
|
@ -7,10 +7,7 @@ import kotlinx.html.*
|
||||
object Homepage {
|
||||
val content = HtmlContent(HttpStatusCode.OK) {
|
||||
head {
|
||||
link(rel = "stylesheet", href = "/style.css", type = "text/css")
|
||||
meta(content = "Kodeshare – a FOSS [ph]astebin alternative") {
|
||||
attributes["property"] = "og:title"
|
||||
}
|
||||
defaultHead("Create new paste")
|
||||
}
|
||||
body {
|
||||
a("/about") { div(Css.FLOATY_CLASS) { +"About" } }
|
||||
@ -29,3 +26,14 @@ object Homepage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun HEAD.defaultHead(title: String) {
|
||||
link(rel = "stylesheet", href = "/style.css", type = "text/css")
|
||||
meta(content = title) {
|
||||
attributes["property"] = "og:title"
|
||||
}
|
||||
meta(content = "kodeshare – a FOSS pastebin alternative") {
|
||||
attributes["property"] = "og:site_name"
|
||||
}
|
||||
meta(name = "theme-color", content = "#66D9EF")
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import io.ktor.html.HtmlContent
|
||||
import kotlinx.html.*
|
||||
|
||||
object PastePage {
|
||||
fun build(content: String, type: String?) = HtmlContent {
|
||||
fun build(content: String, uri: String, type: String?) = HtmlContent {
|
||||
head {
|
||||
link(rel = "stylesheet", href = "/style.css", type = "text/css")
|
||||
link(
|
||||
@ -13,9 +13,7 @@ object PastePage {
|
||||
type = "text/css"
|
||||
)
|
||||
script(src = "https://p.kageru.moe/static/hl.js") {}
|
||||
meta(content = "Kodeshare – a FOSS [ph]astebin alternative") {
|
||||
attributes["property"] = "og:title"
|
||||
}
|
||||
defaultHead("View paste $uri${type?.let { " (type $it)" } ?: ""}")
|
||||
// Show the first 3 lines in preview/embed for applications like discord, slack, or skype
|
||||
meta(content = content.lines().take(3).joinToString("\n")) {
|
||||
attributes["property"] = "og:description"
|
||||
|
Loading…
Reference in New Issue
Block a user