X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FViewSonePage.kt;h=027373f22c97aec8cbe3735527b97bf9d88d15cb;hp=2e175afdf5567454895a126a7147fd49ea9be614;hb=369ba7692f167e5b7f9a27898a06a5d7920904ed;hpb=8e313509a42a8c638fcac018dd73dd975bf9cb68 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt index 2e175af..027373f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt @@ -11,12 +11,13 @@ import net.pterodactylus.sone.web.page.FreenetRequest import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import java.net.URI +import javax.inject.Inject /** * Lets the user browser another Sone. */ -class ViewSonePage(template: Template, webInterface: WebInterface): - SoneTemplatePage("viewSone.html", template, webInterface, false) { +class ViewSonePage @Inject constructor(template: Template, webInterface: WebInterface): + SoneTemplatePage("viewSone.html", webInterface, template) { override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { templateContext["soneId"] = freenetRequest.parameters["sone"] @@ -47,9 +48,9 @@ class ViewSonePage(template: Template, webInterface: WebInterface): } } - override fun isLinkExcepted(link: URI?) = true + override fun isLinkExcepted(link: URI) = true - public override fun getPageTitle(freenetRequest: FreenetRequest): String = + override fun getPageTitle(freenetRequest: FreenetRequest): String = freenetRequest.parameters["sone"]!!.let(webInterface.core::getSone)?.let { sone -> "${SoneAccessor.getNiceName(sone)} - ${webInterface.l10n.getString("Page.ViewSone.Title")}" } ?: webInterface.l10n.getString("Page.ViewSone.Page.TitleWithoutSone")