| author | Vincent Tondellier <tonton+hg@team1664.org> |
| Mon, 17 Jul 2023 22:22:33 +0200 | |
| changeset 131 | bb5fad5d66b8 |
| parent 124 | 12da024402d2 |
| permissions | -rw-r--r-- |
|
122
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
1 |
# This program is free software: you can redistribute it and/or modify |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
2 |
# it under the terms of the GNU General Public License as published by |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
3 |
# the Free Software Foundation, either version 3 of the License, or |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
4 |
# (at your option) any later version. |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
5 |
# |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
6 |
# This program is distributed in the hope that it will be useful, |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
7 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
8 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
9 |
# GNU General Public License for more details. |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
10 |
# |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
11 |
# You should have received a copy of the GNU General Public License |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
12 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
13 |
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
14 |
package CrashTest; |
|
122
8692800ec9ba
Use Dzil PkgVersion
Vincent Tondellier <tonton+hg@team1664.org>
parents:
120
diff
changeset
|
15 |
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
16 |
use Mojo::Base 'Mojolicious'; |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
17 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
18 |
use CrashTest::Model::Storage; |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
19 |
use CrashTest::Model::StackFilter; |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
20 |
use CrashTest::Model::CrashReport; |
|
88
c82f5589db11
Add first cut of the crash grouping feature
Vincent Tondellier <tonton+hg@team1664.org>
parents:
79
diff
changeset
|
21 |
use CrashTest::Model::CrashGroup; |
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
22 |
use CrashTest::Model::CrashProcessor; |
|
120
1a0fa98037fa
Add Bug status table in the detailed report.
Vincent Tondellier <tonton+hg@team1664.org>
parents:
116
diff
changeset
|
23 |
use CrashTest::Model::BugLink; |
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
24 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
25 |
# This method will run once at server start |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
26 |
sub startup {
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
27 |
my $self = shift; |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
28 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
29 |
$self->secrets([ |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
30 |
'My secret passphrase here' |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
31 |
]); |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
32 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
33 |
# External plugins |
|
108
e4e5cfaf5814
Move files around to package the app properly
Vincent Tondellier <tonton+hg@team1664.org>
parents:
88
diff
changeset
|
34 |
$self->plugin('InstallablePaths');
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
35 |
$self->plugin('Config');
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
36 |
$self->plugin('bootstrap_pagination');
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
37 |
# Documentation browser under "/perldoc" |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
38 |
#$self->plugin('PODRenderer');
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
39 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
40 |
# Commands |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
41 |
push @{$self->commands->namespaces}, 'CrashTest::Command';
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
42 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
43 |
# Helpers |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
44 |
$self->plugin("CrashTest::Helper::DateTime");
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
45 |
$self->plugin("CrashTest::Helper::Backtrace");
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
46 |
$self->plugin("CrashTest::Helper::XmlEscape");
|
|
88
c82f5589db11
Add first cut of the crash grouping feature
Vincent Tondellier <tonton+hg@team1664.org>
parents:
79
diff
changeset
|
47 |
$self->plugin("CrashTest::Helper::Stats");
|
|
116
39449f7dab99
Adding bug links (column and search), enabled by default
Vincent Tondellier <tonton+hg@team1664.org>
parents:
108
diff
changeset
|
48 |
$self->plugin("CrashTest::Helper::BugLinks", $self->config->{WebInterface}->{BugTrackerLinks});
|
|
124
12da024402d2
Add a footer with the version number
Vincent Tondellier <tonton+hg@team1664.org>
parents:
122
diff
changeset
|
49 |
$self->plugin("CrashTest::Helper::Version");
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
50 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
51 |
$self->helper(crash_reports => sub { state $crash_reports = CrashTest::Model::CrashReport->new (app => $self); });
|
|
88
c82f5589db11
Add first cut of the crash grouping feature
Vincent Tondellier <tonton+hg@team1664.org>
parents:
79
diff
changeset
|
52 |
$self->helper(crash_groups => sub { state $crash_groups = CrashTest::Model::CrashGroup->new (app => $self); });
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
53 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
54 |
$self->helper(crash_processor => sub { state $crash_processor = CrashTest::Model::CrashProcessor->new (app => $self, config => $self->config); });
|
|
120
1a0fa98037fa
Add Bug status table in the detailed report.
Vincent Tondellier <tonton+hg@team1664.org>
parents:
116
diff
changeset
|
55 |
$self->helper(stackfilter => sub { state $stackfilter = CrashTest::Model::StackFilter->new (app => $self, config => $self->config); });
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
56 |
$self->helper(storage => sub { state $storage = CrashTest::Model::Storage->new (app => $self, config => $self->config); });
|
|
120
1a0fa98037fa
Add Bug status table in the detailed report.
Vincent Tondellier <tonton+hg@team1664.org>
parents:
116
diff
changeset
|
57 |
$self->helper(bug_link => sub { state $bug_link = CrashTest::Model::BugLink->new (app => $self, config => $self->config->{WebInterface}->{BugTrackerLinks}); });
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
58 |
|
|
79
4ae8bb6f8a96
Small config reorganization
Vincent Tondellier <tonton+hg@team1664.org>
parents:
78
diff
changeset
|
59 |
$self->plugin('Minion', $self->config->{Processor}->{JobQueue}->{Backend}->{Minion});
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
60 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
61 |
$self->storage->load_plugins(); |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
62 |
$self->crash_processor->load_plugins(); |
|
120
1a0fa98037fa
Add Bug status table in the detailed report.
Vincent Tondellier <tonton+hg@team1664.org>
parents:
116
diff
changeset
|
63 |
$self->bug_link->load_plugins(); |
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
64 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
65 |
# Router |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
66 |
my $r = $self->routes; |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
67 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
68 |
# Normal route to controller |
|
131
bb5fad5d66b8
Allow atom and html format for compat with Mojolicious >= 9.11
Vincent Tondellier <tonton+hg@team1664.org>
parents:
124
diff
changeset
|
69 |
$r->get('/' => [format => ['html', 'atom']])->to('crash_reports#index', format => undef)->name('index');
|
|
bb5fad5d66b8
Allow atom and html format for compat with Mojolicious >= 9.11
Vincent Tondellier <tonton+hg@team1664.org>
parents:
124
diff
changeset
|
70 |
$r->get('/reports' => [format => ['html', 'atom']])->to('crash_reports#index', format => undef)->name('reports');
|
|
88
c82f5589db11
Add first cut of the crash grouping feature
Vincent Tondellier <tonton+hg@team1664.org>
parents:
79
diff
changeset
|
71 |
$r->get('/groups')->to('crash_groups#index')->name('groups');
|
|
c82f5589db11
Add first cut of the crash grouping feature
Vincent Tondellier <tonton+hg@team1664.org>
parents:
79
diff
changeset
|
72 |
$r->get('/groups/:uuid' => [ uuid => qr/[0-9a-fA-F-]+/ ])->to('crash_groups#show')->name('group');
|
|
c82f5589db11
Add first cut of the crash grouping feature
Vincent Tondellier <tonton+hg@team1664.org>
parents:
79
diff
changeset
|
73 |
$r->get('/report/:uuid' => [ uuid => qr/[0-9a-fA-F-]+/ ])->to('crash_reports#show')->name('report');
|
|
78
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
74 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
75 |
$r->post('/submit')->to('crash_inserter#insert');
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
76 |
} |
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
77 |
|
|
0ebef32c34af
Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff
changeset
|
78 |
1; |