Files
appchk-web/src/html_root.py
2020-09-26 19:03:10 +02:00

94 lines
3.4 KiB
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
import os
import lib_common as mylib
import lib_html as HTML
def gen_root():
with open(mylib.path_root('templates', 'root.html'), 'r') as fp:
HTML.write(mylib.path_out(), fp.read())
def gen_help():
many = 7
txt = '''<h2>Help needed!</h2>
<div class="squeeze"><p>
With the release of iOS 14 some <a href="https://www.apple.com/ios/ios-14/features/#Privacy" target="_blank">Privacy</a> features are put into the spotlight.
One of these features is making transparent how your data is being used for tracking purposes.
Developers are now required to self-report their privacy practices.
</p><p>
We have selected a random sample of applications for evaluation and want to check whether the app behaviour changes over time.
This study consists of two stages; this is the second.
In the first stage we recorded the app communications before iOS 14 was released.
In the second stage we repeat the process after the launch of iOS 14.
</p><p>
You can help us by providing app recordings of the following applications.
Make sure to update to the lastest AppCheck version (v.34) which includes a check for the iOS version.
Get the <a href="https://testflight.apple.com/join/9jjaFeHO" target="_blank">Testflight beta</a>.
</p>
</div>
<div id="help-links">'''
def app(bundle_id, name, appstore_id):
iurl = 'https://apps.apple.com/de/app/id{}'.format(appstore_id)
aref = '<a href="{}" target="_blank">AppStore</a>'.format(iurl)
return '{} <span class="snd">Download from {}</span>'.format(
HTML.a_app(bid, name), aref)
def rec(count):
return '<span class="{}"><b>{}</b>/{}</span> recordings'.format(
'done' if count >= many else 'notyet', count, many)
obj = mylib.json_read(mylib.path_root('src', 'help.json'))
for land in sorted(obj.keys()):
txt += '\n<h3>{}:</h3>\n<table class="alternate">'.format(land)
txt += HTML.tr(['', 'App Name', 'pre iOS 14', 'post iOS 14'], 'th')
for i, x in enumerate(obj[land]):
bid = x[2]
c = [0, 0]
for fname, json in mylib.enum_jsons(bid):
try:
ios14 = int(json['ios'].split('.')[0]) >= 14
except KeyError:
# assume everything submitted after release date is iOS14
ios14 = os.path.getmtime(fname) > 1600258000
c[1 if ios14 else 0] += 1
txt += HTML.tr([i + 1, app(bid, x[0], x[1]), rec(c[0]), rec(c[1])])
txt += '</table>'
txt += '</div>'
HTML.write(mylib.path_out('help'), txt)
def gen_search():
HTML.write(mylib.path_out(), '''
<h2>Redirecting …</h2>
<script type="text/javascript">
var GET={};
window.location.search.substr(1).split("&").forEach(function(x){GET[x.split("=")[0]]=x.split("=")[1]});
if (GET["id"]) { window.location = "/app/" + GET["id"] + "/"; }
</script>''', fname='redirect.html')
def gen_404():
HTML.write(mylib.path_out(), '''
<h2>404 Not Found</h2>
<p>Go back to <a href="/">start page</a></p>''', fname='404.html')
def process():
print('generating root html ...')
print(' index.html')
gen_root() # root index.thml
print(' redirect.html')
gen_search() # root redirect.html?id=my.bundle.id
print(' 404.html')
gen_404()
print(' /help/')
gen_help()
print('')
if __name__ == '__main__':
process()