mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
update bad-url script to offer to launch CrossWords
Working around a bug in Android 11 that broke invitation http urls getting passed to CrossWords. They always launch the backstop script on eehouse.org. So modify that script to include a link that will pass the invitation params to CrossWords via a proprietary scheme it already registers for. No change to app required!
This commit is contained in:
parent
65102c2114
commit
24df7bb694
1 changed files with 31 additions and 23 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from mod_python import apache
|
from mod_python import apache
|
||||||
apacheAvailable = True
|
apacheAvailable = True
|
||||||
|
@ -19,39 +21,39 @@ def printHead():
|
||||||
def printTail():
|
def printTail():
|
||||||
return '</body></html>'
|
return '</body></html>'
|
||||||
|
|
||||||
def printAndroid():
|
def printAndroid(appName, params):
|
||||||
return """
|
return """
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<p>You should not be seeing this page.</p>
|
<p>You just clicked a link in a {appName} invitation. You should not be
|
||||||
|
seeing this page!</p>
|
||||||
|
|
||||||
<p>One of two things went wrong:
|
<p>One of three things went wrong:</p>
|
||||||
<div>• You don't have CrossWords installed</div>
|
<ol>
|
||||||
<div>OR</div>
|
<li>You don't have {appName} installed</li>
|
||||||
<div>• When you clicked on a link and were asked to choose between a
|
|
||||||
browser and CrossWords you chose the browser.</div>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>In the first case, install the latest CrossWords, either <a
|
<div><b>What to do:</b> Install <a
|
||||||
href="market://search?q=pname:org.eehouse.android.xw4">via the Google
|
href="market://search?q=pname:org.eehouse.android.xw4">via Google's App
|
||||||
Play store</a> or <a href="https://eehouse.org/latest.apk">directly
|
Store</a> or <a href="https://eehouse.org/latest.apk">directly
|
||||||
from the author's site</a> (sideloading). After the install is
|
from the author's site</a> (sideloading)</div>
|
||||||
finished go back to the invite email (or text) and tap the link
|
|
||||||
again.</p>
|
|
||||||
|
|
||||||
<p>Otherwise, hit your browser's back button, click the
|
<li>When you were asked to choose between a browser and {appName}
|
||||||
invitation link again, and this time choose CrossWords to handle
|
you chose the browser</li>
|
||||||
it.</p>
|
|
||||||
|
|
||||||
<p>(If you get tired of having to having to make that choice, Android
|
<div><b>What to do:</b> click the invitation link again, and this time
|
||||||
will allow you to make CrossWords the default. If you do that
|
choose {appName}</div>
|
||||||
CrossWords will be launched for all URLs that start with
|
|
||||||
"https://eehouse.org/and/" -- not all URLs of any type.)</p>
|
<li>You're on <em>Android 11</em>, where there appears to be a new
|
||||||
|
bug that prevents you being given a choice!</li>
|
||||||
|
|
||||||
|
<div><b>What to do:</b> Tap <a href="newxwgame://?{params}">this link</a>
|
||||||
|
to launch {appName}</div>
|
||||||
|
</ol>
|
||||||
|
|
||||||
<p>Have fun. And as always, <a href="mailto:xwords@eehouse.org">let
|
<p>Have fun. And as always, <a href="mailto:xwords@eehouse.org">let
|
||||||
me know</a> if you have problems or suggestions.</p>
|
me know</a> if you have problems or suggestions.</p>
|
||||||
</div>
|
</div>
|
||||||
"""
|
""".format(appName=appName, params=params)
|
||||||
|
|
||||||
def printNonAndroid(agent):
|
def printNonAndroid(agent):
|
||||||
subject = 'Android device not identified'
|
subject = 'Android device not identified'
|
||||||
|
@ -73,10 +75,16 @@ def printNonAndroid(agent):
|
||||||
|
|
||||||
def index(req):
|
def index(req):
|
||||||
str = printHead()
|
str = printHead()
|
||||||
|
|
||||||
|
typ = os.path.basename(os.path.dirname(req.filename))
|
||||||
|
if 'andd' == typ: appName = 'CrossDbg'
|
||||||
|
else: appName = 'CrossWords'
|
||||||
|
|
||||||
agent = req.headers_in.get('User-Agent', None)
|
agent = req.headers_in.get('User-Agent', None)
|
||||||
if agent and 'Android' in agent:
|
if agent and 'Android' in agent:
|
||||||
str += printAndroid()
|
str += printAndroid(appName, req.args)
|
||||||
else:
|
else:
|
||||||
str += printNonAndroid(agent)
|
str += printNonAndroid(agent)
|
||||||
|
|
||||||
str += printTail()
|
str += printTail()
|
||||||
return str
|
return str
|
||||||
|
|
Loading…
Reference in a new issue