From c389ee8f5e6eacae70438c3f364e8674c09d1959 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 18 May 2019 00:56:48 +0200 Subject: [PATCH] =?utf8?q?=E2=9C=A8=20Add=20@ToadletPath=20annotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../net/pterodactylus/sone/web/page/Annotations.kt | 4 ++++ .../pterodactylus/sone/web/page/FreenetTemplatePage.kt | 4 ++-- .../net/pterodactylus/sone/web/pages/AboutPage.kt | 1 + .../net/pterodactylus/sone/web/pages/BookmarkPage.kt | 1 + .../net/pterodactylus/sone/web/pages/BookmarksPage.kt | 1 + .../pterodactylus/sone/web/pages/CreateAlbumPage.kt | 1 + .../net/pterodactylus/sone/web/pages/CreatePostPage.kt | 1 + .../pterodactylus/sone/web/pages/CreateReplyPage.kt | 1 + .../net/pterodactylus/sone/web/pages/CreateSonePage.kt | 1 + .../pterodactylus/sone/web/pages/DeleteAlbumPage.kt | 1 + .../pterodactylus/sone/web/pages/DeleteImagePage.kt | 1 + .../net/pterodactylus/sone/web/pages/DeletePostPage.kt | 1 + .../sone/web/pages/DeleteProfileFieldPage.kt | 1 + .../pterodactylus/sone/web/pages/DeleteReplyPage.kt | 1 + .../net/pterodactylus/sone/web/pages/DeleteSonePage.kt | 1 + .../sone/web/pages/DismissNotificationPage.kt | 1 + .../net/pterodactylus/sone/web/pages/DistrustPage.kt | 1 + .../net/pterodactylus/sone/web/pages/EditAlbumPage.kt | 1 + .../net/pterodactylus/sone/web/pages/EditImagePage.kt | 1 + .../sone/web/pages/EditProfileFieldPage.kt | 1 + .../pterodactylus/sone/web/pages/EditProfilePage.kt | 1 + .../net/pterodactylus/sone/web/pages/ErrorPages.kt | 4 ++++ .../net/pterodactylus/sone/web/pages/FollowSonePage.kt | 1 + .../pterodactylus/sone/web/pages/ImageBrowserPage.kt | 1 + .../net/pterodactylus/sone/web/pages/IndexPage.kt | 1 + .../net/pterodactylus/sone/web/pages/KnownSonesPage.kt | 1 + .../net/pterodactylus/sone/web/pages/LikePage.kt | 1 + .../net/pterodactylus/sone/web/pages/LockSonePage.kt | 1 + .../net/pterodactylus/sone/web/pages/LoginPage.kt | 1 + .../net/pterodactylus/sone/web/pages/LogoutPage.kt | 1 + .../pterodactylus/sone/web/pages/MarkAsKnownPage.kt | 1 + .../kotlin/net/pterodactylus/sone/web/pages/NewPage.kt | 1 + .../net/pterodactylus/sone/web/pages/OptionsPage.kt | 1 + .../net/pterodactylus/sone/web/pages/RescuePage.kt | 1 + .../net/pterodactylus/sone/web/pages/SearchPage.kt | 1 + .../net/pterodactylus/sone/web/pages/TrustPage.kt | 1 + .../net/pterodactylus/sone/web/pages/UnbookmarkPage.kt | 1 + .../pterodactylus/sone/web/pages/UnfollowSonePage.kt | 1 + .../net/pterodactylus/sone/web/pages/UnlikePage.kt | 1 + .../net/pterodactylus/sone/web/pages/UnlockSonePage.kt | 1 + .../net/pterodactylus/sone/web/pages/UntrustPage.kt | 1 + .../pterodactylus/sone/web/pages/UploadImagePage.kt | 1 + .../net/pterodactylus/sone/web/pages/ViewPostPage.kt | 1 + .../net/pterodactylus/sone/web/pages/ViewSonePage.kt | 1 + .../sone/web/page/FreenetTemplatePageTest.kt | 18 ++++++------------ 45 files changed, 57 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/page/Annotations.kt b/src/main/kotlin/net/pterodactylus/sone/web/page/Annotations.kt index 0bda133..8287130 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/page/Annotations.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/page/Annotations.kt @@ -9,3 +9,7 @@ val Page<*>.menuName get() = javaClass.getAnnotation(MenuName::class.java)?.valu annotation class TemplatePath(val value: String) val Page<*>.templatePath get() = javaClass.getAnnotation(TemplatePath::class.java)?.value + +annotation class ToadletPath(val value: String) + +val Page<*>.toadletPath get() = javaClass.getAnnotation(ToadletPath::class.java)?.value 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 900ece9..780f2b1 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/page/FreenetTemplatePage.kt @@ -31,7 +31,7 @@ import java.util.logging.Logger.* * fit into Freenet’s web interface. */ open class FreenetTemplatePage( - private val path: String, + path: String, private val templateRenderer: TemplateRenderer, loaders: Loaders, private val invalidFormPasswordRedirectTarget: String @@ -41,7 +41,7 @@ open class FreenetTemplatePage( open val shortcutIcon: String? get() = null open val isFullAccessOnly get() = false - override fun getPath() = path + override fun getPath() = toadletPath open fun getPageTitle(request: FreenetRequest) = "" 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 467df56..121f736 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/AboutPage.kt @@ -11,6 +11,7 @@ import javax.inject.* */ @MenuName("About") @TemplatePath("/templates/about.html") +@ToadletPath("about.html") class AboutPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, private val pluginVersion: PluginVersion, private val pluginYear: PluginYear, 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 70db67d..7985947 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarkPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarkPage.kt @@ -10,6 +10,7 @@ import javax.inject.* /** * Page that lets the user bookmark a post. */ +@ToadletPath("bookmark.html") class BookmarkPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("bookmark.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Bookmark.Title") { 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 2afe4e8..0ed3662 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarksPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/BookmarksPage.kt @@ -13,6 +13,7 @@ import javax.inject.* */ @MenuName("Bookmarks") @TemplatePath("/templates/bookmarks.html") +@ToadletPath("bookmarks.html") class BookmarksPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("bookmarks.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Bookmarks.Title") { 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 0931f90..706f10b 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateAlbumPage.kt @@ -14,6 +14,7 @@ import javax.inject.* * Page that lets the user create a new album. */ @TemplatePath("/templates/createAlbum.html") +@ToadletPath("createAlbum.html") class CreateAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("createAlbum.html", "Page.CreateAlbum.Title", webInterface, loaders, templateRenderer) { 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 73e9253..f03b198 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreatePostPage.kt @@ -13,6 +13,7 @@ import javax.inject.* * This page lets the user create a new [Post]. */ @TemplatePath("/templates/createPost.html") +@ToadletPath("createPost.html") class CreatePostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("createPost.html", "Page.CreatePost.Title", webInterface, loaders, templateRenderer) { 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 55df29d..c368ed8 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateReplyPage.kt @@ -13,6 +13,7 @@ import javax.inject.* * This page lets the user post a reply to a post. */ @TemplatePath("/templates/createReply.html") +@ToadletPath("createReply.html") class CreateReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("createReply.html", "Page.CreateReply.Title", webInterface, loaders, templateRenderer) { 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 ef0c304..9f11e40 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/CreateSonePage.kt @@ -14,6 +14,7 @@ import javax.inject.* */ @MenuName("CreateSone") @TemplatePath("/templates/createSone.html") +@ToadletPath("createSone.html") class CreateSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("createSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.CreateSone.Title") { 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 c8c02c8..c4bcb72 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPage.kt @@ -12,6 +12,7 @@ import javax.inject.* * Page that lets the user delete an {@link Album}. */ @TemplatePath("/templates/deleteAlbum.html") +@ToadletPath("deleteAlbum.html") class DeleteAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteAlbum.html", "Page.DeleteAlbum.Title", webInterface, loaders, templateRenderer) { 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 b682115..58f5f51 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteImagePage.kt @@ -12,6 +12,7 @@ import javax.inject.* * Page that lets the user delete an {@link Image}. */ @TemplatePath("/templates/deleteImage.html") +@ToadletPath("deleteImage.html") class DeleteImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteImage.html", "Page.DeleteImage.Title", webInterface, loaders, templateRenderer) { 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 877a1fc..6114b76 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeletePostPage.kt @@ -12,6 +12,7 @@ import javax.inject.* * Lets the user delete a post they made. */ @TemplatePath("/templates/deletePost.html") +@ToadletPath("deletePost.html") class DeletePostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deletePost.html", "Page.DeletePost.Title", webInterface, loaders, templateRenderer) { 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 b7bab53..c705947 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteProfileFieldPage.kt @@ -12,6 +12,7 @@ import javax.inject.* * Page that lets the user confirm the deletion of a profile field. */ @TemplatePath("/templates/deleteProfileField.html") +@ToadletPath("deleteProfileField.html") class DeleteProfileFieldPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteProfileField.html", "Page.DeleteProfileField.Title", webInterface, loaders, templateRenderer) { 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 77f7bee..adf9b6d 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteReplyPage.kt @@ -12,6 +12,7 @@ import javax.inject.* * This page lets the user delete a reply. */ @TemplatePath("/templates/deleteReply.html") +@ToadletPath("deleteReply.html") class DeleteReplyPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteReply.html", "Page.DeleteReply.Title", webInterface, loaders, templateRenderer) { 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 6cb7b44..61b4750 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DeleteSonePage.kt @@ -15,6 +15,7 @@ import javax.inject.* */ @MenuName("DeleteSone") @TemplatePath("/templates/deleteSone.html") +@ToadletPath("deleteSone.html") class DeleteSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("deleteSone.html", "Page.DeleteSone.Title", webInterface, loaders, templateRenderer) { 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 7e6b599..47c2df6 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DismissNotificationPage.kt @@ -9,6 +9,7 @@ import javax.inject.* /** * Page that lets the user dismiss a notification. */ +@ToadletPath("dismissNotification.html") class DismissNotificationPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("dismissNotification.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.DismissNotification.Title") { 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 6a4fa8f..2821b39 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/DistrustPage.kt @@ -14,6 +14,7 @@ import javax.inject.* * * @see net.pterodactylus.sone.core.Core#distrustSone(Sone, Sone) */ +@ToadletPath("distrust.html") class DistrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("distrust.html", "Page.Distrust.Title", webInterface, loaders, templateRenderer) { 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 cf2be52..d75cb19 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditAlbumPage.kt @@ -12,6 +12,7 @@ import javax.inject.* /** * Page that lets the user edit the name and description of an album. */ +@ToadletPath("editAlbum.html") class EditAlbumPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("editAlbum.html", "Page.EditAlbum.Title", webInterface, loaders, templateRenderer) { 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 055d580..710bd55 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditImagePage.kt @@ -13,6 +13,7 @@ import javax.inject.* /** * Page that lets the user edit title and description of an {@link Image}. */ +@ToadletPath("editImage.html") class EditImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("editImage.html", "Page.EditImage.Title", webInterface, loaders, templateRenderer) { 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 7c82db2..7cdad30 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfileFieldPage.kt @@ -12,6 +12,7 @@ import javax.inject.* * Page that lets the user edit the name of a profile field. */ @TemplatePath("/templates/editProfileField.html") +@ToadletPath("editProfileField.html") class EditProfileFieldPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("editProfileField.html", "Page.EditProfileField.Title", webInterface, loaders, templateRenderer) { 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 b22b6de..f4baadc 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfilePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/EditProfilePage.kt @@ -15,6 +15,7 @@ import javax.inject.* */ @MenuName("EditProfile") @TemplatePath("/templates/editProfile.html") +@ToadletPath("editProfile.html") class EditProfilePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("editProfile.html", "Page.EditProfile.Title", webInterface, loaders, templateRenderer) { 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 bd6cb1f..85c7f69 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ErrorPages.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ErrorPages.kt @@ -5,13 +5,17 @@ import net.pterodactylus.sone.web.* import net.pterodactylus.sone.web.page.* @TemplatePath("/templates/invalid.html") +@ToadletPath("invalid.html") class InvalidPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("invalid.html", webInterface, loaders, templateRenderer, "Page.Invalid.Title") @TemplatePath("/templates/noPermission.html") +@ToadletPath("noPermission.html") class NoPermissionPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("noPermission.html", webInterface, loaders, templateRenderer, "Page.NoPermission.Title") @TemplatePath("/templates/emptyImageTitle.html") +@ToadletPath("emptyImageTitle.html") class EmptyImageTitlePage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("emptyImageTitle.html", webInterface, loaders, templateRenderer, "Page.EmptyImageTitle.Title") @TemplatePath("/templates/emptyAlbumTitle.html") +@ToadletPath("emptyAlbumTitle.html") 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 2375278..4cba65a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/FollowSonePage.kt @@ -11,6 +11,7 @@ import javax.inject.* /** * This page lets the user follow another Sone. */ +@ToadletPath("followSone.html") class FollowSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("followSone.html", "Page.FollowSone.Title", webInterface, loaders, templateRenderer) { 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 cd81d1f..802bdaf 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ImageBrowserPage.kt @@ -14,6 +14,7 @@ import javax.inject.* */ @MenuName("ImageBrowser") @TemplatePath("/templates/imageBrowser.html") +@ToadletPath("imageBrowser.html") class ImageBrowserPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("imageBrowser.html", "Page.ImageBrowser.Title", webInterface, loaders, templateRenderer) { 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 fb67bba..52004ab 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt @@ -15,6 +15,7 @@ import javax.inject.* */ @MenuName("Index") @TemplatePath("/templates/index.html") +@ToadletPath("index.html") class IndexPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, private val postVisibilityFilter: PostVisibilityFilter) : LoggedInPage("index.html", "Page.Index.Title", webInterface, loaders, templateRenderer) { 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 4c801e0..c0d691f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt @@ -13,6 +13,7 @@ import javax.inject.* */ @MenuName("KnownSones") @TemplatePath("/templates/knownSones.html") +@ToadletPath("knownSones.html") class KnownSonesPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("knownSones.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.KnownSones.Title") { 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 838a2eb..a1831b0 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LikePage.kt @@ -11,6 +11,7 @@ import javax.inject.* /** * Page that lets the user like [net.pterodactylus.sone.data.Post]s and [net.pterodactylus.sone.data.Reply]s. */ +@ToadletPath("like.html") class LikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("like.html", "Page.Like.Title", webInterface, loaders, templateRenderer) { 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 d846cec..72abb0e 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LockSonePage.kt @@ -10,6 +10,7 @@ import javax.inject.* /** * This page lets the user lock a [net.pterodactylus.sone.data.Sone] to prevent it from being inserted. */ +@ToadletPath("lockSone.html") class LockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("lockSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.LockSone.Title") { 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 6647cd4..5d6915d 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LoginPage.kt @@ -13,6 +13,7 @@ import javax.inject.* */ @MenuName("Login") @TemplatePath("/templates/login.html") +@ToadletPath("login.html") class LoginPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("login.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Login.Title") { 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 d9913ec..72def85 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/LogoutPage.kt @@ -11,6 +11,7 @@ import javax.inject.* * Logs a user out. */ @MenuName("Logout") +@ToadletPath("logout.html") class LogoutPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("logout.html", "Page.Logout.Title", webInterface, loaders, templateRenderer) { 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 4b53fb9..c06ded2 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPage.kt @@ -12,6 +12,7 @@ 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. */ +@ToadletPath("markAsKnown.html") class MarkAsKnownPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("markAsKnown.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.MarkAsKnown.Title") { 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 42fd921..2fd29e8 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/NewPage.kt @@ -13,6 +13,7 @@ import javax.inject.* */ @MenuName("New") @TemplatePath("/templates/new.html") +@ToadletPath("new.html") class NewPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("new.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.New.Title") { 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 782e5bb..b9bc57c 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/OptionsPage.kt @@ -14,6 +14,7 @@ import javax.inject.* */ @MenuName("Options") @TemplatePath("/templates/options.html") +@ToadletPath("options.html") class OptionsPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("options.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Options.Title") { 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 af69a12..933e2c5 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/RescuePage.kt @@ -13,6 +13,7 @@ import javax.inject.* */ @MenuName("Rescue") @TemplatePath("/templates/rescue.html") +@ToadletPath("rescue.html") class RescuePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("rescue.html", "Page.Rescue.Title", webInterface, loaders, templateRenderer) { 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 4e29246..3b987d8 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/SearchPage.kt @@ -19,6 +19,7 @@ import javax.inject.* * words. */ @TemplatePath("/templates/search.html") +@ToadletPath("search.html") class SearchPage(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, ticker: Ticker = Ticker.systemTicker()) : SoneTemplatePage("search.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Search.Title") { 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 1944f5c..9fc8c41 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/TrustPage.kt @@ -12,6 +12,7 @@ import javax.inject.* * Page that lets the user trust another Sone. This will assign a configurable * amount of trust to an identity. */ +@ToadletPath("trust.html") class TrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("trust.html", "Page.Trust.Title", webInterface, loaders, templateRenderer) { 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 01d5f59..7759fb7 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPage.kt @@ -11,6 +11,7 @@ import javax.inject.* /** * Page that lets the user unbookmark a post. */ +@ToadletPath("unbookmark.html") class UnbookmarkPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("unbookmark.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.Unbookmark.Title") { 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 eacaf2e..2e14016 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnfollowSonePage.kt @@ -11,6 +11,7 @@ import javax.inject.* /** * This page lets the user unfollow another Sone. */ +@ToadletPath("unfollowSone.html") class UnfollowSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("unfollowSone.html", "Page.UnfollowSone.Title", webInterface, loaders, templateRenderer) { 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 80c475e..4a46bce 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlikePage.kt @@ -11,6 +11,7 @@ import javax.inject.* /** * Page that lets the user unlike a [net.pterodactylus.sone.data.Post] or [net.pterodactylus.sone.data.Reply]. */ +@ToadletPath("unlike.html") class UnlikePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("unlike.html", "Page.Unlike.Title", webInterface, loaders, templateRenderer) { 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 6ff2e7f..247415e 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePage.kt @@ -10,6 +10,7 @@ import javax.inject.* /** * This page lets the user unlock a [net.pterodactylus.sone.data.Sone] to allow its insertion. */ +@ToadletPath("unlockSone.html") class UnlockSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("unlockSone.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.UnlockSone.Title") { 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 288942c..f90adcf 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UntrustPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UntrustPage.kt @@ -12,6 +12,7 @@ import javax.inject.* * Page that lets the user untrust another Sone. This will remove all trust * assignments for an identity. */ +@ToadletPath("untrust.html") class UntrustPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("untrust.html", "Page.Untrust.Title", webInterface, loaders, templateRenderer) { 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 47454e6..00a8cc9 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/UploadImagePage.kt @@ -17,6 +17,7 @@ import javax.inject.* * Page implementation that lets the user upload an image. */ @TemplatePath("/templates/invalid.html") +@ToadletPath("uploadImage.html") class UploadImagePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : LoggedInPage("uploadImage.html", "Page.UploadImage.Title", webInterface, loaders, templateRenderer) { 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 7d67ecd..2032a16 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewPostPage.kt @@ -13,6 +13,7 @@ import javax.inject.* * This page lets the user view a post and all its replies. */ @TemplatePath("/templates/viewPost.html") +@ToadletPath("viewPost.html") class ViewPostPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("viewPost.html", webInterface, loaders, templateRenderer, pageTitleKey = "Page.ViewPost.Title") { 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 189b3eb..b0fcda2 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/ViewSonePage.kt @@ -14,6 +14,7 @@ import javax.inject.* * Lets the user browser another Sone. */ @TemplatePath("/templates/viewSone.html") +@ToadletPath("viewSone.html") class ViewSonePage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer) : SoneTemplatePage("viewSone.html", webInterface, loaders, templateRenderer) { 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 2880d24..d50d3b8 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