Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions bootylite.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
my $config = plugin 'config';

# set cookie secret
app->secret($config->{secret} // 'Bootylite');
app->secrets([$config->{secret} // 'Bootylite']);

# use the right character encoding
plugin charset => {charset => $config->{encoding}};
Expand Down Expand Up @@ -53,21 +53,7 @@
*Mojolicious::Controller::url_for = sub {
my $c = shift;

# create urls
my $url = $url_for->($c, @_)->to_abs;
my $req_url = $c->req->url->to_abs;

# return relative version if request url exists
if ($req_url->to_string) {

# "repair" if empty
my $rel_url = $url->to_rel($req_url);
return Mojo::URL->new('./') unless $rel_url->to_string;
return $rel_url;
}

# or change nothing
return $url;
return $url_for->($c, @_)->to_abs;
};
}

Expand Down