From cc0dda06d89a5affbfe950a9cca226144d5cc887 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 10 Nov 2019 09:01:33 +0100 Subject: single layout: strip non-numeric platform parts for now --- lib/DBInfoscreen.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/DBInfoscreen.pm') diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index aad1290..b062c9d 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -245,6 +245,26 @@ sub startup { } ); + $self->helper( + 'numeric_platform_part' => sub { + my ( $self, $platform ) = @_; + + if ( not defined $platform ) { + return 0; + } + + if ( $platform =~ m{ ^ \d+ $ }x ) { + return $platform; + } + + if ( $platform =~ m{ (\d+) }x ) { + return $1; + } + + return 0; + } + ); + my $r = $self->routes; $r->get('/_redirect')->to('static#redirect'); -- cgit v1.2.3