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.master
parent
5dbd053da3
commit
c762b65ce4
Binary file not shown.
|
@ -92,7 +92,7 @@ sub getsetup () { #{{{
|
||||||
type => "string",
|
type => "string",
|
||||||
default => '',
|
default => '',
|
||||||
example => "/var/www/wiki/ikiwiki.cgi",
|
example => "/var/www/wiki/ikiwiki.cgi",
|
||||||
description => "cgi executable to generate",
|
description => "cgi wrapper to generate",
|
||||||
safe => 0, # file
|
safe => 0, # file
|
||||||
rebuild => 0,
|
rebuild => 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,7 +36,7 @@ sub getsetup () { #{{{
|
||||||
bzr_wrapper => {
|
bzr_wrapper => {
|
||||||
type => "string",
|
type => "string",
|
||||||
#example => "", # FIXME add example
|
#example => "", # FIXME add example
|
||||||
description => "bzr post-commit executable to generate",
|
description => "bzr post-commit hook to generate",
|
||||||
safe => 0, # file
|
safe => 0, # file
|
||||||
rebuild => 0,
|
rebuild => 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -45,7 +45,7 @@ sub getsetup () { #{{{
|
||||||
git_wrapper => {
|
git_wrapper => {
|
||||||
type => "string",
|
type => "string",
|
||||||
example => "/git/wiki.git/hooks/post-update",
|
example => "/git/wiki.git/hooks/post-update",
|
||||||
description => "git post-update executable to generate",
|
description => "git post-update hook to generate",
|
||||||
safe => 0, # file
|
safe => 0, # file
|
||||||
rebuild => 0,
|
rebuild => 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,7 +36,7 @@ sub getsetup () { #{{{
|
||||||
mercurial_wrapper => {
|
mercurial_wrapper => {
|
||||||
type => "string",
|
type => "string",
|
||||||
#example => # FIXME add example
|
#example => # FIXME add example
|
||||||
description => "mercurial post-commit executable to generate",
|
description => "mercurial post-commit hook to generate",
|
||||||
safe => 0, # file
|
safe => 0, # file
|
||||||
rebuild => 0,
|
rebuild => 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,7 +68,7 @@ sub getsetup () { #{{{
|
||||||
mtn_wrapper => {
|
mtn_wrapper => {
|
||||||
type => "string",
|
type => "string",
|
||||||
example => "/srv/mtn/wiki/_MTN/ikiwiki-netsync-hook",
|
example => "/srv/mtn/wiki/_MTN/ikiwiki-netsync-hook",
|
||||||
description => "monotone netsync hook executable to generate",
|
description => "monotone netsync hook to generate",
|
||||||
safe => 0, # file
|
safe => 0, # file
|
||||||
rebuild => 0,
|
rebuild => 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,7 +58,7 @@ sub getsetup () { #{{{
|
||||||
svn_wrapper => {
|
svn_wrapper => {
|
||||||
type => "string",
|
type => "string",
|
||||||
example => "/svn/wikirepo/hooks/post-commit",
|
example => "/svn/wikirepo/hooks/post-commit",
|
||||||
description => "svn post-commit executable to generate",
|
description => "svn post-commit hook to generate",
|
||||||
safe => 0, # file
|
safe => 0, # file
|
||||||
rebuild => 0,
|
rebuild => 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,7 +34,7 @@ sub getsetup () { #{{{
|
||||||
tla_wrapper => {
|
tla_wrapper => {
|
||||||
type => "string",
|
type => "string",
|
||||||
#example => "", # TODO example
|
#example => "", # TODO example
|
||||||
description => "tla post-commit executable to generate",
|
description => "tla post-commit hook to generate",
|
||||||
safe => 0, # file
|
safe => 0, # file
|
||||||
rebuild => 0,
|
rebuild => 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,6 +13,7 @@ my @default_force_plugins=(qw{amazon_s3 external});
|
||||||
|
|
||||||
sub import { #{{{
|
sub import { #{{{
|
||||||
hook(type => "getsetup", id => "websetup", call => \&getsetup);
|
hook(type => "getsetup", id => "websetup", call => \&getsetup);
|
||||||
|
hook(type => "checkconfig", id => "websetup", call => \&checkconfig);
|
||||||
hook(type => "sessioncgi", id => "websetup", call => \&sessioncgi);
|
hook(type => "sessioncgi", id => "websetup", call => \&sessioncgi);
|
||||||
hook(type => "formbuilder_setup", id => "websetup",
|
hook(type => "formbuilder_setup", id => "websetup",
|
||||||
call => \&formbuilder_setup);
|
call => \&formbuilder_setup);
|
||||||
|
@ -27,12 +28,29 @@ sub getsetup () { #{{{
|
||||||
safe => 0,
|
safe => 0,
|
||||||
rebuild => 0,
|
rebuild => 0,
|
||||||
},
|
},
|
||||||
|
websetup_show_unsafe => {
|
||||||
|
type => "boolean",
|
||||||
|
example => 1,
|
||||||
|
description => "show unsafe settings, read-only, in web interface?",
|
||||||
|
safe => 0,
|
||||||
|
rebuild => 0,
|
||||||
|
},
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub formatexample ($) { #{{{
|
sub checkconfig () { #{{{
|
||||||
my $example=shift;
|
if (! exists $config{websetup_show_unsafe}) {
|
||||||
|
$config{websetup_show_unsafe}=1;
|
||||||
|
}
|
||||||
|
} #}}}
|
||||||
|
|
||||||
if (defined $example && ! ref $example && length $example) {
|
sub formatexample ($$) { #{{{
|
||||||
|
my $example=shift;
|
||||||
|
my $value=shift;
|
||||||
|
|
||||||
|
if (defined $value && length $value) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
elsif (defined $example && ! ref $example && length $example) {
|
||||||
return "<br/ ><small>Example: <tt>$example</tt></small>";
|
return "<br/ ><small>Example: <tt>$example</tt></small>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -50,8 +68,10 @@ sub showfields ($$$@) { #{{{
|
||||||
my $key=shift;
|
my $key=shift;
|
||||||
my %info=%{shift()};
|
my %info=%{shift()};
|
||||||
|
|
||||||
# skip complex, unsafe, or internal settings
|
# skip complex or internal settings
|
||||||
next if ref $config{$key} || ! $info{safe} || $info{type} eq "internal";
|
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
|
# these are handled specially, so don't show
|
||||||
next if $key eq 'add_plugins' || $key eq 'disable_plugins';
|
next if $key eq 'add_plugins' || $key eq 'disable_plugins';
|
||||||
|
|
||||||
|
@ -83,7 +103,7 @@ sub showfields ($$$@) { #{{{
|
||||||
$form->field(
|
$form->field(
|
||||||
name => $name,
|
name => $name,
|
||||||
label => $description,
|
label => $description,
|
||||||
comment => defined $value && length $value ? "" : formatexample($info{example}),
|
comment => formatexample($info{example}, $value),
|
||||||
type => "text",
|
type => "text",
|
||||||
value => $value,
|
value => $value,
|
||||||
size => 60,
|
size => 60,
|
||||||
|
@ -94,7 +114,7 @@ sub showfields ($$$@) { #{{{
|
||||||
$form->field(
|
$form->field(
|
||||||
name => $name,
|
name => $name,
|
||||||
label => $description,
|
label => $description,
|
||||||
comment => formatexample($info{example}),
|
comment => formatexample($info{example}, $value),
|
||||||
type => "text",
|
type => "text",
|
||||||
value => $value,
|
value => $value,
|
||||||
size => 60,
|
size => 60,
|
||||||
|
@ -106,6 +126,7 @@ sub showfields ($$$@) { #{{{
|
||||||
$form->field(
|
$form->field(
|
||||||
name => $name,
|
name => $name,
|
||||||
label => $description,
|
label => $description,
|
||||||
|
comment => formatexample($info{example}, $value),
|
||||||
type => "text",
|
type => "text",
|
||||||
value => $value,
|
value => $value,
|
||||||
size => 5,
|
size => 5,
|
||||||
|
@ -123,6 +144,11 @@ sub showfields ($$$@) { #{{{
|
||||||
fieldset => $section,
|
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;
|
return 1;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/home/joey/src/ikiwiki/IkiWiki/Plugin/websetup.pm
|
Loading…
Reference in New Issue