X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FUnlockSonePage.kt;h=22d82f6342effd4c11b77d9f8c82a212516dcd49;hp=7ed2418be45a5da8b652b03dd651e7c6a827f186;hb=110a933c2724aba6a604fc5eed6372ff1e1e6144;hpb=848fabcf16150e5f650c83490be6a2e7109d3ce6 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt index 7ed2418..22d82f6 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt @@ -1,24 +1,25 @@ package net.pterodactylus.sone.web.pages +import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest -import net.pterodactylus.util.template.Template +import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.template.TemplateContext +import javax.inject.Inject /** * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion. */ -class UnlockSonePage(template: Template, webInterface: WebInterface): - SoneTemplatePage("unlockSone.html", template, "Page.UnlockSone.Title", webInterface, false) { +class UnlockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("unlockSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.UnlockSone.Title") { - override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - if (request.isPOST) { - request.parameters["sone", 44] - .let(webInterface.core::getLocalSone) - ?.also(webInterface.core::unlockSone) - throw RedirectException(request.parameters["returnPage", 256]) + override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { + if (soneRequest.isPOST) { + soneRequest.parameters["sone", 44] + .let(soneRequest.core::getLocalSone) + ?.also(soneRequest.core::unlockSone) + throw RedirectException(soneRequest.parameters["returnPage", 256]) } }