#!/usr/bin/python3 import os try: from mod_python import apache apacheAvailable = True except ImportError: apacheAvailable = False def printHead(): return """ CrossWords Invite redirect """ def printTail(): return '' def printAndroid(appName, params, scheme): return """

You just clicked a link in a {appName} invitation, but you should not be seeing this page!


One of three things went wrong:

  1. You don't have {appName} installed
  2. What to do: Install via Google's App Store or directly from the author's site (sideloading)
  3. When you were asked to choose between a browser and {appName} you chose the browser
  4. What to do: Click the invitation link again, and this time choose {appName}
  5. You're on Android 11, where there appears to be a new bug that prevents you being given a choice!
  6. What to do: Tap this link to launch {appName}

Have fun. And as always, let me know if you have problems or suggestions.

""".format(appName=appName, params=params, scheme=scheme) def printNonAndroid(agent): subject = 'Android device not identified' body = 'My browser is running on an android device but says its' \ + ' user agent is: \"{agent}\". Please fix your website' \ + ' to recognize this as an Android browser'.format(agent=agent) fmt = """

This page is meant to be viewed on an Android device.


(If you are viewing this on an Android device, you've found a bug! Please email me.

""" return fmt.format(subject=subject, body=body) def index(req): str = printHead() typ = os.path.basename(os.path.dirname(req.filename)) if 'andd' == typ: appName = 'CrossDbg' scheme = 'newxwgamed' else: appName = 'CrossWords' scheme = 'newxwgame' agent = req.headers_in.get('User-Agent', None) if agent and 'Android' in agent: str += printAndroid(appName, req.args, scheme) else: str += printNonAndroid(agent) str += printTail() return str