1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.data.*
4 import net.pterodactylus.sone.main.*
5 import net.pterodactylus.sone.utils.*
6 import net.pterodactylus.sone.web.*
7 import net.pterodactylus.sone.web.page.*
8 import net.pterodactylus.util.template.*
12 * Page that lets the user control the rescue mode for a Sone.
15 @TemplatePath("/templates/rescue.html")
16 @ToadletPath("rescue.html")
17 class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) :
18 LoggedInPage("Page.Rescue.Title", webInterface, loaders, templateRenderer) {
20 override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) {
21 val soneRescuer = soneRequest.core.getSoneRescuer(currentSone)
22 templateContext["soneRescuer"] = soneRescuer
23 if (soneRequest.isPOST) {
24 soneRequest.parameters["edition", 9]?.toIntOrNull()?.also {
26 soneRescuer.setEdition(it.toLong())
29 if (soneRequest.parameters["fetch", 8] == "true") {
30 soneRescuer.startNextFetch()
32 throw RedirectException("rescue.html")