1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.utils.isPOST
4 import net.pterodactylus.sone.utils.parameters
5 import net.pterodactylus.sone.web.WebInterface
6 import net.pterodactylus.sone.web.page.FreenetRequest
7 import net.pterodactylus.util.template.Template
8 import net.pterodactylus.util.template.TemplateContext
11 * Page that lets the user trust another Sone. This will assign a configurable
12 * amount of trust to an identity.
14 class TrustPage(template: Template, webInterface: WebInterface):
15 SoneTemplatePage("trust.html", template, "Page.Trust.Title", webInterface, true) {
17 override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
18 if (freenetRequest.isPOST) {
19 getCurrentSone(freenetRequest.toadletContext)?.also { currentSone ->
20 webInterface.core.getSone(freenetRequest.parameters["sone"]!!)?.let { sone ->
21 webInterface.core.trustSone(currentSone, sone)
24 throw RedirectException(freenetRequest.parameters["returnPage", 256])