val errorMsg = call.request.queryParameters["error"]
- call.respondHtml(HttpStatusCode.OK, call.page("Authentication Test", call.standardNavBar(), CustomSidebar {
+ call.respondHtml(HttpStatusCode.OK, page("Authentication Test", call.standardNavBar(), CustomSidebar {
p {
+"This instance does not have Discord OAuth login set up. As a fallback, this authentication mode is used for testing only."
}
get("/login") {
val errorMsg = call.request.queryParameters["error"]
- call.respondHtml(HttpStatusCode.OK, call.page("Login with Discord", call.standardNavBar()) {
+ call.respondHtml(HttpStatusCode.OK, page("Login with Discord", call.standardNavBar()) {
section {
p {
style = "text-align:center"
+++ /dev/null
-package starshipfights.info
-
-import kotlinx.html.HEAD
-
-data class PageMetadata(
- val title: String,
- val description: String,
-) {
- companion object {
- val default = PageMetadata(
- title = "Starship Fights",
- description = "Starship Fights is a space fleet battle game. Choose your allegiance, create your admiral, build up your fleet, and destroy your enemies' fleets with it!",
- )
- }
-}
-
-fun HEAD.metadata(pageMetadata: PageMetadata, url: String) {
- metaOG("og:title", pageMetadata.title)
- metaOG("og:description", pageMetadata.description)
- metaOG("og:image", "https://starshipfights.net/static/images/embed-logo.png")
- metaOG("og:type", "website")
- metaOG("og:site_name", "Starship Fights")
- metaOG("og:url", url)
-}
package starshipfights.info
-import io.ktor.application.*
-import io.ktor.http.*
-import io.ktor.util.*
import kotlinx.html.*
-fun ApplicationCall.page(pageTitle: String? = null, navBar: List<NavItem>? = null, sidebar: Sidebar? = null, pageData: PageMetadata = PageMetadata.default, content: MAIN.() -> Unit): HTML.() -> Unit = {
+fun page(pageTitle: String? = null, navBar: List<NavItem>? = null, sidebar: Sidebar? = null, content: MAIN.() -> Unit): HTML.() -> Unit = {
head {
meta(charset = "utf-8")
- metadata(pageData, url {
- host = "starshipfights.net"
- protocol = URLProtocol.HTTPS
- port = 443
- })
-
link(rel = "icon", type = "image/svg+xml", href = "/static/images/icon.svg")
link(rel = "preconnect", href = "https://fonts.googleapis.com")
link(rel = "preconnect", href = "https://fonts.gstatic.com") { attributes["crossorigin"] = "anonymous" }
suspend fun ApplicationCall.shipPage(shipType: ShipType): HTML.() -> Unit = page(
shipType.fullerDisplayName,
standardNavBar(),
- ShipViewSidebar(shipType),
- PageMetadata(
- shipType.displayName + "-class Starship",
- "A ${shipType.weightClass.displayName} of the ${shipType.faction.navyName}"
- )
+ ShipViewSidebar(shipType)
) {
section {
h1 { +shipType.fullDisplayName }
}
}
}*/
- },
- PageMetadata(
- user.profileName,
- user.profileBio
- )
+ }
) {
section {
h1 { +user.profileName }
NavLink("/admiral/${admiral.id}/manage", "Manage Admiral")
)
else emptyList()
- ),
- PageMetadata(
- admiral.name,
- "${admiral.rank.getDisplayName(admiral.faction)} of the ${admiral.faction.navyName}"
)
) {
section {