X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FEditImagePage.kt;h=1870c021402687b11725e353c5bba099c868a289;hp=50578a3aa8809d84ce79f5dae5f6e8b92f104b22;hb=cd72add62ab407336b471d4b7cda8e33dd2df5c6;hpb=acf40290db822d7cbdaed590850f692953f51ac1 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt index 50578a3..1870c02 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt @@ -5,7 +5,7 @@ import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.text.TextFilter import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface -import net.pterodactylus.sone.web.page.FreenetRequest +import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -16,26 +16,26 @@ import javax.inject.Inject class EditImagePage @Inject constructor(template: Template, webInterface: WebInterface): LoggedInPage("editImage.html", template, "Page.EditImage.Title", webInterface) { - override fun handleRequest(freenetRequest: FreenetRequest, currentSone: Sone, templateContext: TemplateContext) { - if (freenetRequest.isPOST) { - val image = webInterface.core.getImage(freenetRequest.httpRequest.getPartAsStringFailsafe("image", 36)) ?: throw RedirectException("invalid.html") + override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { + if (soneRequest.isPOST) { + val image = soneRequest.core.getImage(soneRequest.httpRequest.getPartAsStringFailsafe("image", 36)) ?: throw RedirectException("invalid.html") if (!image.sone.isLocal) { throw RedirectException("noPermission.html") } - freenetRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256).let { returnPage -> - if (freenetRequest.httpRequest.getPartAsStringFailsafe("moveLeft", 4) == "true") { + soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256).let { returnPage -> + if (soneRequest.httpRequest.getPartAsStringFailsafe("moveLeft", 4) == "true") { image.album.moveImageUp(image) - webInterface.core.touchConfiguration() - } else if (freenetRequest.httpRequest.getPartAsStringFailsafe("moveRight", 4) == "true") { + soneRequest.core.touchConfiguration() + } else if (soneRequest.httpRequest.getPartAsStringFailsafe("moveRight", 4) == "true") { image.album.moveImageDown(image) - webInterface.core.touchConfiguration() + soneRequest.core.touchConfiguration() } else { try { image.modify() - .setTitle(freenetRequest.httpRequest.getPartAsStringFailsafe("title", 100)) - .setDescription(TextFilter.filter(freenetRequest.httpRequest.getHeader("Host"), freenetRequest.httpRequest.getPartAsStringFailsafe("description", 1024))) + .setTitle(soneRequest.httpRequest.getPartAsStringFailsafe("title", 100)) + .setDescription(TextFilter.filter(soneRequest.httpRequest.getHeader("Host"), soneRequest.httpRequest.getPartAsStringFailsafe("description", 1024))) .update() - webInterface.core.touchConfiguration() + soneRequest.core.touchConfiguration() } catch (e: ImageTitleMustNotBeEmpty) { throw RedirectException("emptyImageTitle.html") }