}
# If Mojo native app is requesting login, we need to possibly redirect
- my $C = $Bugzilla::Quantum::CGI::C;
+ my $C = $Bugzilla::App::CGI::C;
if ($C->session->{override_login_target}) {
my $mojo_url = Mojo::URL->new($C->session->{override_login_target});
$mojo_url->query($C->session->{cgi_params});
Bugzilla->audit(
"[rate_limit] action=$action, ip=$ip, limit=$limit, name=$name");
if ($action eq 'block') {
- $Bugzilla::Quantum::CGI::C->block_ip($ip);
+ $Bugzilla::App::CGI::C->block_ip($ip);
ThrowUserError("rate_limit");
}
}
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum;
+package Bugzilla::App;
use Mojo::Base 'Mojolicious';
# Needed for its exit() overload, must happen early in execution.
use Bugzilla::Extension ();
use Bugzilla::Install::Requirements ();
use Bugzilla::Logging;
-use Bugzilla::Quantum::CGI;
-use Bugzilla::Quantum::OAuth2::Clients;
-use Bugzilla::Quantum::SES;
-use Bugzilla::Quantum::Home;
-use Bugzilla::Quantum::API;
-use Bugzilla::Quantum::Static;
+use Bugzilla::App::CGI;
+use Bugzilla::App::OAuth2::Clients;
+use Bugzilla::App::SES;
+use Bugzilla::App::Home;
+use Bugzilla::App::API;
+use Bugzilla::App::Static;
use Mojo::Loader qw( find_modules );
use Module::Runtime qw( require_module );
use Bugzilla::Util ();
use Bugzilla::WebService::Server::REST;
use Try::Tiny;
-has 'static' => sub { Bugzilla::Quantum::Static->new };
+has 'static' => sub { Bugzilla::App::Static->new };
sub startup {
my ($self) = @_;
TRACE('Starting up');
- $self->plugin('Bugzilla::Quantum::Plugin::BlockIP');
- $self->plugin('Bugzilla::Quantum::Plugin::Glue');
- $self->plugin('Bugzilla::Quantum::Plugin::Hostage')
+ $self->plugin('Bugzilla::App::Plugin::BlockIP');
+ $self->plugin('Bugzilla::App::Plugin::Glue');
+ $self->plugin('Bugzilla::App::Plugin::Hostage')
unless $ENV{BUGZILLA_DISABLE_HOSTAGE};
- $self->plugin('Bugzilla::Quantum::Plugin::SizeLimit')
+ $self->plugin('Bugzilla::App::Plugin::SizeLimit')
unless $ENV{BUGZILLA_DISABLE_SIZELIMIT};
$self->plugin('ForwardedFor') if Bugzilla->has_feature('better_xff');
- $self->plugin('Bugzilla::Quantum::Plugin::Helpers');
- $self->plugin('Bugzilla::Quantum::Plugin::OAuth2');
+ $self->plugin('Bugzilla::App::Plugin::Helpers');
+ $self->plugin('Bugzilla::App::Plugin::OAuth2');
- push @{ $self->commands->namespaces }, 'Bugzilla::Quantum::Command';
+ push @{ $self->commands->namespaces }, 'Bugzilla::App::Command';
$self->hook(
before_routes => sub {
my ($self) = @_;
my $r = $self->routes;
- Bugzilla::Quantum::CGI->setup_routes($r);
- Bugzilla::Quantum::CGI->load_one('bzapi_cgi', 'extensions/BzAPI/bin/rest.cgi');
+ Bugzilla::App::CGI->setup_routes($r);
+ Bugzilla::App::CGI->load_one('bzapi_cgi', 'extensions/BzAPI/bin/rest.cgi');
$r->get('/home')->to('Home#index');
$r->any('/')->to('CGI#index_cgi');
$r->any('/login')->to('CGI#index_cgi' => {'GoAheadAndLogIn' => '1'});
$r->any('/:new_bug' => [new_bug => qr{new[-_]bug}])->to('CGI#new_bug_cgi');
- Bugzilla::Quantum::API->setup_routes($r);
- Bugzilla::Quantum::SES->setup_routes($r);
- Bugzilla::Quantum::OAuth2::Clients->setup_routes($r);
+ Bugzilla::App::API->setup_routes($r);
+ Bugzilla::App::SES->setup_routes($r);
+ Bugzilla::App::OAuth2::Clients->setup_routes($r);
}
1;
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::API;
+package Bugzilla::App::API;
use 5.10.1;
use Mojo::Base qw( Mojolicious::Controller );
use Mojo::JSON qw( true false );
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::CGI;
+package Bugzilla::App::CGI;
use Mojo::Base 'Mojolicious::Controller';
use CGI::Compile;
use Socket qw(AF_INET inet_aton);
use Mojo::File qw(path);
use English qw(-no_match_vars);
-use Bugzilla::Quantum::Stdout;
+use Bugzilla::App::Stdout;
use Bugzilla::Constants qw(bz_locations USAGE_MODE_BROWSER);
our $C;
open STDIN, '<', $stdin->path
or die "STDIN @{[$stdin->path]}: $!"
if -s $stdin->path;
- tie *STDOUT, 'Bugzilla::Quantum::Stdout', controller => $c; ## no critic (tie)
+ tie *STDOUT, 'Bugzilla::App::Stdout', controller => $c; ## no critic (tie)
# the finally block calls cleanup.
$c->stash->{cleanup_guard}->dismiss;
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::Command::revoke_api_keys; ## no critic (Capitalization)
+package Bugzilla::App::Command::revoke_api_keys; ## no critic (Capitalization)
use 5.10.1;
use Mojo::Base 'Mojolicious::Command';
=head1 NAME
-Bugzilla::Quantum::Command::revoke_api_keys - revoke API keys command
+Bugzilla::App::Command::revoke_api_keys - revoke API keys command
=head1 SYNOPSIS
=head1 DESCRIPTION
-L<Bugzilla::Quantum::Command::revoke_api_keys> revokes API keys.
+L<Bugzilla::App::Command::revoke_api_keys> revokes API keys.
=head1 ATTRIBUTES
-L<Bugzilla::Quantum::Command::revoke_api_keys> inherits all attributes from
+L<Bugzilla::App::Command::revoke_api_keys> inherits all attributes from
L<Mojolicious::Command> and implements the following new ones.
=head2 description
=head1 METHODS
-L<Bugzilla::Quantum::Command::revoke_api_keys> inherits all methods from
+L<Bugzilla::App::Command::revoke_api_keys> inherits all methods from
L<Mojolicious::Command> and implements the following new ones.
=head2 run
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::Home;
+package Bugzilla::App::Home;
use Mojo::Base 'Mojolicious::Controller';
use Bugzilla::Error;
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::OAuth2::Clients;
+package Bugzilla::App::OAuth2::Clients;
use 5.10.1;
use Mojo::Base 'Mojolicious::Controller';
-package Bugzilla::Quantum::Plugin::BlockIP;
+package Bugzilla::App::Plugin::BlockIP;
use 5.10.1;
use Mojo::Base 'Mojolicious::Plugin';
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::Plugin::Glue;
+package Bugzilla::App::Plugin::Glue;
use 5.10.1;
use Mojo::Base 'Mojolicious::Plugin';
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::Plugin::Helpers;
+package Bugzilla::App::Plugin::Helpers;
use 5.10.1;
use Mojo::Base qw(Mojolicious::Plugin);
-package Bugzilla::Quantum::Plugin::Hostage;
+package Bugzilla::App::Plugin::Hostage;
use 5.10.1;
use Mojo::Base 'Mojolicious::Plugin';
use Bugzilla::Logging;
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::Plugin::OAuth2;
+package Bugzilla::App::Plugin::OAuth2;
use 5.10.1;
use Mojo::Base 'Mojolicious::Plugin::OAuth2::Server';
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::Plugin::SizeLimit;
+package Bugzilla::App::Plugin::SizeLimit;
use 5.10.1;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON qw(decode_json);
-package Bugzilla::Quantum::SES;
+package Bugzilla::App::SES;
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::Static;
+package Bugzilla::App::Static;
use Mojo::Base 'Mojolicious::Static';
use Bugzilla::Constants qw(bz_locations);
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-package Bugzilla::Quantum::Stdout;
+package Bugzilla::App::Stdout;
use 5.10.1;
use Moo;
}
}
my $headers = $self->SUPER::header(%headers) || '';
- if ($self->server_software eq 'Bugzilla::Quantum::CGI') {
- my $c = $Bugzilla::Quantum::CGI::C;
+ if ($self->server_software eq 'Bugzilla::App::CGI') {
+ my $c = $Bugzilla::App::CGI::C;
$c->res->headers->parse($headers);
my $status = $c->res->headers->status;
if ($status && $status =~ /^([0-9]+)/) {
}
else {
LOGDIE(
- "Bugzilla::CGI->header() should only be called from inside Bugzilla::Quantum::CGI!"
+ "Bugzilla::CGI->header() should only be called from inside Bugzilla::App::CGI!"
);
}
}
sub _in_eval {
my $in_eval = 0;
for (my $stack = 1; my $sub = (caller($stack))[3]; $stack++) {
- last if $sub =~ /^Bugzilla::Quantum::CGI::try/;
+ last if $sub =~ /^Bugzilla::App::CGI::try/;
$in_eval = 1 if $sub =~ /^\(eval\)/;
}
return $in_eval;
# Returns the real remote address of the client,
sub remote_ip {
- if (($ENV{SERVER_SOFTWARE} // '') eq 'Bugzilla::Quantum::CGI') {
- my $c = $Bugzilla::Quantum::CGI::C or LOGDIE("Cannot find controller!");
+ if (($ENV{SERVER_SOFTWARE} // '') eq 'Bugzilla::App::CGI') {
+ my $c = $Bugzilla::App::CGI::C or LOGDIE("Cannot find controller!");
state $better_xff = Bugzilla->has_feature('better_xff');
return $better_xff ? $c->forwarded_for : $c->tx->remote_address;
}
$ENV{MOJO_LISTEN} ||= $ENV{PORT} ? "http://*:$ENV{PORT}" : "http://*:3001";
# Start command line interface for application
-Mojolicious::Commands->start_app('Bugzilla::Quantum');
+Mojolicious::Commands->start_app('Bugzilla::App');
use lib qw(. lib local/lib/perl5);
use Bugzilla;
-use Bugzilla::Quantum;
+use Bugzilla::App;
use Bugzilla::Constants;
use Getopt::Long;
pod2usage("No IPs given") unless @ARGV;
-my $app = Bugzilla::Quantum->new;
+my $app = Bugzilla::App->new;
if ($unblock) {
$app->unblock_ip($_) for @ARGV;
=head1 DESCRIPTION
-This is just a simple CLI inteface to L<Bugzilla::Quantum::Plugin::BlockIP>.
+This is just a simple CLI inteface to L<Bugzilla::App::Plugin::BlockIP>.
# Mojo::Test loads the application and provides methods for
# testing requests without having to run a server.
-my $t = Test::Mojo->new('Bugzilla::Quantum');
+my $t = Test::Mojo->new('Bugzilla::App');
# we ensure this file exists so the /__lbhearbeat__ test passes.
$t->app->home->child('__lbheartbeat__')->spurt('httpd OK');
ok $oauth_client->{secret},
'New client secret (' . $oauth_client->{secret} . ')';
-my $t = Test::Mojo->new('Bugzilla::Quantum');
+my $t = Test::Mojo->new('Bugzilla::App');
# Allow 1 redirect max
$t->ua->max_redirects(1);
# for setting SOAPAction, which isn't used by XML-RPC.
$server->on_action(sub { $server->handle_login(WS_DISPATCH, @_) })->handle();
};
-my $C = $Bugzilla::Quantum::CGI::C;
+my $C = $Bugzilla::App::CGI::C;
my ($header_str, $body) = split(/(?:\r\n\r\n|\n\n)/, $stdout, 2);
my $headers = Mojo::Headers->new;
$headers->parse("$header_str\r\n\r\n");