X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FSoneTemplatePage.kt;h=b4178cc39b520c49421e6d0978156eff32232632;hb=9bb01bc8fe281e6748ebd744ade8945bee841213;hp=3f04236ac871b113de94e06cc19d2c47ecd241bd;hpb=3cb0e2c78bb37f2d70ecde92ad4fcf642de788a3;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 3f04236..b4178cc 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt @@ -16,21 +16,15 @@ import java.net.URLEncoder /** * Base page for the Sone web interface. */ -open class SoneTemplatePage( +open class SoneTemplatePage @JvmOverloads constructor( path: String, protected val webInterface: WebInterface, template: Template, private val pageTitleKey: String? = null, - private val requiresLogin: Boolean = true + private val requiresLogin: Boolean = false, + private val pageTitle: (FreenetRequest) -> String = { pageTitleKey?.let(webInterface.l10n::getString) ?: "" } ) : FreenetTemplatePage(path, webInterface.templateContextFactory, template, "noPermission.html") { - @JvmOverloads - constructor(path: String, template: Template, pageTitleKey: String?, webInterface: WebInterface, requireLogin: Boolean = false) : - this(path, webInterface, template, pageTitleKey, requireLogin) - - constructor(path: String, template: Template, webInterface: WebInterface, requireLogin: Boolean = true) : - this(path, webInterface, template, null, requireLogin) - private val core = webInterface.core protected val sessionProvider: SessionProvider = webInterface @@ -42,8 +36,7 @@ open class SoneTemplatePage( fun requiresLogin() = requiresLogin - override public fun getPageTitle(freenetRequest: FreenetRequest) = - pageTitleKey?.let(webInterface.l10n::getString) ?: "" + override public fun getPageTitle(freenetRequest: FreenetRequest) = pageTitle(freenetRequest) override public fun getStyleSheets() = listOf("css/sone.css")