aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/App.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/App.kt')
-rw-r--r--src/main/kotlin/App.kt11
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))