Markdown improvements

This commit is contained in:
2020-08-24 18:50:54 +02:00
parent 815770303c
commit f6e33ed3b4
4 changed files with 64 additions and 69 deletions
+20 -20
View File
@@ -32,32 +32,32 @@ class Router(
ImmutableFilter().then(static(resourceLoader, "woff2" to ContentType("font/woff2"))),
)
fun public(request: Request, handler: PublicHandler) = handler(request, request.jwtPayload(contexts))
fun protected(request: Request, handler: ProtectedHandler) = handler(request, request.jwtPayload(contexts)!!)
infix fun PathMethod.public(handler: PublicHandler) = this to { handler(it, it.jwtPayload(contexts)) }
infix fun PathMethod.protected(handler: ProtectedHandler) = this to { handler(it, it.jwtPayload(contexts)!!) }
val publicRoutes: RoutingHttpHandler = routes(
"/" bind GET to { public(it, baseController::index) },
"/register" bind GET to { public(it, userController::register) },
"/register" bind POST to { public(it, userController::register) },
"/login" bind GET to { public(it, userController::login) },
"/login" bind POST to { public(it, userController::login) },
"/" bind GET public baseController::index,
"/register" bind GET public userController::register,
"/register" bind POST public userController::register,
"/login" bind GET public userController::login,
"/login" bind POST public userController::login,
"/logout" bind POST to userController::logout,
)
val protectedRoutes = routes(
"/settings" bind GET to { protected(it, settingsController::settings) },
"/settings" bind POST to { protected(it, settingsController::settings) },
"/export" bind POST to { protected(it, settingsController::export) },
"/notes" bind GET to { protected(it, noteController::list) },
"/notes" bind POST to { protected(it, noteController::search) },
"/notes/new" bind GET to { protected(it, noteController::new) },
"/notes/new" bind POST to { protected(it, noteController::new) },
"/notes/trash" bind GET to { protected(it, noteController::trash) },
"/notes/{uuid}" bind GET to { protected(it, noteController::note) },
"/notes/{uuid}" bind POST to { protected(it, noteController::note) },
"/notes/{uuid}/edit" bind GET to { protected(it, noteController::edit) },
"/notes/{uuid}/edit" bind POST to { protected(it, noteController::edit) },
"/notes/deleted/{uuid}" bind POST to { protected(it, noteController::deleted) },
"/settings" bind GET protected settingsController::settings,
"/settings" bind POST protected settingsController::settings,
"/export" bind POST protected settingsController::export,
"/notes" bind GET protected noteController::list,
"/notes" bind POST protected noteController::search,
"/notes/new" bind GET protected noteController::new,
"/notes/new" bind POST protected noteController::new,
"/notes/trash" bind GET protected noteController::trash,
"/notes/{uuid}" bind GET protected noteController::note,
"/notes/{uuid}" bind POST protected noteController::note,
"/notes/{uuid}/edit" bind GET protected noteController::edit,
"/notes/{uuid}/edit" bind POST protected noteController::edit,
"/notes/deleted/{uuid}" bind POST protected noteController::deleted,
)
val routes = routes(