From: David ‘Bombe’ Roden Date: Wed, 11 May 2011 04:12:43 +0000 (+0200) Subject: Merge branch 'fcp-interface' into next X-Git-Tag: 0.6.5^2~39 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=aa94dcb712392b69cb431d1637e4948688d15791;p=Sone.git Merge branch 'fcp-interface' into next This fixes #21. --- aa94dcb712392b69cb431d1637e4948688d15791 diff --cc src/main/java/net/pterodactylus/sone/core/Core.java index 473d60e,cfe53ea..765b672 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@@ -1776,11 -1779,27 +1793,28 @@@ public class Core implements IdentityLi } })); - options.addIntegerOption("PostsPerPage", new DefaultOption(25)); - options.addIntegerOption("PositiveTrust", new DefaultOption(75)); - options.addIntegerOption("NegativeTrust", new DefaultOption(-25)); + options.addIntegerOption("PostsPerPage", new DefaultOption(10, new IntegerRangeValidator(1, Integer.MAX_VALUE))); + options.addBooleanOption("RequireFullAccess", new DefaultOption(false)); + options.addIntegerOption("PositiveTrust", new DefaultOption(75, new IntegerRangeValidator(0, 100))); + options.addIntegerOption("NegativeTrust", new DefaultOption(-25, new IntegerRangeValidator(-100, 100))); options.addStringOption("TrustComment", new DefaultOption("Set from Sone Web Interface")); + options.addBooleanOption("ActivateFcpInterface", new DefaultOption(false, new OptionWatcher() { + + @Override + @SuppressWarnings("synthetic-access") + public void optionChanged(Option option, Boolean oldValue, Boolean newValue) { + fcpInterface.setActive(newValue); + } + })); + options.addIntegerOption("FcpFullAccessRequired", new DefaultOption(2, new OptionWatcher() { + + @Override + @SuppressWarnings("synthetic-access") + public void optionChanged(Option option, Integer oldValue, Integer newValue) { + fcpInterface.setFullAccessRequired(FullAccessRequired.values()[newValue]); + } + + })); options.addBooleanOption("SoneRescueMode", new DefaultOption(false)); options.addBooleanOption("ClearOnNextRestart", new DefaultOption(false)); options.addBooleanOption("ReallyClearOnNextRestart", new DefaultOption(false)); @@@ -1796,12 -1815,13 +1830,14 @@@ return; } - options.getIntegerOption("InsertionDelay").set(configuration.getIntValue("Option/InsertionDelay").getValue(null)); - options.getIntegerOption("PostsPerPage").set(configuration.getIntValue("Option/PostsPerPage").getValue(null)); - options.getIntegerOption("PositiveTrust").set(configuration.getIntValue("Option/PositiveTrust").getValue(null)); - options.getIntegerOption("NegativeTrust").set(configuration.getIntValue("Option/NegativeTrust").getValue(null)); + loadConfigurationValue("InsertionDelay"); + loadConfigurationValue("PostsPerPage"); + options.getBooleanOption("RequireFullAccess").set(configuration.getBooleanValue("Option/RequireFullAccess").getValue(null)); + loadConfigurationValue("PositiveTrust"); + loadConfigurationValue("NegativeTrust"); options.getStringOption("TrustComment").set(configuration.getStringValue("Option/TrustComment").getValue(null)); + options.getBooleanOption("ActivateFcpInterface").set(configuration.getBooleanValue("Option/ActivateFcpInterface").getValue(null)); + options.getIntegerOption("FcpFullAccessRequired").set(configuration.getIntValue("Option/FcpFullAccessRequired").getValue(null)); options.getBooleanOption("SoneRescueMode").set(configuration.getBooleanValue("Option/SoneRescueMode").getValue(null)); /* load known Sones. */ diff --cc src/main/java/net/pterodactylus/sone/web/OptionsPage.java index 51ca6cd,161de32..6785e81 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@@ -17,11 -17,9 +17,12 @@@ package net.pterodactylus.sone.web; +import java.util.ArrayList; +import java.util.List; + import net.pterodactylus.sone.core.Core.Preferences; import net.pterodactylus.sone.data.Sone; + import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired; import net.pterodactylus.sone.web.page.Page.Request.Method; import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.template.Template; diff --cc src/main/resources/i18n/sone.en.properties index 0a44f2c,ba38c06..5032867 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@@ -43,10 -41,14 +43,16 @@@ Page.Options.Section.TrustOptions.Title Page.Options.Option.PositiveTrust.Description=The amount of positive trust you want to assign to other Sones by clicking the checkmark below a post or reply. Page.Options.Option.NegativeTrust.Description=The amount of trust you want to assign to other Sones by clicking the red X below a post or reply. This value should be negative. Page.Options.Option.TrustComment.Description=The comment that will be set in the web of trust for any trust you assign from Sone. + Page.Options.Section.FcpOptions.Title=FCP Interface Settings + Page.Options.Option.FcpInterfaceActive.Description=Activate the FCP interface to allow other plugins and remote clients to access your Sone plugin. + Page.Options.Option.FcpFullAccessRequired.Description=Require FCP connection from allowed hosts (see your {link}node’s configuration, section “FCP”{/link}) + Page.Options.Option.FcpFullAccessRequired.Value.No=No + Page.Options.Option.FcpFullAccessRequired.Value.Writing=For Write Access + Page.Options.Option.FcpFullAccessRequired.Value.Always=Always Page.Options.Section.RescueOptions.Title=Rescue Settings -Page.Options.Option.SoneRescueMode.Description=Try to rescue your Sones at the next start of the Sone plugin. This will read your all your old Sones from Freenet and ignore any disappearing postings and replies. You have to unlock your local Sones after they have been restored and you have to manually disable the rescue mode once you are satisfied with what has been restored! +Page.Options.Option.SoneRescueMode.Description1=Try to rescue your Sones at the next start of the Sone plugin. The Rescue Mode will start at the latest known edition and will try to download all editions sequentially backwards, merging all discovered posts and replies together, until it is stopped or it has reached the first edition. +Page.Options.Option.SoneRescueMode.Description2=When using the Rescue Mode because Sone lost its configuration it usually suffices to let the Rescue Mode only run for a short time; use a second tab to control how many posts of your Sone are visible again. As soon as the last valid edition is loaded you can then deactivate the Rescue Mode. +Page.Options.Option.SoneRescueMode.Description3=Note that when you use the Rescue Mode posts that you have deleted after they have been inserted will have to be deleted again. Unfortunately this is an unavoidable side effect of the Rescue Mode. Page.Options.Section.Cleaning.Title=Clean Up Page.Options.Option.ClearOnNextRestart.Description=Resets the configuration of the Sone plugin at the next restart. Warning! {strong}This will destroy all of your Sones{/strong} so make sure you have backed up everyhing you still need! Also, you need to set the next option to true to actually do it. Page.Options.Option.ReallyClearOnNextRestart.Description=This option needs to be set to “yes” if you really, {strong}really{/strong} want to clear the plugin configuration on the next restart. diff --cc src/main/resources/templates/options.html index 930d088,dfeb3e9..368c14e --- a/src/main/resources/templates/options.html +++ b/src/main/resources/templates/options.html @@@ -76,11 -57,22 +76,24 @@@

<%= Page.Options.Option.TrustComment.Description|l10n|html>

+

<%= Page.Options.Section.FcpOptions.Title|l10n|html>

+ +

checked="checked"<%/if> /> <%= Page.Options.Option.FcpInterfaceActive.Description|l10n|html>

+ +

+ <%= Page.Options.Option.FcpFullAccessRequired.Description|l10n|html|replace needle="{link}" replacement=''|replace needle="{/link}" replacement=''> + +

+

<%= Page.Options.Section.RescueOptions.Title|l10n|html>

-

<%= Page.Options.Option.SoneRescueMode.Description|l10n|html>

+

<%= Page.Options.Option.SoneRescueMode.Description1|l10n|html>

+

<%= Page.Options.Option.SoneRescueMode.Description2|l10n|html>

+

<%= Page.Options.Option.SoneRescueMode.Description3|l10n|html>

<%= Page.Options.Section.Cleaning.Title|l10n|html>