X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FUnlockSoneAjaxPage.kt;h=efa70f100c267540a6f2c80870a72e2e3be87950;hb=6a3f1fede0cda5cd6ed56204aa1dd37a19813cb9;hp=2dffbed4bc6f2a1cfc420bd176c0e7dac3ad5bef;hpb=8419f82ea9a6da6f4c8c564e13a2614be89ae3df;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/UnlockSoneAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/UnlockSoneAjaxPage.kt index 2dffbed..efa70f1 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/UnlockSoneAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/UnlockSoneAjaxPage.kt @@ -3,19 +3,21 @@ package net.pterodactylus.sone.web.ajax import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest +import javax.inject.Inject /** * Lets the user [unlock][net.pterodactylus.sone.core.Core.unlockSone] a [Sone][net.pterodactylus.sone.data.Sone]. */ -class UnlockSoneAjaxPage(webInterface: WebInterface) : JsonPage("unlockSone.ajax", webInterface) { +class UnlockSoneAjaxPage @Inject constructor(webInterface: WebInterface) : + JsonPage("unlockSone.ajax", webInterface) { - override fun requiresLogin() = false + override val requiresLogin = false override fun createJsonObject(request: FreenetRequest) = request.parameters["sone"] - ?.let(webInterface.core::getLocalSone) - ?.also(webInterface.core::unlockSone) - ?.also { webInterface.core.touchConfiguration() } + ?.let(core::getLocalSone) + ?.also(core::unlockSone) + ?.also { core.touchConfiguration() } ?.let { createSuccessJsonObject() } ?: createErrorJsonObject("invalid-sone-id")