X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FSoneTemplatePage.kt;h=ac1e15f11677eba2a9ec3785ac23151b5e417982;hb=3db634e425d3482bcf00dfd82e4b0d46785d5959;hp=1ff35a819bfb86d5c5fdde7588b34418611c083d;hpb=cd1f93dc057bdc6e89baeb41db0f749f2287224e;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt index 1ff35a8..ac1e15f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt @@ -18,7 +18,7 @@ import java.net.URLEncoder */ open class SoneTemplatePage @JvmOverloads constructor( path: String, - protected val webInterface: WebInterface, + private val webInterface: WebInterface, template: Template, private val pageTitleKey: String? = null, private val requiresLogin: Boolean = false, @@ -26,7 +26,7 @@ open class SoneTemplatePage @JvmOverloads constructor( ) : FreenetTemplatePage(path, webInterface.templateContextFactory, template, "noPermission.html") { private val core = webInterface.core - protected val sessionProvider: SessionProvider = webInterface + private val sessionProvider: SessionProvider = webInterface protected fun getCurrentSone(toadletContext: ToadletContext, createSession: Boolean = true) = sessionProvider.getCurrentSone(toadletContext, createSession) @@ -71,7 +71,7 @@ open class SoneTemplatePage @JvmOverloads constructor( handleRequest(freenetRequest, templateContext) } - internal open fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { + open fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { handleRequest(freenetRequest.toSoneRequest(core, webInterface), templateContext) } @@ -92,7 +92,7 @@ open class SoneTemplatePage @JvmOverloads constructor( private val String.urlEncode: String get() = URLEncoder.encode(this, "UTF-8") override fun isEnabled(toadletContext: ToadletContext) = - isEnabled(SoneRequest(toadletContext.uri, Method.GET, HTTPRequestImpl(toadletContext.uri, "GET"), toadletContext, webInterface.l10n, core, webInterface)) + isEnabled(SoneRequest(toadletContext.uri, Method.GET, HTTPRequestImpl(toadletContext.uri, "GET"), toadletContext, webInterface.l10n, webInterface.sessionManager, core, webInterface)) open fun isEnabled(soneRequest: SoneRequest) = when { requiresLogin && getCurrentSone(soneRequest.toadletContext) == null -> false