summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-07-24 21:11:45 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-07-24 21:11:59 +0200
commit2558df1b91e8aa2116fa88e34fc09055dca900ec (patch)
tree3036c37ca4961642b89b6a0b16f0d86317ad16f1 /lib
parentfe3037348459ed7e4e54b13281e0a1e82a94a78f (diff)
add a prominent backend selection link
Diffstat (limited to 'lib')
-rw-r--r--lib/DBInfoscreen.pm2
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm29
2 files changed, 31 insertions, 0 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm
index 174fc97..2e15eb3 100644
--- a/lib/DBInfoscreen.pm
+++ b/lib/DBInfoscreen.pm
@@ -301,6 +301,8 @@ sub startup {
$r->get('/_autostop')->to('static#geostop');
+ $r->get('/_backend')->to('stationboard#backend_list');
+
$r->get('/_datenschutz')->to('static#privacy');
$r->post('/_geolocation')->to('stationboard#stations_by_coordinates');
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 971ff80..bb45454 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -2141,6 +2141,35 @@ sub stations_by_coordinates {
)->wait;
}
+sub backend_list {
+ my ($self) = @_;
+
+ my @backends = (
+ {
+ name => 'Deutsche Bahn',
+ type => 'IRIS-TTS',
+ }
+ );
+
+ for my $backend ( Travel::Status::DE::HAFAS::get_services() ) {
+ push(
+ @backends,
+ {
+ name => $backend->{name},
+ shortname => $backend->{shortname},
+ type => 'HAFAS',
+ hafas => 1,
+ }
+ );
+ }
+
+ $self->render(
+ '_backend',
+ backends => \@backends,
+ hide_opts => 1
+ );
+}
+
sub autocomplete {
my ($self) = @_;