From 22493d8ac2f1b0e7c360da43bbc47c8d24bd9c3c Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Sat, 16 Jun 2018 22:39:40 +1000 Subject: [PATCH] * LDV::Zerobin : add access settings --- conf/ldv.conf.sample | 2 +- lib/LDV/Zerobin.pm | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conf/ldv.conf.sample b/conf/ldv.conf.sample index 7181d39..480b8cc 100644 --- a/conf/ldv.conf.sample +++ b/conf/ldv.conf.sample @@ -49,7 +49,7 @@ }, zerobin => { - root => 'data/zerobin', + access => 'all', syntax => ['bash', 'c', 'css', 'html', 'perl', 'php', 'python', 'other'], maxsize => 1 * 1024 * 1024, }, diff --git a/lib/LDV/Zerobin.pm b/lib/LDV/Zerobin.pm index b35db6f..3696af0 100644 --- a/lib/LDV/Zerobin.pm +++ b/lib/LDV/Zerobin.pm @@ -46,6 +46,9 @@ sub _content_load { sub create { my ($self) = @_; + $self->access_allowed($self->app->config->{zerobin}->{access}) + or return; + my @syntax = ($self->c(text => ['plaintext', 'markdown'])); my $langs = $self->app->config->{zerobin}->{syntax}; push @syntax, $self->c(code => $langs) @@ -79,6 +82,9 @@ sub view { sub save { my ($self) = @_; + $self->access_allowed($self->app->config->{zerobin}->{access}) + or return; + eval { my $source = $self->req->param('source') || '-'; my $expire = $self->req->param('expire') || 30; # 30 days or 1 month