X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=lib%2FNDWeb.pm;h=55ffdac60d6d986d856ac494a57b10f63dd071eb;hb=HEAD;hp=952f87272c3bc666a297d3947f90647def3b8a1e;hpb=1589baf3e90bbc7f1305e9691185188e15f326b9;p=ndwebbie.git diff --git a/lib/NDWeb.pm b/lib/NDWeb.pm index 952f872..4bd3ac7 100644 --- a/lib/NDWeb.pm +++ b/lib/NDWeb.pm @@ -1,7 +1,6 @@ package NDWeb; - -use strict; -use warnings; +use Moose; +use namespace::autoclean; use Catalyst::Runtime 5.80; @@ -14,11 +13,11 @@ use Catalyst::Runtime 5.80; # directory use parent qw/Catalyst/; + use Catalyst qw/ -Debug ConfigLoader Static::Simple - Unicode Authentication Authentication::Store::NDWeb @@ -32,37 +31,44 @@ use Catalyst qw/ Session::Store::File Session::State::Cookie - Compress::Gzip - Compress::Deflate - Cache PageCache /; +extends 'Catalyst'; + our $VERSION = '0.01'; +$VERSION = eval $VERSION; sub signal_bots { system 'killall','-USR1', 'ndbot.pl'; } +#$SIG{__WARN__} = sub { NDWeb->log->warn(@_); }; + # Configure the application. # -# Note that settings in ndweb.yml (or other external +# Note that settings in ndweb.conf (or other external # configuration file that you set up manually) take precedence # over this when using ConfigLoader. Thus configuration # details given here can function as a default configuration, # with an external configuration file acting as an override for # local deployment. -__PACKAGE__->config( name => 'NDWeb' ); +__PACKAGE__->config( + name => 'NDWeb', + # Disable deprecated behavior needed by old applications + disable_component_resolution_regex_fallback => 1, +); __PACKAGE__->config->{'Plugin::Authentication'}{'use_session'} = 1; __PACKAGE__->config(session => { storage => "/tmp/ndweb-$>/session", directory_umask => 077, - expires => 300, + expires => 3600, verify_address => 1, + cookie_secure => 2, }); -__PACKAGE__->config( cache => { +__PACKAGE__->config( "Plugin::Cache" => { backend => { class => "Cache::FileCache", cache_root => "/tmp/ndweb-$>", @@ -78,22 +84,28 @@ __PACKAGE__->config( page_cache => { }); __PACKAGE__->config( default_model => 'Model'); +__PACKAGE__->config( encoding => 'UTF-8'); # Start the application __PACKAGE__->setup(); __PACKAGE__->deny_access_unless('/users',[qw/admin_users/]); +__PACKAGE__->allow_access_if('/users/sms',[qw/users_sms/]); +__PACKAGE__->allow_access_if('/users/postsms',[qw/users_sms/]); __PACKAGE__->deny_access_unless('/alliances',[qw/alliances/]); __PACKAGE__->deny_access_unless('/alliances/resources',[qw/alliances_resources/]); __PACKAGE__->deny_access_unless('/graphs/alliancevsintel',[qw/graphs_intel/]); __PACKAGE__->deny_access_unless('/graphs/avgalliancevsintel',[qw/graphs_intel/]); __PACKAGE__->deny_access_unless('/members',[qw/members/]); +__PACKAGE__->allow_access_if('/members/postowncoords',[qw/attack_menu/]); +__PACKAGE__->allow_access_if('/members/launchConfirmation',[qw/attack_menu/]); +__PACKAGE__->allow_access_if('/members/postconfirmation',[qw/attack_menu/]); +__PACKAGE__->allow_access_if('/members/findDuplicateFleet',[qw/attack_menu/]); +__PACKAGE__->allow_access_if('/members/addAttackFleet',[qw/attack_menu/]); +__PACKAGE__->allow_access_if('/members/addDefendFleet',[qw/attack_menu/]); +__PACKAGE__->allow_access_if('/members/addReturnFleet',[qw/attack_menu/]); +__PACKAGE__->allow_access_if('/members/matchShips',[qw/attack_menu/]); __PACKAGE__->deny_access_unless('/members/defenders',[qw/members_defenders/]); __PACKAGE__->deny_access_unless('/covop',[qw/covop/]); -__PACKAGE__->deny_access_unless('/calls',[qw/calls_edit/]); -__PACKAGE__->allow_access_if('/calls/index',[qw/calls_list/]); -__PACKAGE__->allow_access_if('/calls/list',[qw/calls_list/]); -__PACKAGE__->allow_access_if('/calls/edit',[qw/members/]); -__PACKAGE__->allow_access_if('/calls/findCall',[qw/members/]); __PACKAGE__->deny_access_unless('/raids',[qw/raids_edit/]); __PACKAGE__->allow_access_if('/raids/index',[qw//]); __PACKAGE__->allow_access_if('/raids/view',[qw//]); @@ -107,6 +119,7 @@ __PACKAGE__->deny_access_unless('/intel/members',[qw/intel_members/]); __PACKAGE__->deny_access_unless('/intel/member',[qw/intel_member/]); __PACKAGE__->deny_access_unless('/intel/naps',[qw/intel_naps/]); __PACKAGE__->deny_access_unless('/jsrpc',[qw//]); +__PACKAGE__->allow_access_if('/jsrpc/addscans',1); __PACKAGE__->allow_access_if('/jsrpc/end',1); __PACKAGE__->deny_access_unless('/forum/allUnread',[qw//]); __PACKAGE__->deny_access_unless('/forum/privmsg',[qw//]);