X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=2177aab663195c393ddd772c0efca1e40f654f9f;hb=7e287db201b86febf1cfb825e5e3677ef59e6068;hp=9305215ffafc756d636e85273727b7e23e031451;hpb=d564858954b0df2464b2ea536a770c408d5aad75;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 9305215..2177aab 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -35,6 +35,7 @@ import net.pterodactylus.sone.freenet.L10nFilter; import net.pterodactylus.sone.main.SonePlugin; import net.pterodactylus.sone.template.PostAccessor; import net.pterodactylus.sone.template.SoneAccessor; +import net.pterodactylus.sone.template.SubstringFilter; import net.pterodactylus.sone.web.page.PageToadlet; import net.pterodactylus.sone.web.page.PageToadletFactory; import net.pterodactylus.sone.web.page.StaticPage; @@ -147,10 +148,11 @@ public class WebInterface extends AbstractService { private void registerToadlets() { DefaultTemplateFactory templateFactory = new DefaultTemplateFactory(); templateFactory.addAccessor(Object.class, new ReflectionAccessor()); - templateFactory.addAccessor(Sone.class, new SoneAccessor()); + templateFactory.addAccessor(Sone.class, new SoneAccessor(core())); templateFactory.addAccessor(Post.class, new PostAccessor(core())); templateFactory.addFilter("date", new DateFilter()); templateFactory.addFilter("l10n", new L10nFilter(l10n())); + templateFactory.addFilter("substring", new SubstringFilter()); templateFactory.setTemplateProvider(new ClassPathTemplateProvider(templateFactory)); String formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword(); @@ -200,6 +202,9 @@ public class WebInterface extends AbstractService { Template followSoneTemplate = templateFactory.createTemplate(createReader("/templates/followSone.html")); followSoneTemplate.set("formPassword", formPassword); + Template unfollowSoneTemplate = templateFactory.createTemplate(createReader("/templates/unfollowSone.html")); + unfollowSoneTemplate.set("formPassword", formPassword); + Template deleteSoneTemplate = templateFactory.createTemplate(createReader("/templates/deleteSone.html")); deleteSoneTemplate.set("formPassword", formPassword); @@ -222,6 +227,7 @@ public class WebInterface extends AbstractService { pageToadlets.add(pageToadletFactory.createPageToadlet(new ViewPostPage(viewPostTemplate, this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new DeletePostPage(deletePostTemplate, this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new FollowSonePage(followSoneTemplate, this))); + pageToadlets.add(pageToadletFactory.createPageToadlet(new UnfollowSonePage(unfollowSoneTemplate, this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new DeleteSonePage(deleteSoneTemplate, this), "DeleteSone")); pageToadlets.add(pageToadletFactory.createPageToadlet(new LoginPage(loginTemplate, this), "Login")); pageToadlets.add(pageToadletFactory.createPageToadlet(new LogoutPage(logoutTemplate, this), "Logout"));