mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #8820 (Accessing Content Server from iPad gives mobile view of ebook catalog)
This commit is contained in:
parent
34d32fe464
commit
d9a5b3c3c0
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user