summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-08-02 22:46:16 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-08-02 22:50:09 -0400
commitc762b65ce42c18f026a16ee702cec5dc168a39be (patch)
treeeb75e3c268a10145f4a480a73d708f82b5d6d423 /IkiWiki
parent5dbd053da36d9ab7afc41540ef075c3b7b78ddf4 (diff)
show unsafe options (RO) by default
Small data leak, but only to admins, and I think it's worth it to see the stuff that cannot be configured.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/bzr.pm2
-rw-r--r--IkiWiki/Plugin/git.pm2
-rw-r--r--IkiWiki/Plugin/mercurial.pm2
-rw-r--r--IkiWiki/Plugin/monotone.pm2
-rw-r--r--IkiWiki/Plugin/svn.pm2
-rw-r--r--IkiWiki/Plugin/tla.pm2
-rw-r--r--IkiWiki/Plugin/websetup.pm38
7 files changed, 38 insertions, 12 deletions
diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm
index 99025a973..0b5059292 100644
--- a/IkiWiki/Plugin/bzr.pm
+++ b/IkiWiki/Plugin/bzr.pm
@@ -36,7 +36,7 @@ sub getsetup () { #{{{
bzr_wrapper => {
type => "string",
#example => "", # FIXME add example
- description => "bzr post-commit executable to generate",
+ description => "bzr post-commit hook to generate",
safe => 0, # file
rebuild => 0,
},
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index d1c1165e0..b6ad43167 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -45,7 +45,7 @@ sub getsetup () { #{{{
git_wrapper => {
type => "string",
example => "/git/wiki.git/hooks/post-update",
- description => "git post-update executable to generate",
+ description => "git post-update hook to generate",
safe => 0, # file
rebuild => 0,
},
diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm
index d2c34fa6a..23bebaaad 100644
--- a/IkiWiki/Plugin/mercurial.pm
+++ b/IkiWiki/Plugin/mercurial.pm
@@ -36,7 +36,7 @@ sub getsetup () { #{{{
mercurial_wrapper => {
type => "string",
#example => # FIXME add example
- description => "mercurial post-commit executable to generate",
+ description => "mercurial post-commit hook to generate",
safe => 0, # file
rebuild => 0,
},
diff --git a/IkiWiki/Plugin/monotone.pm b/IkiWiki/Plugin/monotone.pm
index 4b9be316a..bdc6ee786 100644
--- a/IkiWiki/Plugin/monotone.pm
+++ b/IkiWiki/Plugin/monotone.pm
@@ -68,7 +68,7 @@ sub getsetup () { #{{{
mtn_wrapper => {
type => "string",
example => "/srv/mtn/wiki/_MTN/ikiwiki-netsync-hook",
- description => "monotone netsync hook executable to generate",
+ description => "monotone netsync hook to generate",
safe => 0, # file
rebuild => 0,
},
diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm
index 51683704c..c51b0f181 100644
--- a/IkiWiki/Plugin/svn.pm
+++ b/IkiWiki/Plugin/svn.pm
@@ -58,7 +58,7 @@ sub getsetup () { #{{{
svn_wrapper => {
type => "string",
example => "/svn/wikirepo/hooks/post-commit",
- description => "svn post-commit executable to generate",
+ description => "svn post-commit hook to generate",
safe => 0, # file
rebuild => 0,
},
diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm
index 6faaecccc..1c2763359 100644
--- a/IkiWiki/Plugin/tla.pm
+++ b/IkiWiki/Plugin/tla.pm
@@ -34,7 +34,7 @@ sub getsetup () { #{{{
tla_wrapper => {
type => "string",
#example => "", # TODO example
- description => "tla post-commit executable to generate",
+ description => "tla post-commit hook to generate",
safe => 0, # file
rebuild => 0,
},
diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm
index 6aab04e32..150c792a5 100644
--- a/IkiWiki/Plugin/websetup.pm
+++ b/IkiWiki/Plugin/websetup.pm
@@ -13,6 +13,7 @@ my @default_force_plugins=(qw{amazon_s3 external});
sub import { #{{{
hook(type => "getsetup", id => "websetup", call => \&getsetup);
+ hook(type => "checkconfig", id => "websetup", call => \&checkconfig);
hook(type => "sessioncgi", id => "websetup", call => \&sessioncgi);
hook(type => "formbuilder_setup", id => "websetup",
call => \&formbuilder_setup);
@@ -27,12 +28,29 @@ sub getsetup () { #{{{
safe => 0,
rebuild => 0,
},
+ websetup_show_unsafe => {
+ type => "boolean",
+ example => 1,
+ description => "show unsafe settings, read-only, in web interface?",
+ safe => 0,
+ rebuild => 0,
+ },
+} #}}}
+
+sub checkconfig () { #{{{
+ if (! exists $config{websetup_show_unsafe}) {
+ $config{websetup_show_unsafe}=1;
+ }
} #}}}
-sub formatexample ($) { #{{{
+sub formatexample ($$) { #{{{
my $example=shift;
+ my $value=shift;
- if (defined $example && ! ref $example && length $example) {
+ if (defined $value && length $value) {
+ return "";
+ }
+ elsif (defined $example && ! ref $example && length $example) {
return "<br/ ><small>Example: <tt>$example</tt></small>";
}
else {
@@ -50,8 +68,10 @@ sub showfields ($$$@) { #{{{
my $key=shift;
my %info=%{shift()};
- # skip complex, unsafe, or internal settings
- next if ref $config{$key} || ! $info{safe} || $info{type} eq "internal";
+ # skip complex or internal settings
+ next if ref $config{$key} || ref $info{example} || $info{type} eq "internal";
+ # maybe skip unsafe settings
+ next if ! $info{safe} && ! $config{websetup_show_unsafe};
# these are handled specially, so don't show
next if $key eq 'add_plugins' || $key eq 'disable_plugins';
@@ -83,7 +103,7 @@ sub showfields ($$$@) { #{{{
$form->field(
name => $name,
label => $description,
- comment => defined $value && length $value ? "" : formatexample($info{example}),
+ comment => formatexample($info{example}, $value),
type => "text",
value => $value,
size => 60,
@@ -94,7 +114,7 @@ sub showfields ($$$@) { #{{{
$form->field(
name => $name,
label => $description,
- comment => formatexample($info{example}),
+ comment => formatexample($info{example}, $value),
type => "text",
value => $value,
size => 60,
@@ -106,6 +126,7 @@ sub showfields ($$$@) { #{{{
$form->field(
name => $name,
label => $description,
+ comment => formatexample($info{example}, $value),
type => "text",
value => $value,
size => 5,
@@ -123,6 +144,11 @@ sub showfields ($$$@) { #{{{
fieldset => $section,
);
}
+
+ if (! $info{safe}) {
+ $form->field(name => $name, disabled => 1);
+ $form->text(gettext("Note: Disabled options cannot be configured here, but only by editing the setup file."));
+ }
}
return 1;