Page MenuHomePhabricator

better mobile device support for whonix.org by using mediawiki MobileFrontend
Closed, ResolvedPublic

Description

Enable mediawiki mobile frontend.

https://www.mediawiki.org/wiki/Extension:MobileFrontend

It's already installed. Works quite well. Imprint footer links now functional.

https://github.com/varnish/varnish-devicedetect could be the way to go.

https://www.mediawiki.org/wiki/Extension:MobileFrontend#Using_the_mobile_view contains some info on how to make MobileFrontend work with varnish.

Event Timeline

Patrick raised the priority of this task from to Normal.
Patrick updated the task description. (Show Details)
Patrick added subscribers: Patrick, fortasse, WhonixQubes.

This is done. The related varnish vlc snippet:

##########################################################################################
## mediawiki mobile frontend
##########################################################################################

## credits:
## https://github.com/varnish/varnish-devicedetect/blob/master/INSTALL.rst

## transparently adding "?useformat=mobile" to backend requests
## https://www.whonix.org/wiki/Main_Page
## https://www.whonix.org/wiki/Main_Page?useformat=mobile

include "devicedetect.vcl";

sub vcl_recv {
   call devicedetect;
}

sub vcl_backend_fetch {
   if ( bereq.url == "/wiki/" || bereq.url == "/w" || bereq.url ~ "^/wiki/" || bereq.url ~ "^/w/" ) {
      if ( bereq.http.X-UA-Device ~ "^mobile" || bereq.http.X-UA-device ~ "^tablet" ) {
         if ( bereq.method == "GET" ) {
            set bereq.url = bereq.url + "?useformat=mobile";
         }
      }
   }
}

sub vcl_deliver {
   set resp.http.X-UA-Device = req.http.X-UA-Device;
}