diff options
author | Marvin Borner | 2019-05-13 18:18:57 +0200 |
---|---|---|
committer | Marvin Borner | 2019-05-13 18:18:57 +0200 |
commit | b9a392f5f1db5c7de60e929fdcc0ca42885f81ca (patch) | |
tree | 0f9aa014bcabfc3d7205898ada71f15d4490cb0a /src/main/kotlin/App.kt | |
parent | 72073df2c225f96889620e30c963dd807ca01a90 (diff) |
Added user based dark theme support
Co-authored-by: LarsVomMars <lars@kroenner.eu>
Diffstat (limited to 'src/main/kotlin/App.kt')
-rw-r--r-- | src/main/kotlin/App.kt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/kotlin/App.kt b/src/main/kotlin/App.kt index df845a1..3607702 100644 --- a/src/main/kotlin/App.kt +++ b/src/main/kotlin/App.kt @@ -14,11 +14,11 @@ import java.util.logging.* import kotlin.system.* // TODO: Add abstract and secure file home support for windows/BSD/macOS -val fileHome = if (System.getProperty("os.name") != "Linux") "files" else "/usr/share/kloud/files" +const val debug = true +val fileHome = if (System.getProperty("os.name") != "Linux" || debug) "files" else "/usr/share/kloud/files" val databaseController = DatabaseController() val userHandler = UserHandler() val fileController = FileController() -const val debug = false private val log = Logger.getLogger("App.kt") fun main(args: Array<String>) { @@ -82,7 +82,7 @@ fun main(args: Array<String>) { get("/", { ctx -> ctx.render( "index.rocker.html", - model("username", databaseController.getUsername(userHandler.getVerifiedUserId(ctx))) + model("username", databaseController.getUsername(userHandler.getVerifiedUserId(ctx)), "ctx", ctx) ) }, roles(Roles.GUEST, Roles.USER)) @@ -102,6 +102,11 @@ fun main(args: Array<String>) { get("/user/logout", userHandler::logout, roles(Roles.USER)) /** + * Toggles the users theme + */ + post("/user/theme", userHandler::toggleTheme, roles(Roles.USER)) + + /** * Renders the registration page */ get("/user/register", userHandler::renderRegistration, roles(Roles.GUEST)) |