Sone sone = database.newSoneBuilder().local().from(ownIdentity).build();
String property = fromNullable(ownIdentity.getProperty("Sone.LatestEdition")).or("0");
sone.setLatestEdition(fromNullable(tryParse(property)).or(0L));
- sone.setClient(new Client("Sone", SonePlugin.VERSION.toString()));
+ sone.setClient(new Client("Sone", SonePlugin.getPluginVersion()));
sone.setKnown(true);
SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, ownIdentity.getId());
eventBus.register(soneInserter);
templateContext.set("core", core);
templateContext.set("currentSone", soneProperties);
templateContext.set("currentEdition", core.getUpdateChecker().getLatestEdition());
- templateContext.set("version", SonePlugin.VERSION);
+ templateContext.set("version", SonePlugin.getPluginVersion());
StringWriter writer = new StringWriter();
try {
template.render(templateContext, writer);
*/
@Override
public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) {
- return new Response("Version", new SimpleFieldSetBuilder().put("Version", SonePlugin.VERSION.toString()).put("ProtocolVersion", 1).get());
+ return new Response("Version", new SimpleFieldSetBuilder().put("Version", SonePlugin.getPluginVersion()).put("ProtocolVersion", 1).get());
}
}
}
/** The version. */
- public static final Version VERSION = new Version(0, 9, 5);
+ private static final Version VERSION = new Version(0, 9, 5);
/** The current year at time of release. */
private static final int YEAR = 2016;
return l10n;
}
+ public static String getPluginVersion() {
+ return VERSION.toString();
+ }
+
public static int getYear() {
return YEAR;
}
*/
public class AboutPage extends SoneTemplatePage {
- private final Version version;
+ private final String version;
private final int year;
private final String homepage;
- public AboutPage(Template template, WebInterface webInterface, Version version, int year, String homepage) {
+ public AboutPage(Template template, WebInterface webInterface, String version, int year, String homepage) {
super("about.html", template, "Page.About.Title", webInterface, false);
this.version = version;
this.year = year;
templateContext.set("currentSone", currentSone);
templateContext.set("localSones", webInterface.getCore().getLocalSones());
templateContext.set("request", request);
- templateContext.set("currentVersion", SonePlugin.VERSION);
+ templateContext.set("currentVersion", SonePlugin.getPluginVersion());
templateContext.set("hasLatestVersion", webInterface.getCore().getUpdateChecker().hasLatestVersion());
templateContext.set("latestEdition", webInterface.getCore().getUpdateChecker().getLatestEdition());
templateContext.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion());
pageToadlets.add(pageToadletFactory.createPageToadlet(new LogoutPage(emptyTemplate, this), "Logout"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new OptionsPage(optionsTemplate, this), "Options"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new RescuePage(rescueTemplate, this), "Rescue"));
- pageToadlets.add(pageToadletFactory.createPageToadlet(new AboutPage(aboutTemplate, this, SonePlugin.VERSION, SonePlugin.getYear(), SonePlugin.getHomepage()), "About"));
+ pageToadlets.add(pageToadletFactory.createPageToadlet(new AboutPage(aboutTemplate, this, SonePlugin.getPluginVersion(), SonePlugin.getYear(), SonePlugin.getHomepage()), "About"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("noPermission.html", noPermissionTemplate, "Page.NoPermission.Title", this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("emptyImageTitle.html", emptyImageTitleTemplate, "Page.EmptyImageTitle.Title", this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new SoneTemplatePage("emptyAlbumTitle.html", emptyAlbumTitleTemplate, "Page.EmptyAlbumTitle.Title", this)));
templateContext.set("currentSone", webInterface.getCurrentSone(request.getToadletContext(), false));
templateContext.set("localSones", webInterface.getCore().getLocalSones());
templateContext.set("request", request);
- templateContext.set("currentVersion", SonePlugin.VERSION);
+ templateContext.set("currentVersion", SonePlugin.getPluginVersion());
templateContext.set("hasLatestVersion", webInterface.getCore().getUpdateChecker().hasLatestVersion());
templateContext.set("latestEdition", webInterface.getCore().getUpdateChecker().getLatestEdition());
templateContext.set("latestVersion", webInterface.getCore().getUpdateChecker().getLatestVersion());
assertThat(manifestElement.getName(), is("test.txt"));
assertThat(manifestElement.getMimeTypeOverride(), is("plain/text; charset=utf-8"));
String templateContent = new String(toByteArray(manifestElement.getData().getInputStream()), Charsets.UTF_8);
- assertThat(templateContent, containsString("Sone Version: " + SonePlugin.VERSION.toString() + "\n"));
+ assertThat(templateContent, containsString("Sone Version: " + SonePlugin.getPluginVersion() + "\n"));
assertThat(templateContent, containsString("Core Startup: " + now + "\n"));
assertThat(templateContent, containsString("Sone ID: " + "SoneId" + "\n"));
}