From 501c23440412a8c511d6cdbb13f7c6d584cae963 Mon Sep 17 00:00:00 2001 From: Lanius Trolling Date: Tue, 14 Mar 2023 15:30:16 -0400 Subject: [PATCH] Change theme cookie name --- src/main/kotlin/info/mechyrdia/lore/view_tpl.kt | 2 +- src/main/kotlin/info/mechyrdia/lore/views_prefs.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/info/mechyrdia/lore/view_tpl.kt b/src/main/kotlin/info/mechyrdia/lore/view_tpl.kt index 6557a0a..c8ac1f2 100644 --- a/src/main/kotlin/info/mechyrdia/lore/view_tpl.kt +++ b/src/main/kotlin/info/mechyrdia/lore/view_tpl.kt @@ -7,7 +7,7 @@ import io.ktor.util.* import kotlinx.html.* fun ApplicationCall.page(pageTitle: String, navBar: List? = null, sidebar: Sidebar? = null, content: SECTIONS.() -> Unit): HTML.() -> Unit { - val theme = request.cookies["factbook-theme"] + val theme = request.cookies["FACTBOOK_THEME"] return { when (theme) { diff --git a/src/main/kotlin/info/mechyrdia/lore/views_prefs.kt b/src/main/kotlin/info/mechyrdia/lore/views_prefs.kt index 02558ed..44bcefd 100644 --- a/src/main/kotlin/info/mechyrdia/lore/views_prefs.kt +++ b/src/main/kotlin/info/mechyrdia/lore/views_prefs.kt @@ -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") } -- 2.25.1