From: David ‘Bombe’ Roden Date: Fri, 17 May 2019 21:52:21 +0000 (+0200) Subject: 🔥 Remove templates from FreenetTemplatePages X-Git-Tag: v79^2~22 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=110a933c2724aba6a604fc5eed6372ff1e1e6144;p=Sone.git 🔥 Remove templates from FreenetTemplatePages --- diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index d247993..3d131c8 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -609,82 +609,56 @@ public class WebInterface implements SessionProvider { * Register all toadlets. */ private void registerToadlets() { - Template emptyTemplate = parse(new StringReader("")); - Template loginTemplate = loaders.loadTemplate("/templates/login.html"); - Template indexTemplate = loaders.loadTemplate("/templates/index.html"); - Template newTemplate = loaders.loadTemplate("/templates/new.html"); - Template knownSonesTemplate = loaders.loadTemplate("/templates/knownSones.html"); - Template createSoneTemplate = loaders.loadTemplate("/templates/createSone.html"); - Template createPostTemplate = loaders.loadTemplate("/templates/createPost.html"); - Template createReplyTemplate = loaders.loadTemplate("/templates/createReply.html"); - Template bookmarksTemplate = loaders.loadTemplate("/templates/bookmarks.html"); - Template searchTemplate = loaders.loadTemplate("/templates/search.html"); - Template editProfileTemplate = loaders.loadTemplate("/templates/editProfile.html"); - Template editProfileFieldTemplate = loaders.loadTemplate("/templates/editProfileField.html"); - Template deleteProfileFieldTemplate = loaders.loadTemplate("/templates/deleteProfileField.html"); - Template viewSoneTemplate = loaders.loadTemplate("/templates/viewSone.html"); - Template viewPostTemplate = loaders.loadTemplate("/templates/viewPost.html"); - Template deletePostTemplate = loaders.loadTemplate("/templates/deletePost.html"); - Template deleteReplyTemplate = loaders.loadTemplate("/templates/deleteReply.html"); - Template deleteSoneTemplate = loaders.loadTemplate("/templates/deleteSone.html"); - Template imageBrowserTemplate = loaders.loadTemplate("/templates/imageBrowser.html"); - Template createAlbumTemplate = loaders.loadTemplate("/templates/createAlbum.html"); - Template deleteAlbumTemplate = loaders.loadTemplate("/templates/deleteAlbum.html"); - Template deleteImageTemplate = loaders.loadTemplate("/templates/deleteImage.html"); - Template optionsTemplate = loaders.loadTemplate("/templates/options.html"); - Template rescueTemplate = loaders.loadTemplate("/templates/rescue.html"); - Template aboutTemplate = loaders.loadTemplate("/templates/about.html"); - Template invalidTemplate = loaders.loadTemplate("/templates/invalid.html"); Template postTemplate = loaders.loadTemplate("/templates/include/viewPost.html"); Template replyTemplate = loaders.loadTemplate("/templates/include/viewReply.html"); Template openSearchTemplate = loaders.loadTemplate("/templates/xml/OpenSearch.xml"); pageToadletRegistry.addPage(new RedirectPage("", "index.html")); - pageToadletRegistry.addPage(new IndexPage(indexTemplate, this, loaders, templateRenderer, postVisibilityFilter)); - pageToadletRegistry.addPage(new NewPage(newTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new CreateSonePage(createSoneTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new KnownSonesPage(knownSonesTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new EditProfilePage(editProfileTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new EditProfileFieldPage(editProfileFieldTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DeleteProfileFieldPage(deleteProfileFieldTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new CreatePostPage(createPostTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new CreateReplyPage(createReplyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new ViewSonePage(viewSoneTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new ViewPostPage(viewPostTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new LikePage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new UnlikePage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DeletePostPage(deletePostTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DeleteReplyPage(deleteReplyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new LockSonePage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new UnlockSonePage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new FollowSonePage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new UnfollowSonePage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new ImageBrowserPage(imageBrowserTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new CreateAlbumPage(createAlbumTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new EditAlbumPage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DeleteAlbumPage(deleteAlbumTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new UploadImagePage(invalidTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new EditImagePage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DeleteImagePage(deleteImageTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new TrustPage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DistrustPage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new UntrustPage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new MarkAsKnownPage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new BookmarkPage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new UnbookmarkPage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new BookmarksPage(bookmarksTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new SearchPage(searchTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DeleteSonePage(deleteSoneTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new LoginPage(loginTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new LogoutPage(emptyTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new OptionsPage(optionsTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new RescuePage(rescueTemplate, this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new AboutPage(aboutTemplate, this, loaders, templateRenderer, new PluginVersion(SonePlugin.getPluginVersion()), new PluginYear(sonePlugin.getYear()), new PluginHomepage(sonePlugin.getHomepage()))); + pageToadletRegistry.addPage(new IndexPage(this, loaders, templateRenderer, postVisibilityFilter)); + pageToadletRegistry.addPage(new NewPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new CreateSonePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new KnownSonesPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new EditProfilePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new EditProfileFieldPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new DeleteProfileFieldPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new CreatePostPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new CreateReplyPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new ViewSonePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new ViewPostPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new LikePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new UnlikePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new DeletePostPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new DeleteReplyPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new LockSonePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new UnlockSonePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new FollowSonePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new UnfollowSonePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new ImageBrowserPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new CreateAlbumPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new EditAlbumPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new DeleteAlbumPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new UploadImagePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new EditImagePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new DeleteImagePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new TrustPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new DistrustPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new UntrustPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new MarkAsKnownPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new BookmarkPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new UnbookmarkPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new BookmarksPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new SearchPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new DeleteSonePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new LoginPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new LogoutPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new OptionsPage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new RescuePage(this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new AboutPage(this, loaders, templateRenderer, new PluginVersion(SonePlugin.getPluginVersion()), new PluginYear(sonePlugin.getYear()), new PluginHomepage(sonePlugin.getHomepage()))); pageToadletRegistry.addPage(new InvalidPage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(new NoPermissionPage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(new EmptyImageTitlePage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(new EmptyAlbumTitlePage(this, loaders, templateRenderer)); - pageToadletRegistry.addPage(new DismissNotificationPage(emptyTemplate, this, loaders, templateRenderer)); + pageToadletRegistry.addPage(new DismissNotificationPage(this, loaders, templateRenderer)); pageToadletRegistry.addPage(loaders.loadStaticPage("css/", "/static/css/", "text/css")); pageToadletRegistry.addPage(loaders.loadStaticPage("javascript/", "/static/javascript/", "text/javascript")); pageToadletRegistry.addPage(loaders.loadStaticPage("images/", "/static/images/", "image/png")); diff --git a/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePage.kt index c9ec173..900ece9 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePage.kt @@ -34,7 +34,6 @@ open class FreenetTemplatePage( private val path: String, private val templateRenderer: TemplateRenderer, loaders: Loaders, - template: Template, private val invalidFormPasswordRedirectTarget: String ) : FreenetPage, LinkEnabledCallback { @@ -56,7 +55,7 @@ open class FreenetTemplatePage( override fun isEnabled(toadletContext: ToadletContext) = !isFullAccessOnly - private val template = templatePath?.let(loaders::loadTemplate) ?: template + private val template = templatePath?.let(loaders::loadTemplate) ?: Template() override fun handleRequest(request: FreenetRequest, response: Response): Response { getRedirectTarget(request)?.let { redirectTarget -> return RedirectResponse(redirectTarget) } diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt index 7c53a08..31aee05 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt @@ -3,7 +3,6 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.main.* import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -12,10 +11,10 @@ import javax.inject.Inject */ @MenuName("About") @TemplatePath("/templates/about.html") -class AboutPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, +class AboutPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, private val pluginVersion: PluginVersion, private val pluginYear: PluginYear, - private val pluginHomepage: PluginHomepage): SoneTemplatePage("about.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.About.Title") { + private val pluginHomepage: PluginHomepage): SoneTemplatePage("about.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.About.Title") { override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { templateContext["version"] = pluginVersion.version diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarkPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarkPage.kt index c85c3ba..db7fb52 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarkPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarkPage.kt @@ -4,15 +4,14 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * Page that lets the user bookmark a post. */ -class BookmarkPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) - : SoneTemplatePage("bookmark.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Bookmark.Title") { +class BookmarkPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) + : SoneTemplatePage("bookmark.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Bookmark.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarksPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarksPage.kt index 7b4cbdc..abfe858 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarksPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarksPage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.paginate import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -14,8 +13,8 @@ import javax.inject.Inject */ @MenuName("Bookmarks") @TemplatePath("/templates/bookmarks.html") -class BookmarksPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - SoneTemplatePage("bookmarks.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Bookmarks.Title") { +class BookmarksPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + SoneTemplatePage("bookmarks.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Bookmarks.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { soneRequest.core.bookmarkedPosts.let { posts -> diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt index 98c2143..2c3105c 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt @@ -7,7 +7,6 @@ import net.pterodactylus.sone.text.TextFilter import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -15,8 +14,8 @@ import javax.inject.Inject * Page that lets the user create a new album. */ @TemplatePath("/templates/createAlbum.html") -class CreateAlbumPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("createAlbum.html", template, "Page.CreateAlbum.Title", webInterface, loaders, templateRenderer) { +class CreateAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("createAlbum.html", "Page.CreateAlbum.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt index b1d62b3..0245735 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt @@ -7,7 +7,6 @@ import net.pterodactylus.sone.utils.asOptional import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -15,8 +14,8 @@ import javax.inject.Inject * This page lets the user create a new [Post]. */ @TemplatePath("/templates/createPost.html") -class CreatePostPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("createPost.html", template, "Page.CreatePost.Title", webInterface, loaders, templateRenderer) { +class CreatePostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("createPost.html", "Page.CreatePost.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { val returnPage = soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt index d38a6ce..812f369 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt @@ -6,7 +6,6 @@ import net.pterodactylus.sone.text.TextFilter import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -14,8 +13,8 @@ import javax.inject.Inject * This page lets the user post a reply to a post. */ @TemplatePath("/templates/createReply.html") -class CreateReplyPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("createReply.html", template, "Page.CreateReply.Title", webInterface, loaders, templateRenderer) { +class CreateReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("createReply.html", "Page.CreateReply.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { val postId = soneRequest.httpRequest.getPartAsStringFailsafe("post", 36).apply { templateContext["postId"] = this } diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt index 6c39248..55b5b66 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt @@ -6,7 +6,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import java.util.logging.Level import java.util.logging.Logger @@ -17,8 +16,8 @@ import javax.inject.Inject */ @MenuName("CreateSone") @TemplatePath("/templates/createSone.html") -class CreateSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("createSone.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.CreateSone.Title") { +class CreateSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("createSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.CreateSone.Title") { private val logger = Logger.getLogger(CreateSonePage::class.java.name) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt index ba61ad2..0669aa4 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -13,8 +12,8 @@ import javax.inject.Inject * Page that lets the user delete an {@link Album}. */ @TemplatePath("/templates/deleteAlbum.html") -class DeleteAlbumPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("deleteAlbum.html", template, "Page.DeleteAlbum.Title", webInterface, loaders, templateRenderer) { +class DeleteAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("deleteAlbum.html", "Page.DeleteAlbum.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt index c0d43aa..27ce0c7 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -13,8 +12,8 @@ import javax.inject.Inject * Page that lets the user delete an {@link Image}. */ @TemplatePath("/templates/deleteImage.html") -class DeleteImagePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("deleteImage.html", template, "Page.DeleteImage.Title", webInterface, loaders, templateRenderer) { +class DeleteImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("deleteImage.html", "Page.DeleteImage.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt index 17b1616..028ebb3 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -13,8 +12,8 @@ import javax.inject.Inject * Lets the user delete a post they made. */ @TemplatePath("/templates/deletePost.html") -class DeletePostPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("deletePost.html", template, "Page.DeletePost.Title", webInterface, loaders, templateRenderer) { +class DeletePostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("deletePost.html", "Page.DeletePost.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt index 348b81c..b331232 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -13,8 +12,8 @@ import javax.inject.Inject * Page that lets the user confirm the deletion of a profile field. */ @TemplatePath("/templates/deleteProfileField.html") -class DeleteProfileFieldPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("deleteProfileField.html", template, "Page.DeleteProfileField.Title", webInterface, loaders, templateRenderer) { +class DeleteProfileFieldPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("deleteProfileField.html", "Page.DeleteProfileField.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt index 9857e69..909f645 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -13,8 +12,8 @@ import javax.inject.Inject * This page lets the user delete a reply. */ @TemplatePath("/templates/deleteReply.html") -class DeleteReplyPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("deleteReply.html", template, "Page.DeleteReply.Title", webInterface, loaders, templateRenderer) { +class DeleteReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("deleteReply.html", "Page.DeleteReply.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt index ec3319e..266fe78 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -16,8 +15,8 @@ import javax.inject.Inject */ @MenuName("DeleteSone") @TemplatePath("/templates/deleteSone.html") -class DeleteSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("deleteSone.html", template, "Page.DeleteSone.Title", webInterface, loaders, templateRenderer) { +class DeleteSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("deleteSone.html", "Page.DeleteSone.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt index f240665..a6b25de 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt @@ -3,15 +3,14 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.main.* import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * Page that lets the user dismiss a notification. */ -class DismissNotificationPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("dismissNotification.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") { +class DismissNotificationPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("dismissNotification.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { val returnPage = soneRequest.httpRequest.getPartAsStringFailsafe("returnPage", 256) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt index 051ac38..85b6f80 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -15,8 +14,8 @@ import javax.inject.Inject * * @see net.pterodactylus.sone.core.Core#distrustSone(Sone, Sone) */ -class DistrustPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("distrust.html", template, "Page.Distrust.Title", webInterface, loaders, templateRenderer) { +class DistrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("distrust.html", "Page.Distrust.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt index 668f6eb..7bc35f9 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt @@ -6,15 +6,14 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * Page that lets the user edit the name and description of an album. */ -class EditAlbumPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("editAlbum.html", template, "Page.EditAlbum.Title", webInterface, loaders, templateRenderer) { +class EditAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("editAlbum.html", "Page.EditAlbum.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { 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 d55a7be..09a991a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt @@ -7,15 +7,14 @@ import net.pterodactylus.sone.text.TextFilter import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * Page that lets the user edit title and description of an {@link Image}. */ -class EditImagePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("editImage.html", template, "Page.EditImage.Title", webInterface, loaders, templateRenderer) { +class EditImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("editImage.html", "Page.EditImage.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPage.kt index cf23d47..a1b57ad 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -13,8 +12,8 @@ import javax.inject.Inject * Page that lets the user edit the name of a profile field. */ @TemplatePath("/templates/editProfileField.html") -class EditProfileFieldPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - LoggedInPage("editProfileField.html", template, "Page.EditProfileField.Title", webInterface, loaders, templateRenderer) { +class EditProfileFieldPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("editProfileField.html", "Page.EditProfileField.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { currentSone.profile.let { profile -> diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfilePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfilePage.kt index ff9faab..c1ba3c1 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfilePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfilePage.kt @@ -7,7 +7,6 @@ import net.pterodactylus.sone.text.TextFilter import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -16,8 +15,8 @@ import javax.inject.Inject */ @MenuName("EditProfile") @TemplatePath("/templates/editProfile.html") -class EditProfilePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - LoggedInPage("editProfile.html", template, "Page.EditProfile.Title", webInterface, loaders, templateRenderer) { +class EditProfilePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("editProfile.html", "Page.EditProfile.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { currentSone.profile.let { profile -> diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/ErrorPages.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/ErrorPages.kt index 91893d3..bd6cb1f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ErrorPages.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ErrorPages.kt @@ -3,16 +3,15 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.main.* import net.pterodactylus.sone.web.* import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.* @TemplatePath("/templates/invalid.html") -class InvalidPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("invalid.html", webInterface, loaders, Template(), templateRenderer, "Page.Invalid.Title") +class InvalidPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("invalid.html", webInterface, loaders, templateRenderer, "Page.Invalid.Title") @TemplatePath("/templates/noPermission.html") -class NoPermissionPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("noPermission.html", webInterface, loaders, Template(), templateRenderer, "Page.NoPermission.Title") +class NoPermissionPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("noPermission.html", webInterface, loaders, templateRenderer, "Page.NoPermission.Title") @TemplatePath("/templates/emptyImageTitle.html") -class EmptyImageTitlePage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("emptyImageTitle.html", webInterface, loaders, Template(), templateRenderer, "Page.EmptyImageTitle.Title") +class EmptyImageTitlePage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("emptyImageTitle.html", webInterface, loaders, templateRenderer, "Page.EmptyImageTitle.Title") @TemplatePath("/templates/emptyAlbumTitle.html") -class EmptyAlbumTitlePage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("emptyAlbumTitle.html", webInterface, loaders, Template(), templateRenderer, "Page.EmptyAlbumTitle.Title") +class EmptyAlbumTitlePage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("emptyAlbumTitle.html", webInterface, loaders, templateRenderer, "Page.EmptyAlbumTitle.Title") diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt index 4747715..3926851 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt @@ -5,15 +5,14 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * This page lets the user follow another Sone. */ -class FollowSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("followSone.html", template, "Page.FollowSone.Title", webInterface, loaders, templateRenderer) { +class FollowSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("followSone.html", "Page.FollowSone.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt index 10e6a0c..3fe4f5b 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt @@ -7,7 +7,6 @@ import net.pterodactylus.sone.utils.paginate import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import java.net.URI import javax.inject.Inject @@ -17,8 +16,8 @@ import javax.inject.Inject */ @MenuName("ImageBrowser") @TemplatePath("/templates/imageBrowser.html") -class ImageBrowserPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("imageBrowser.html", template, "Page.ImageBrowser.Title", webInterface, loaders, templateRenderer) { +class ImageBrowserPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("imageBrowser.html", "Page.ImageBrowser.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if ("album" in soneRequest.parameters) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt index 89cd359..79d6c31 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt @@ -7,7 +7,6 @@ import net.pterodactylus.sone.utils.paginate import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -17,8 +16,8 @@ import javax.inject.Inject */ @MenuName("Index") @TemplatePath("/templates/index.html") -class IndexPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, private val postVisibilityFilter: PostVisibilityFilter) : - LoggedInPage("index.html", template, "Page.Index.Title", webInterface, loaders, templateRenderer) { +class IndexPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, private val postVisibilityFilter: PostVisibilityFilter) : + LoggedInPage("index.html", "Page.Index.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { (currentSone.posts + diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt index b795f15..746d093 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt @@ -6,7 +6,6 @@ import net.pterodactylus.sone.utils.paginate import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -15,8 +14,8 @@ import javax.inject.Inject */ @MenuName("KnownSones") @TemplatePath("/templates/knownSones.html") -class KnownSonesPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("knownSones.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.KnownSones.Title") { +class KnownSonesPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("knownSones.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.KnownSones.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { getCurrentSone(soneRequest.toadletContext).let { currentSone -> diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LikePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LikePage.kt index 4db5099..afaee6a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LikePage.kt @@ -6,15 +6,14 @@ import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * Page that lets the user like [net.pterodactylus.sone.data.Post]s and [net.pterodactylus.sone.data.Reply]s. */ -class LikePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - LoggedInPage("like.html", template, "Page.Like.Title", webInterface, loaders, templateRenderer) { +class LikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("like.html", "Page.Like.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt index 1c7faa9..93c2c4c 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt @@ -4,15 +4,14 @@ import net.pterodactylus.sone.main.* import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * This page lets the user lock a [net.pterodactylus.sone.data.Sone] to prevent it from being inserted. */ -class LockSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("lockSone.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.LockSone.Title") { +class LockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("lockSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.LockSone.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { soneRequest.parameters["returnPage", 256]!!.let { returnPage -> diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoggedInPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoggedInPage.kt index 3e3ad4a..c74f5ff 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoggedInPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoggedInPage.kt @@ -4,14 +4,13 @@ import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.main.* import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext /** * Base class for [SoneTemplatePage] implementations that require a logged in user. */ -abstract class LoggedInPage(path: String, template: Template, pageTitleKey: String, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - SoneTemplatePage(path, webInterface, loaders, template, templateRenderer, pageTitleKey = pageTitleKey, requiresLogin = true) { +abstract class LoggedInPage(path: String, pageTitleKey: String, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + SoneTemplatePage(path, webInterface, loaders, templateRenderer, pageTitleKey = pageTitleKey, requiresLogin = true) { final override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { handleRequest(soneRequest, getCurrentSone(soneRequest.toadletContext, false)!!, templateContext) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt index 8e927c5..4c85b38 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt @@ -7,7 +7,6 @@ import net.pterodactylus.sone.utils.emptyToNull import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -16,8 +15,8 @@ import javax.inject.Inject */ @MenuName("Login") @TemplatePath("/templates/login.html") -class LoginPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("login.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Login.Title") { +class LoginPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("login.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Login.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt index 38ce74f..09c7f24 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt @@ -5,7 +5,6 @@ import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.main.* import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -13,8 +12,8 @@ import javax.inject.Inject * Logs a user out. */ @MenuName("Logout") -class LogoutPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("logout.html", template, "Page.Logout.Title", webInterface, loaders, templateRenderer) { +class LogoutPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("logout.html", "Page.Logout.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { setCurrentSone(soneRequest.toadletContext, null) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt index 17fe0cf..8b67c03 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt @@ -12,8 +12,8 @@ import javax.inject.* * Page that lets the user mark a number of [net.pterodactylus.sone.data.Sone]s, [Post]s, or * [Replie][net.pterodactylus.sone.data.Reply]s as known. */ -class MarkAsKnownPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("markAsKnown.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.MarkAsKnown.Title") { +class MarkAsKnownPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("markAsKnown.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.MarkAsKnown.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { val ids = soneRequest.parameters["id", 65536]!!.split(" ") diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt index 149f5ea..e00189a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt @@ -6,7 +6,6 @@ import net.pterodactylus.sone.utils.paginate import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -16,8 +15,8 @@ import javax.inject.Inject */ @MenuName("New") @TemplatePath("/templates/new.html") -class NewPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("new.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.New.Title") { +class NewPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("new.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.New.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) = getCurrentSone(soneRequest.toadletContext).let { currentSone -> diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt index 4bf6b12..4478e55 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt @@ -9,7 +9,6 @@ import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -18,8 +17,8 @@ import javax.inject.Inject */ @MenuName("Options") @TemplatePath("/templates/options.html") -class OptionsPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("options.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Options.Title") { +class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("options.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Options.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt index 261074e..02ccdce 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt @@ -6,7 +6,6 @@ import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -15,8 +14,8 @@ import javax.inject.Inject */ @MenuName("Rescue") @TemplatePath("/templates/rescue.html") -class RescuePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("rescue.html", template, "Page.Rescue.Title", webInterface, loaders, templateRenderer) { +class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("rescue.html", "Page.Rescue.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { val soneRescuer = soneRequest.core.getSoneRescuer(currentSone) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt index 550e3f1..69a19f3 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt @@ -18,7 +18,6 @@ import net.pterodactylus.sone.web.page.* import net.pterodactylus.sone.web.pages.SearchPage.Optionality.FORBIDDEN import net.pterodactylus.sone.web.pages.SearchPage.Optionality.OPTIONAL import net.pterodactylus.sone.web.pages.SearchPage.Optionality.REQUIRED -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import net.pterodactylus.util.text.StringEscaper import net.pterodactylus.util.text.TextException @@ -30,11 +29,11 @@ import javax.inject.Inject * words. */ @TemplatePath("/templates/search.html") -class SearchPage(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, ticker: Ticker = Ticker.systemTicker()) : - SoneTemplatePage("search.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Search.Title") { +class SearchPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, ticker: Ticker = Ticker.systemTicker()) : + SoneTemplatePage("search.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Search.Title") { - @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - this(template, webInterface, loaders, templateRenderer, Ticker.systemTicker()) + @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + this(webInterface, loaders, templateRenderer, Ticker.systemTicker()) private val cache: Cache, Pagination> = CacheBuilder.newBuilder().ticker(ticker).expireAfterAccess(5, MINUTES).build() 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 3c3e98a..3df343a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePage.kt @@ -8,7 +8,6 @@ import net.pterodactylus.sone.web.SessionProvider import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.notify.Notification -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import net.pterodactylus.util.web.* import java.net.URLEncoder @@ -20,12 +19,11 @@ open class SoneTemplatePage @JvmOverloads constructor( path: String, private val webInterface: WebInterface, loaders: Loaders, - template: Template, templateRenderer: TemplateRenderer, private val pageTitleKey: String? = null, private val requiresLogin: Boolean = false, private val pageTitle: (FreenetRequest) -> String = { pageTitleKey?.let(webInterface.l10n::getString) ?: "" } -) : FreenetTemplatePage(path, templateRenderer, loaders, template, "noPermission.html") { +) : FreenetTemplatePage(path, templateRenderer, loaders, "noPermission.html") { private val core = webInterface.core private val sessionProvider: SessionProvider = webInterface diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt index 5d6abf3..e3ec95d 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt @@ -6,7 +6,6 @@ import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -14,8 +13,8 @@ import javax.inject.Inject * Page that lets the user trust another Sone. This will assign a configurable * amount of trust to an identity. */ -class TrustPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - LoggedInPage("trust.html", template, "Page.Trust.Title", webInterface, loaders, templateRenderer) { +class TrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("trust.html", "Page.Trust.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt index aed315f..29409b7 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt @@ -11,8 +11,8 @@ import javax.inject.* /** * Page that lets the user unbookmark a post. */ -class UnbookmarkPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("unbookmark.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.Unbookmark.Title") { +class UnbookmarkPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("unbookmark.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Unbookmark.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { when { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePage.kt index 20cb2b2..36f9783 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePage.kt @@ -6,15 +6,14 @@ import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * This page lets the user unfollow another Sone. */ -class UnfollowSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - LoggedInPage("unfollowSone.html", template, "Page.UnfollowSone.Title", webInterface, loaders, templateRenderer) { +class UnfollowSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("unfollowSone.html", "Page.UnfollowSone.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt index 7737638..d9524dd 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt @@ -6,15 +6,14 @@ import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * Page that lets the user unlike a [net.pterodactylus.sone.data.Post] or [net.pterodactylus.sone.data.Reply]. */ -class UnlikePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("unlike.html", template, "Page.Unlike.Title", webInterface, loaders, templateRenderer) { +class UnlikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("unlike.html", "Page.Unlike.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt index 0c44b3b..22d82f6 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt @@ -5,15 +5,14 @@ import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject /** * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion. */ -class UnlockSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("unlockSone.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.UnlockSone.Title") { +class UnlockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("unlockSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.UnlockSone.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UntrustPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UntrustPage.kt index ffc066d..35b51cd 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UntrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UntrustPage.kt @@ -6,7 +6,6 @@ import net.pterodactylus.sone.utils.isPOST import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import javax.inject.Inject @@ -14,8 +13,8 @@ import javax.inject.Inject * Page that lets the user untrust another Sone. This will remove all trust * assignments for an identity. */ -class UntrustPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : - LoggedInPage("untrust.html", template, "Page.Untrust.Title", webInterface, loaders, templateRenderer) { +class UntrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : + LoggedInPage("untrust.html", "Page.Untrust.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt index 32eec71..86f2875 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt @@ -11,7 +11,6 @@ import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.utils.use import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import java.awt.image.BufferedImage import java.io.ByteArrayInputStream @@ -23,8 +22,8 @@ import javax.inject.Inject * Page implementation that lets the user upload an image. */ @TemplatePath("/templates/invalid.html") -class UploadImagePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - LoggedInPage("uploadImage.html", template, "Page.UploadImage.Title", webInterface, loaders, templateRenderer) { +class UploadImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + LoggedInPage("uploadImage.html", "Page.UploadImage.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { if (soneRequest.isPOST) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt index 941f040..b35d146 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt @@ -13,8 +13,8 @@ import javax.inject.* * This page lets the user view a post and all its replies. */ @TemplatePath("/templates/viewPost.html") -class ViewPostPage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("viewPost.html", webInterface, loaders, template, templateRenderer, pageTitleKey = "Page.ViewPost.Title") { +class ViewPostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("viewPost.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.ViewPost.Title") { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { templateContext["post"] = soneRequest.parameters["post"]?.let(soneRequest.core::getPost) 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 b1d36c5..e2de3e4 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt @@ -9,7 +9,6 @@ import net.pterodactylus.sone.utils.paginate import net.pterodactylus.sone.utils.parameters import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template import net.pterodactylus.util.template.TemplateContext import java.net.URI import javax.inject.Inject @@ -18,8 +17,8 @@ import javax.inject.Inject * Lets the user browser another Sone. */ @TemplatePath("/templates/viewSone.html") -class ViewSonePage @Inject constructor(template: Template, webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): - SoneTemplatePage("viewSone.html", webInterface, loaders, template, templateRenderer) { +class ViewSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer): + SoneTemplatePage("viewSone.html", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, templateContext: TemplateContext) { templateContext["soneId"] = soneRequest.parameters["sone"] diff --git a/src/test/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePageTest.kt index b48ba1f..2880d24 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePageTest.kt @@ -16,7 +16,7 @@ class FreenetTemplatePageTest { private val templateRenderer = deepMock() private val loaders = mock() private val template = mock