X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FUnlockSonePage.kt;h=e3d0352791f8a19955038a947bceae2759023a49;hb=1557106d0e373f7efc15faed65f69eb567613a45;hp=7ed2418be45a5da8b652b03dd651e7c6a827f186;hpb=848fabcf16150e5f650c83490be6a2e7109d3ce6;p=Sone.git 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..e3d0352 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt @@ -6,19 +6,20 @@ import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest import net.pterodactylus.util.template.Template 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(template: Template, webInterface: WebInterface): + SoneTemplatePage("unlockSone.html", webInterface, template, "Page.UnlockSone.Title") { - override fun handleRequest(request: FreenetRequest, templateContext: TemplateContext) { - if (request.isPOST) { - request.parameters["sone", 44] + override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { + if (freenetRequest.isPOST) { + freenetRequest.parameters["sone", 44] .let(webInterface.core::getLocalSone) ?.also(webInterface.core::unlockSone) - throw RedirectException(request.parameters["returnPage", 256]) + throw RedirectException(freenetRequest.parameters["returnPage", 256]) } }