diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-04-20 20:20:52 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-04-20 20:20:52 +0200 |
commit | eeedb40bdc0510dec0e2ddca149e82bff7495d0a (patch) | |
tree | b80eb0f9908016382e8a36d9dd9f321cdd44473f /lib | |
parent | 375f02ad634c10030f47af94f0530dda0d2d044d (diff) |
switch to a proper dark theme using javascript and sass3.1.0
The dark=1 option is still supported, but no longer visible in the UI.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DBInfoscreen.pm | 18 | ||||
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index 6be6e2c..1828737 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -26,6 +26,24 @@ my %default = ( sub startup { my ($self) = @_; + $self->hook( + before_dispatch => sub { + my ($self) = @_; + + # The "theme" cookie is set client-side if the theme we delivered was + # changed by dark mode detection or by using the theme switcher. It's + # not part of Mojolicious' session data (and can't be, due to + # signing and HTTPOnly), so we need to add it here. + + for my $cookie ( @{ $self->req->cookies } ) { + if ( $cookie->name eq 'theme' ) { + $self->session( theme => $cookie->value ); + return; + } + } + } + ); + $self->attr( cache_hafas => sub { my ($self) = @_; diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 8ac8101..4a9c94d 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -517,7 +517,6 @@ sub handle_request { my $show_details = $self->param('detailed') // 0; my $backend = $self->param('backend') // 'iris'; my $admode = $self->param('admode') // 'deparr'; - my $dark_layout = $self->param('dark') // 0; my $apiver = $self->param('version') // 0; my $callback = $self->param('callback'); my $with_related = !$self->param('no_related'); |