From: TheSaminator Date: Sun, 20 Feb 2022 23:09:38 +0000 (-0500) Subject: Give up X-Git-Url: https://gitweb.starshipfights.net/?a=commitdiff_plain;h=2bbeae9e08c4dc1314a4da8a059be40ec2dd2c22;p=starship-fights Give up --- diff --git a/src/jvmMain/kotlin/starshipfights/auth/providers.kt b/src/jvmMain/kotlin/starshipfights/auth/providers.kt index d3d9221..86c74f0 100644 --- a/src/jvmMain/kotlin/starshipfights/auth/providers.kt +++ b/src/jvmMain/kotlin/starshipfights/auth/providers.kt @@ -438,7 +438,7 @@ object TestAuthProvider : AuthProvider { 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." } @@ -516,7 +516,7 @@ class ProductionAuthProvider(private val discordLogin: DiscordLogin) : AuthProvi 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" diff --git a/src/jvmMain/kotlin/starshipfights/info/html_metadata.kt b/src/jvmMain/kotlin/starshipfights/info/html_metadata.kt deleted file mode 100644 index bb41fbc..0000000 --- a/src/jvmMain/kotlin/starshipfights/info/html_metadata.kt +++ /dev/null @@ -1,24 +0,0 @@ -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) -} diff --git a/src/jvmMain/kotlin/starshipfights/info/view_tpl.kt b/src/jvmMain/kotlin/starshipfights/info/view_tpl.kt index 5ca4a71..2d098da 100644 --- a/src/jvmMain/kotlin/starshipfights/info/view_tpl.kt +++ b/src/jvmMain/kotlin/starshipfights/info/view_tpl.kt @@ -1,20 +1,11 @@ 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? = null, sidebar: Sidebar? = null, pageData: PageMetadata = PageMetadata.default, content: MAIN.() -> Unit): HTML.() -> Unit = { +fun page(pageTitle: String? = null, navBar: List? = 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" } diff --git a/src/jvmMain/kotlin/starshipfights/info/views_ships.kt b/src/jvmMain/kotlin/starshipfights/info/views_ships.kt index f7bc1cc..636cc9f 100644 --- a/src/jvmMain/kotlin/starshipfights/info/views_ships.kt +++ b/src/jvmMain/kotlin/starshipfights/info/views_ships.kt @@ -74,11 +74,7 @@ suspend fun ApplicationCall.shipsPage(): HTML.() -> Unit = page("Game Manual", s 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 } diff --git a/src/jvmMain/kotlin/starshipfights/info/views_user.kt b/src/jvmMain/kotlin/starshipfights/info/views_user.kt index 32963bc..b337c4a 100644 --- a/src/jvmMain/kotlin/starshipfights/info/views_user.kt +++ b/src/jvmMain/kotlin/starshipfights/info/views_user.kt @@ -98,11 +98,7 @@ suspend fun ApplicationCall.userPage(): HTML.() -> Unit { } } }*/ - }, - PageMetadata( - user.profileName, - user.profileBio - ) + } ) { section { h1 { +user.profileName } @@ -446,10 +442,6 @@ suspend fun ApplicationCall.admiralPage(): HTML.() -> Unit { NavLink("/admiral/${admiral.id}/manage", "Manage Admiral") ) else emptyList() - ), - PageMetadata( - admiral.name, - "${admiral.rank.getDisplayName(admiral.faction)} of the ${admiral.faction.navyName}" ) ) { section {