X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FSoneTemplatePage.kt;fp=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FSoneTemplatePage.kt;h=b4178cc39b520c49421e6d0978156eff32232632;hp=3f04236ac871b113de94e06cc19d2c47ecd241bd;hb=d63b7445567b65ffdbd50fa8f7ffbfea1304dff9;hpb=1715ce9da612dd959781e5e62135600b2876fdbf 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")