summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl22
1 files changed, 22 insertions, 0 deletions
diff --git a/index.pl b/index.pl
index 543bcd1..155fd18 100644
--- a/index.pl
+++ b/index.pl
@@ -810,6 +810,28 @@ get '/_redirect' => sub {
}
};
+get '/_auto' => sub {
+ my $self = shift;
+
+ $self->render('geolocation', with_geolocation => 1, hide_opts => 1);
+};
+
+post '/_geolocation' => sub {
+ my $self = shift;
+
+ my $lon = $self->param('lon');
+ my $lat = $self->param('lat');
+
+ if (not $lon or not $lat) {
+ $self->render(json => {error => 'Invalid lon/lat received'});
+ }
+ else {
+ $self->render(json => {
+ candidates => [ Travel::Status::DE::IRIS::Stations::get_stations_by_location($lon, $lat, 10) ],
+ });
+ }
+};
+
app->defaults( layout => 'default' );
get '/' => \&handle_request;