X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=06ebf8d9a49381eb5df2e3b324f945125351ac25;hp=beba513305826fcd9ec053f84d3ba44fb5318619;hb=cc18e5878bc71081da5137eb777d91821c3f4cce;hpb=e80ee9c75042771d91bdd7095ca225adc6c11e6c diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index beba513..06ebf8d 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -73,6 +73,7 @@ import net.pterodactylus.sone.main.ReparseFilter; import net.pterodactylus.sone.main.SonePlugin; import net.pterodactylus.sone.notify.ListNotification; import net.pterodactylus.sone.template.AlbumAccessor; +import net.pterodactylus.sone.template.BuildIdFilter; import net.pterodactylus.sone.template.CollectionAccessor; import net.pterodactylus.sone.template.CssClassNameFilter; import net.pterodactylus.sone.template.HttpRequestAccessor; @@ -83,6 +84,7 @@ import net.pterodactylus.sone.template.JavascriptFilter; import net.pterodactylus.sone.template.ParserFilter; import net.pterodactylus.sone.template.PostAccessor; import net.pterodactylus.sone.template.ProfileAccessor; +import net.pterodactylus.sone.template.RenderFilter; import net.pterodactylus.sone.template.ReplyAccessor; import net.pterodactylus.sone.template.ReplyGroupFilter; import net.pterodactylus.sone.template.RequestChangeFilter; @@ -193,6 +195,7 @@ public class WebInterface { /** The parser filter. */ private final ParserFilter parserFilter; + private final RenderFilter renderFilter; /** The “new Sone” notification. */ private final ListNotification newSoneNotification; @@ -247,7 +250,7 @@ public class WebInterface { this.sonePlugin = sonePlugin; this.loaders = loaders; formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword(); - soneTextParser = new SoneTextParser(getCore(), getCore()); + soneTextParser = new SoneTextParser(getCore(), getCore(), getCore()); templateContextFactory = new TemplateContextFactory(); templateContextFactory.addAccessor(Object.class, new ReflectionAccessor()); @@ -272,8 +275,9 @@ public class WebInterface { templateContextFactory.addFilter("match", new MatchFilter()); templateContextFactory.addFilter("css", new CssClassNameFilter()); templateContextFactory.addFilter("js", new JavascriptFilter()); - templateContextFactory.addFilter("parse", parserFilter = new ParserFilter(getCore(), templateContextFactory, soneTextParser)); + templateContextFactory.addFilter("parse", parserFilter = new ParserFilter(getCore(), soneTextParser)); templateContextFactory.addFilter("reparse", new ReparseFilter()); + templateContextFactory.addFilter("render", renderFilter = new RenderFilter(getCore(), templateContextFactory)); templateContextFactory.addFilter("unknown", new UnknownDateFilter(getL10n(), "View.Sone.Text.UnknownDate")); templateContextFactory.addFilter("format", new FormatFilter()); templateContextFactory.addFilter("sort", new CollectionSortFilter()); @@ -283,6 +287,7 @@ public class WebInterface { templateContextFactory.addFilter("unique", new UniqueElementFilter()); templateContextFactory.addFilter("mod", new ModFilter()); templateContextFactory.addFilter("paginate", new PaginationFilter()); + templateContextFactory.addFilter("build-id", new BuildIdFilter()); templateContextFactory.addProvider(TemplateProvider.TEMPLATE_CONTEXT_PROVIDER); templateContextFactory.addProvider(loaders.getTemplateProvider()); templateContextFactory.addTemplateObject("webInterface", this); @@ -704,8 +709,8 @@ public class WebInterface { pageToadlets.add(pageToadletFactory.createPageToadlet(new UnlockSoneAjaxPage(this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new FollowSoneAjaxPage(this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new UnfollowSoneAjaxPage(this))); - pageToadlets.add(pageToadletFactory.createPageToadlet(new EditAlbumAjaxPage(this))); - pageToadlets.add(pageToadletFactory.createPageToadlet(new EditImageAjaxPage(this, parserFilter))); + pageToadlets.add(pageToadletFactory.createPageToadlet(new EditAlbumAjaxPage(this, parserFilter, renderFilter))); + pageToadlets.add(pageToadletFactory.createPageToadlet(new EditImageAjaxPage(this, parserFilter, renderFilter))); pageToadlets.add(pageToadletFactory.createPageToadlet(new TrustAjaxPage(this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new DistrustAjaxPage(this))); pageToadlets.add(pageToadletFactory.createPageToadlet(new UntrustAjaxPage(this)));