Fix #8820 (Accessing Content Server from iPad gives mobile view of ebook catalog)

This commit is contained in:
Kovid Goyal 2011-02-07 09:57:39 -07:00
parent 34d32fe464
commit d9a5b3c3c0
2 changed files with 5 additions and 1 deletions

View File

@ -125,7 +125,7 @@ class ContentServer(object):
ua.startswith('Stanza')
# A better search would be great
want_mobile = self.MOBILE_UA.search(ua) is not None
want_mobile = self.is_mobile_browser(ua)
if self.opts.develop and not want_mobile:
cherrypy.log('User agent: '+ua)

View File

@ -169,6 +169,10 @@ class MobileServer(object):
MOBILE_UA = re.compile('(?i)(?:iPhone|Opera Mini|NetFront|webOS|Mobile|Android|imode|DoCoMo|Minimo|Blackberry|MIDP|Symbian|HD2|Kindle)')
def is_mobile_browser(self, ua):
match = self.MOBILE_UA.search(ua)
return match is not None and 'iPad' not in ua
def add_routes(self, connect):
connect('mobile', '/mobile', self.mobile)
connect('mobile_css', '/mobile/style.css', self.mobile_css)