summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Controller/Static.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-24 10:13:30 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-24 10:13:30 +0100
commit9792369c2b79e68cc7384bbd9b55eef30fe8c004 (patch)
treeced72989066592a9344109974480ed67e413f9ee /lib/DBInfoscreen/Controller/Static.pm
parent542a1db1106aaafe16203ffdb3bbac792d17a96c (diff)
Transition from Mojolicious::Lite to full Mojolicious app
Diffstat (limited to 'lib/DBInfoscreen/Controller/Static.pm')
-rw-r--r--lib/DBInfoscreen/Controller/Static.pm58
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Controller/Static.pm b/lib/DBInfoscreen/Controller/Static.pm
new file mode 100644
index 0000000..434facd
--- /dev/null
+++ b/lib/DBInfoscreen/Controller/Static.pm
@@ -0,0 +1,58 @@
+package DBInfoscreen::Controller::Static;
+use Mojo::Base 'Mojolicious::Controller';
+
+# Copyright (C) 2011-2019 Daniel Friesel <derf+dbf@finalrewind.org>
+# License: 2-Clause BSD
+
+my %default = (
+ backend => 'iris',
+ mode => 'app',
+ admode => 'deparr',
+);
+
+sub redirect {
+ my ($self) = @_;
+ my $station = $self->param('station');
+ my $params = $self->req->params;
+
+ $params->remove('station');
+
+ for my $param (qw(platforms backend mode admode via)) {
+ if (
+ not $params->param($param)
+ or ( exists $default{$param}
+ and $params->param($param) eq $default{$param} )
+ )
+ {
+ $params->remove($param);
+ }
+ }
+
+ $params = $params->to_string;
+
+ $self->redirect_to("/${station}?${params}");
+}
+
+sub geolocation {
+ my ($self) = @_;
+
+ $self->render(
+ 'geolocation',
+ with_geolocation => 1,
+ hide_opts => 1
+ );
+}
+
+sub privacy {
+ my ($self) = @_;
+
+ $self->render( 'privacy', hide_opts => 1 );
+}
+
+sub imprint {
+ my ($self) = @_;
+
+ $self->render( 'imprint', hide_opts => 1 );
+}
+
+1;