Change theme cookie name
authorLanius Trolling <lanius@laniustrolling.dev>
Tue, 14 Mar 2023 19:30:16 +0000 (15:30 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Tue, 14 Mar 2023 19:30:16 +0000 (15:30 -0400)
src/main/kotlin/info/mechyrdia/lore/view_tpl.kt
src/main/kotlin/info/mechyrdia/lore/views_prefs.kt

index 6557a0aa4eee65657604a4bf41232df423bd6e24..c8ac1f210168446f1a5bf64565351d2325f745d1 100644 (file)
@@ -7,7 +7,7 @@ import io.ktor.util.*
 import kotlinx.html.*
 
 fun ApplicationCall.page(pageTitle: String, navBar: List<NavItem>? = null, sidebar: Sidebar? = null, content: SECTIONS.() -> Unit): HTML.() -> Unit {
-       val theme = request.cookies["factbook-theme"]
+       val theme = request.cookies["FACTBOOK_THEME"]
        
        return {
                when (theme) {
index 02558ed8e958281f4240f27d4593f1a8f70cf409..44bcefd69c5209c8af2362b28cebba51569d73d4 100644 (file)
@@ -7,7 +7,7 @@ import io.ktor.server.application.*
 import kotlinx.html.*
 
 suspend fun ApplicationCall.changeThemePage(): HTML.() -> Unit {
-       val theme = when (request.cookies["factbook-theme"]) {
+       val theme = when (request.cookies["FACTBOOK_THEME"]) {
                "light" -> "light"
                "dark" -> "dark"
                else -> null
@@ -63,7 +63,7 @@ suspend fun ApplicationCall.changeThemeRoute(): Nothing {
                "dark" -> "dark"
                else -> "system"
        }
-       response.cookies.append("factbook-theme", newTheme, maxAge = Int.MAX_VALUE.toLong())
+       response.cookies.append("FACTBOOK_THEME", newTheme, maxAge = Int.MAX_VALUE.toLong())
        
        redirect("/change-theme")
 }