]> ruin.nu Git - ndwebbie.git/blob - lib/NDWeb.pm
Update to be compatible with newer Catalyst.
[ndwebbie.git] / lib / NDWeb.pm
1 package NDWeb;
2 use Moose;
3 use namespace::autoclean;
4
5 use Catalyst::Runtime 5.80;
6
7 # Set flags and add plugins for the application
8 #
9 #         -Debug: activates the debug mode for very useful log messages
10 #   ConfigLoader: will load the configuration from a Config::General file in the
11 #                 application's home directory
12 # Static::Simple: will serve static files from the application's root
13 #                 directory
14
15 use parent qw/Catalyst/;
16
17 use Catalyst qw/
18         -Debug
19         ConfigLoader
20         Static::Simple
21         Unicode::Encoding
22
23         Authentication
24         Authentication::Store::NDWeb
25         Authentication::Credential::Password
26
27         Authorization::Roles
28         Authorization::ACL
29
30         Session::DynamicExpiry
31         Session
32         Session::Store::File
33         Session::State::Cookie
34
35         Cache
36         PageCache
37 /;
38
39 extends 'Catalyst';
40
41 our $VERSION = '0.01';
42 $VERSION = eval $VERSION;
43
44 sub signal_bots {
45         system 'killall','-USR1', 'ndbot.pl';
46 }
47
48 #$SIG{__WARN__} = sub { NDWeb->log->warn(@_); };
49
50 # Configure the application.
51 #
52 # Note that settings in ndweb.conf (or other external
53 # configuration file that you set up manually) take precedence
54 # over this when using ConfigLoader. Thus configuration
55 # details given here can function as a default configuration,
56 # with an external configuration file acting as an override for
57 # local deployment.
58
59 __PACKAGE__->config(
60         name => 'NDWeb',
61         # Disable deprecated behavior needed by old applications
62         disable_component_resolution_regex_fallback => 1,
63 );
64 __PACKAGE__->config->{'Plugin::Authentication'}{'use_session'} = 1;
65 __PACKAGE__->config(session => {
66         storage => "/tmp/ndweb-$>/session",
67         directory_umask => 077,
68         expires => 300,
69         verify_address => 1,
70 });
71 __PACKAGE__->config( "Plugin::Cache" => {
72         backend => {
73                 class => "Cache::FileCache",
74                 cache_root => "/tmp/ndweb-$>",
75                 namespace => "cache",
76                 default_expires_in => 3600,
77                 directory_umask => 077,
78         },
79 });
80
81 __PACKAGE__->config( page_cache => {
82         set_http_headers => 1,
83         disable_index => 1,
84 });
85
86 __PACKAGE__->config( default_model => 'Model');
87 __PACKAGE__->config( encoding => 'UTF-8');
88 # Start the application
89 __PACKAGE__->setup();
90
91 __PACKAGE__->deny_access_unless('/users',[qw/admin_users/]);
92 __PACKAGE__->deny_access_unless('/alliances',[qw/alliances/]);
93 __PACKAGE__->deny_access_unless('/alliances/resources',[qw/alliances_resources/]);
94 __PACKAGE__->deny_access_unless('/graphs/alliancevsintel',[qw/graphs_intel/]);
95 __PACKAGE__->deny_access_unless('/graphs/avgalliancevsintel',[qw/graphs_intel/]);
96 __PACKAGE__->deny_access_unless('/members',[qw/members/]);
97 __PACKAGE__->deny_access_unless('/members/defenders',[qw/members_defenders/]);
98 __PACKAGE__->deny_access_unless('/covop',[qw/covop/]);
99 __PACKAGE__->deny_access_unless('/calls',[qw/calls_edit/]);
100 __PACKAGE__->allow_access_if('/calls/index',[qw/calls_list/]);
101 __PACKAGE__->allow_access_if('/calls/list',[qw/calls_list/]);
102 __PACKAGE__->allow_access_if('/calls/edit',[qw/members/]);
103 __PACKAGE__->allow_access_if('/calls/findCall',[qw/members/]);
104 __PACKAGE__->deny_access_unless('/raids',[qw/raids_edit/]);
105 __PACKAGE__->allow_access_if('/raids/index',[qw//]);
106 __PACKAGE__->allow_access_if('/raids/view',[qw//]);
107 __PACKAGE__->allow_access_if('/raids/targetcalc',[qw//]);
108 __PACKAGE__->allow_access_if('/raids/fleetcalc',[qw//]);
109 __PACKAGE__->allow_access_if('/raids/calcredir',[qw//]);
110 __PACKAGE__->allow_access_if('/raids/findRaid',[qw//]);
111 __PACKAGE__->allow_access_if('/raids/log',[qw//]);
112 __PACKAGE__->deny_access_unless('/intel',[qw/intel/]);
113 __PACKAGE__->deny_access_unless('/intel/members',[qw/intel_members/]);
114 __PACKAGE__->deny_access_unless('/intel/member',[qw/intel_member/]);
115 __PACKAGE__->deny_access_unless('/intel/naps',[qw/intel_naps/]);
116 __PACKAGE__->deny_access_unless('/jsrpc',[qw//]);
117 __PACKAGE__->allow_access_if('/jsrpc/end',1);
118 __PACKAGE__->deny_access_unless('/forum/allUnread',[qw//]);
119 __PACKAGE__->deny_access_unless('/forum/privmsg',[qw//]);
120 __PACKAGE__->deny_access_unless('/settings',[qw//]);
121 __PACKAGE__->deny_access_unless('/textexport/alliance',[qw/textexport_alliance/]);
122
123 =head1 NAME
124
125 NDWeb - Catalyst based application
126
127 =head1 SYNOPSIS
128
129     script/ndweb_server.pl
130
131 =head1 DESCRIPTION
132
133 [enter your description here]
134
135 =head1 SEE ALSO
136
137 L<NDWeb::Controller::Root>, L<Catalyst>
138
139 =head1 AUTHOR
140
141 Catalyst developer
142
143 =head1 LICENSE
144
145 This library is free software. You can redistribute it and/or modify
146 it under the same terms as Perl itself.
147
148 =cut
149
150 1;