diff --git a/server/app.py b/server/app.py index 018da01e37fdb50b609b92ae4a680d20ab1d46ad..7b0acb0177f310d024c9dabfc4aa08dd4ceb5aad 100644 --- a/server/app.py +++ b/server/app.py @@ -20,7 +20,7 @@ app.jinja_env.add_extension('server.templating.CustomFunctionsExtension') app.config['BABEL_TRANSLATION_DIRECTORIES'] = TRANSLATION_DIR # undocumented Flask-Babel config option # For localization Flask-BabelEx might be better for choice performance (they are api compatible, sans setting custom translation path) -# - Flask-Babel loads the translation catalog every request +# - Flask-Babel loads the translation catalog every request, but it is the more common choice still babel = Babel(app) gtfs = GtfsHandler('gtfs', dir = DATA_DIR, defer = (sys.path[0] == '' and __package__ != None)) locator = FoliLocator(endpointURI = 'http://data.foli.fi/siri/vm', userAgent = APP_VERSION, pollFreq = 3) @@ -96,7 +96,7 @@ def afterRequestHandler(response): @app.url_value_preprocessor def pullUrlGlobals(endpoint, values): - if endpoint == 'static' or values == None: + if endpoint == None or values == None or endpoint == 'static' or endpoint.startswith('root/'): return # stopId is esentially a global routing argument, its absence is an exception @@ -117,7 +117,7 @@ def pullUrlGlobals(endpoint, values): @app.url_defaults def urlDefaults(endpoint, values): - if endpoint == 'static' or values == None: + if endpoint == None or values == None or endpoint == 'static' or endpoint.startswith('root/'): return # inject stop id if the endpoint is expecting it and it is not present @@ -152,9 +152,15 @@ def index(): return redirect(url_for('view', stopId = DEFAULT_STOP)) # avoid needless processing -@app.route('/favicon.ico') -@app.route('/robots.txt') -def sendRootFile(): +@app.route('/favicon.ico', endpoint = 'root/favicon') +@app.route('/robots.txt', endpoint = 'root/robots') +@app.route('/favicon-32x32.png', endpoint = 'root/favicon32') +@app.route('/favicon-16x16.png', endpoint = 'root/favicon16') +@app.route('/apple-touch-icon.png', endpoint = 'root/touch-icon') +@app.route('/safari-pinned-tab.svg', endpoint = 'root/mask-icon') +@app.route('/site.webmanifest', endpoint = 'root/manifest') +@app.route('/<path:path>') +def sendRootFile(path = None): return send_from_directory(STATIC_DIR, request.path[1:]) # catch all route for any views, automatically loads data into template context diff --git a/static/android-chrome-192x192.png b/static/android-chrome-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..f91e1a26cca254f32293efb07886a9f5ed092cd4 Binary files /dev/null and b/static/android-chrome-192x192.png differ diff --git a/static/android-chrome-512x512.png b/static/android-chrome-512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..5a1ee86ea0543fc61c0f5cd3953238830e2ca1b1 Binary files /dev/null and b/static/android-chrome-512x512.png differ diff --git a/static/apple-touch-icon.png b/static/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cce20c7695c26836d393c72a3f6a4aec09009230 Binary files /dev/null and b/static/apple-touch-icon.png differ diff --git a/static/browserconfig.xml b/static/browserconfig.xml new file mode 100644 index 0000000000000000000000000000000000000000..951034e0eabb47e1e5bd9f3bde41ebc01be40b77 --- /dev/null +++ b/static/browserconfig.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<browserconfig> + <msapplication> + <tile> + <square150x150logo src="/mstile-150x150.png"/> + <TileColor>#bfc0c2</TileColor> + </tile> + </msapplication> +</browserconfig> diff --git a/static/favicon-16x16.png b/static/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..e8a685a583af2ecd89c9f6814e55bbbfa9c5c4d6 Binary files /dev/null and b/static/favicon-16x16.png differ diff --git a/static/favicon-32x32.png b/static/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..b7c0ff7888cd768197905751d1b660f52993d1fd Binary files /dev/null and b/static/favicon-32x32.png differ diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..f176ecdd2715552e005be1e1572dd3991fbdce08 Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/mstile-150x150.png b/static/mstile-150x150.png new file mode 100644 index 0000000000000000000000000000000000000000..96e93b0ec12d33b9d32a3de72a753585a1ba8d68 Binary files /dev/null and b/static/mstile-150x150.png differ diff --git a/static/safari-pinned-tab.svg b/static/safari-pinned-tab.svg new file mode 100644 index 0000000000000000000000000000000000000000..e063451f091e5d3e054f7343f96c9179d10ed7ac --- /dev/null +++ b/static/safari-pinned-tab.svg @@ -0,0 +1 @@ +<svg version="1" xmlns="http://www.w3.org/2000/svg" width="4996" height="4996" viewBox="0 0 3747.000000 3747.000000"><path d="M20 1873.5V2910h3707V837H20v1036.5zM1964.5 1025c22.6 1.5 43.4 3.7 60.9 6.5 133.7 21.6 232.5 92.1 279.8 199.5 20 45.3 29.9 92 31.5 148.5 1.2 42.8-3.8 78.7-16.2 115.9-23.1 69.8-71.8 130.3-133.4 166-7.2 4.2-26.7 13.6-28.2 13.6-2.2 0-.6 2.3 2.4 3.3 5.4 2 31.7 15.2 40.1 20.1 73.6 43.8 124.1 111.3 145 194.1 8 31.3 11.1 58.6 11 96.5-.1 69.9-13.1 130.5-39 182.3-3 5.9-5.4 11-5.4 11.2 0 .3 144.3.4 320.8.2 292.6-.3 321.6-.4 331.2-1.9 47.9-7.6 82.6-18.6 112.5-35.6 52.9-30.1 83.3-74.2 91.7-132.7 1.7-11.7 1.6-49.1-.1-61.5-6.4-46.6-22.6-79.5-52.6-106.2-33.7-30.1-67.1-42.6-143.5-53.7-25.4-3.7-51.1-7.3-107-15.1-59.3-8.3-74.9-10.6-93-14.1-67.9-13.2-127.2-36.3-175-68.2-35.9-23.9-67.1-55.8-88.9-90.8-26.6-42.7-42.8-96.2-47.1-155.4-1.3-18.2-1.3-53.2.1-70.9 4.5-59.3 22.3-117.1 50.5-163.7 35.1-58.2 85.6-104 149.9-136.1 87.9-44 195.9-60.3 326-49.2 76.8 6.5 146.7 25.3 207.6 55.9 43 21.5 86 51.2 124.4 86l5 4.5-14.5 14.3c-8 7.8-37.2 36.2-64.9 63l-50.3 48.7-6-5.3c-18.5-16.2-38.3-30.8-57.1-42.2-8.6-5.1-29.9-16.2-36.2-18.8-2.2-.8-7.8-3.2-12.5-5.2-21.1-8.8-52.7-17.6-81.1-22.4-23.3-4-42.9-5.9-73.7-7.2-64.2-2.9-116.6 6-160 27.3-49.7 24.2-83.6 62-100 111.3-4.4 13.2-6.2 21.2-8.8 38.5-2.3 16.3-1.6 49.1 1.5 64.5 6.8 33.6 18.9 56.7 41.5 79 21.6 21.4 49 37.3 87.1 50.5 30.9 10.7 45.8 13.7 124 24.9 105.6 15.3 116.4 16.9 141.5 21.7 102.8 19.6 168.9 51 224 106.4 37.9 38 64.2 85.5 79 142.1 12.6 48.7 16.8 104.5 11.5 154.9-1.7 16.3-1.8 16.8-5 34-10.6 56-38.4 117.3-72.4 159.9-47.8 59.7-114.6 103.3-195.6 127.6-35.4 10.6-64.6 16.4-107 21.3l-23 2.6-778.2.3-778.3.3v-183l276.3-.3c257.6-.3 277-.4 287.7-2 40.7-6.3 72-18 100.2-37.7 14.3-9.9 35.6-31.8 45.2-46.3 22.5-34.2 33.6-73.3 33.6-118.7 0-109.3-65.9-185-174.5-200.4-23.6-3.4-36.9-3.6-201.1-3.6H1614v-182.9l167.8-.4 167.7-.3 13.5-2.2c30-5 50.6-11.3 73.5-22.7 18-9 30.4-17.6 44.2-30.8 28.3-27.2 44.7-60.9 50.8-104.4 2.7-18.9 1.7-56-1.9-74.2-9.8-48.5-33.8-85.5-72.6-111.6-11.4-7.7-33.8-18.4-48.5-23.3-22.4-7.5-44.1-11.5-71.9-13.2-12.1-.8-178.4-1-572.6-.8-502.8.4-556.6.6-567 2-41.6 5.8-70.5 15.3-94 31.1-43.9 29.3-71.5 70.6-81.5 122.1-6.2 31.6-4.6 69.8 4.2 98.1 3.6 11.8 14.3 32.8 21.7 42.5 31.6 41.9 94 72.3 172.6 84.1 14.4 2.1 79.6 11.7 102 14.9 78.3 11.3 103.3 15.7 138 24.6 78 19.9 132.1 49.2 180 97.5 51.4 51.7 81.9 123.3 89.5 209.8 2.5 28 2 71.5-1.1 95.1-7.7 59.5-27.9 112.3-60.7 158.4-24.8 34.9-61.2 69.5-99.1 94-97.8 63.4-226.4 90.8-382.6 81.6-107.5-6.4-189.2-26.3-265-64.6-47.9-24.1-95.2-58-136.2-97.6l-10.7-10.3 67.4-65.3c37.1-35.8 67.9-65.2 68.4-65.2.6 0 5 3.7 9.8 8.2 87 81.3 187.6 116.8 330.3 116.8 105.2 0 181.9-24.3 230-73 26.4-26.7 42.5-60.1 48.1-100 1.9-13.4 1.6-47.4-.4-62.6-6.2-44.8-23.3-79-52.4-104.6-30-26.4-57.2-38.4-109.3-48.2-17.2-3.2-26.4-4.6-134-19.6-23.9-3.3-52.9-7.4-64.5-9.1-59.5-8.7-106.3-21.7-152.5-42.2-27.5-12.2-58.3-30.6-80.8-48.3-11.8-9.4-37.4-34.8-46.6-46.4-35.7-44.9-56.6-97.9-65.2-165.5-2.1-16.6-3-68.7-1.5-88.5 8.2-108.5 57.5-201.4 139.6-262.7 72.7-54.4 164.2-83.9 278-89.6 17.9-.9 1111.8-.6 1126 .3zM501 2450.1c11 1.3 22.8 4.3 31.3 8 7.6 3.2 21.1 11.7 27.2 17.2l4 3.6-12.6 12.7-12.7 12.6-5.3-4.2c-10.2-8.1-22.2-12.9-37.2-14.9-23.8-3.3-42.6 1.4-53.6 13.4-7 7.8-9.5 14.5-9.5 26.5-.1 8.5.2 10.1 2.7 15.2 5.8 11.8 17.7 18.4 39.5 21.9 7 1.1 19.3 3.1 27.4 4.4 26.3 4.3 42 11.3 53.4 23.8 6.4 7 9.9 12.9 12.9 21.8 7.4 21.7 5.4 47.7-5.2 65.9-5.2 8.9-17.1 20.5-26.7 25.9-18.3 10.4-39.5 14.8-66.6 13.7-35.9-1.3-57.4-9.2-80.9-29.6l-5.1-4.5 13.4-13.4 13.4-13.4 5.9 5.1c10.3 8.9 21.8 14.5 36.7 17.9 10.1 2.3 36.7 2.3 45.9 0 22.3-5.6 33.7-18.7 33.7-38.8 0-17.8-9.4-30.6-26-35.3-3-.8-16.3-3.1-29.5-5.1-26.3-3.8-26.2-3.8-35.5-6.7-24.7-7.8-40.5-23.3-46.7-45.9-2.5-9-2.5-32.8 0-41.9 5.5-20.4 18.4-36.5 36.7-45.9 10.7-5.5 19.5-8.1 35-10.5 5.5-.8 26.1-.5 34 .5zm1792 0c11 1.3 22.8 4.3 31.3 8 7.6 3.2 21.1 11.7 27.2 17.2l4 3.6-12.6 12.7-12.7 12.6-5.3-4.2c-10.2-8.1-22.2-12.9-37.2-14.9-23.8-3.3-42.6 1.4-53.6 13.4-7 7.8-9.5 14.5-9.5 26.5-.1 8.5.2 10.1 2.7 15.2 5.8 11.8 17.7 18.4 39.5 21.9 7 1.1 19.3 3.1 27.4 4.4 26.3 4.3 42 11.3 53.4 23.8 6.4 7 9.9 12.9 12.9 21.8 7.4 21.7 5.4 47.7-5.2 65.9-5.2 8.9-17.1 20.5-26.7 25.9-18.3 10.4-39.5 14.8-66.6 13.7-35.9-1.3-57.4-9.2-80.9-29.6l-5.1-4.5 13.4-13.4 13.4-13.4 5.9 5.1c10.3 8.9 21.8 14.5 36.7 17.9 10.1 2.3 36.7 2.3 45.9 0 22.3-5.6 33.7-18.7 33.7-38.8 0-17.8-9.4-30.6-26-35.3-3-.8-16.3-3.1-29.5-5.1-26.3-3.8-26.2-3.8-35.5-6.7-24.7-7.8-40.5-23.3-46.7-45.9-2.5-9-2.5-32.8 0-41.9 5.5-20.4 18.4-36.5 36.7-45.9 10.7-5.5 19.5-8.1 35-10.5 5.5-.8 26.1-.5 34 .5zm308 0c11 1.3 22.8 4.3 31.3 8 7.6 3.2 21.1 11.7 27.2 17.2l4 3.6-12.6 12.7-12.7 12.6-5.3-4.2c-10.2-8.1-22.2-12.9-37.2-14.9-23.8-3.3-42.6 1.4-53.6 13.4-7 7.8-9.5 14.5-9.5 26.5-.1 8.5.2 10.1 2.7 15.2 5.8 11.8 17.7 18.4 39.5 21.9 7 1.1 19.3 3.1 27.4 4.4 26.3 4.3 42 11.3 53.4 23.8 6.4 7 9.9 12.9 12.9 21.8 7.4 21.7 5.4 47.7-5.2 65.9-5.2 8.9-17.1 20.5-26.7 25.9-18.3 10.4-39.5 14.8-66.6 13.7-35.9-1.3-57.4-9.2-80.9-29.6l-5.1-4.5 13.4-13.4 13.4-13.4 5.9 5.1c10.3 8.9 21.8 14.5 36.7 17.9 10.1 2.3 36.7 2.3 45.9 0 22.3-5.6 33.7-18.7 33.7-38.8 0-17.8-9.4-30.6-26-35.3-3-.8-16.3-3.1-29.5-5.1-26.3-3.8-26.2-3.8-35.5-6.7-24.7-7.8-40.5-23.3-46.7-45.9-2.5-9-2.5-32.8 0-41.9 5.5-20.4 18.4-36.5 36.7-45.9 10.7-5.5 19.5-8.1 35-10.5 5.5-.8 26.1-.5 34 .5zm435.8 1.3c26.3 6.5 50.2 24.6 60.7 45.9 9 18.3 10.5 30.5 10.5 86.2 0 41.7-.9 56.7-4.1 69.5-7.5 30-33.7 54.2-67.7 62.7-10.3 2.6-38.1 2.3-48.3-.5-17.7-4.8-31.4-12.6-44-25.2-9.3-9.3-14.4-17-18.6-28-6.4-17.1-6.8-21.8-6.8-78.5s.4-61.4 6.8-78.5c10.5-27.9 39.1-50 71.2-55 8.3-1.3 32.7-.4 40.3 1.4zm-2330.6 81.1c20.9 44.5 38.2 81.3 38.6 81.7.4.4 17.6-36.2 38.2-81.2l37.5-81.9 20.3-.1H861v265h-40l-.2-88.1-.3-88.2-30.1 63.9-30.1 63.9h-30.4l-30.7-63.6-30.7-63.7-.3 87.9-.2 87.9h-40v-265l20.2.2 20.1.3 37.9 81zm369.2 49.8c26.4 72.1 48.2 131.8 48.4 132.4.3 1-4.3 1.3-21 1.3h-21.3l-9.1-26.3-9-26.2-52.1-.3-52.1-.2-1.6 4.2c-2 5.6-16.6 48-16.6 48.5 0 .2-9.7.3-21.6.3-20.2 0-21.6-.1-20.9-1.8.3-.9 21.7-59.3 47.5-129.7 25.8-70.4 47.3-129.2 47.9-130.8l1.1-2.7h32.5l47.9 131.3zm214.1-128.4c27.3 7.6 45.4 24.9 53.7 51.1 2 6.6 2.3 9.4 2.2 23.5 0 14.6-.2 16.7-2.7 24-4.6 13.8-12.7 25.5-23.1 33.3-6.4 4.7-21.2 12.2-24.1 12.2-1.2 0-1.5.5-1.1 1.7.4 1 14 27.3 30.1 58.5 16.2 31.2 29.5 57 29.5 57.3 0 .3-10.5.5-23.3.5h-23.2l-28-56-28-56H1202v112h-40v-265.1l59.8.4c58.1.3 59.9.4 67.7 2.6zM1567 2469v18h-73v229h-40v-229h-73v-36h186v18zm264.5-15.2c28.7 8 46.6 26.3 52.1 53.1 2.2 11 1.5 28-1.5 36.4-5.2 14.8-15.2 27.4-26.4 33.2l-5.6 2.9 5.1 2.8c12.7 6.9 21.6 16.2 27.4 28.3 5.2 10.7 6.7 19.6 6.1 35-.9 22.4-5.9 34.7-19.7 48.6-6.9 7.1-10 9.4-17 12.7-4.7 2.3-12.3 5.1-17 6.4-8.3 2.1-10.1 2.2-70.2 2.5l-61.8.4v-265.2l60.3.3c58.7.4 60.4.4 68.2 2.6zm153.7 90.9l.3 93.8 2.8 7.8c6.7 19.1 19 30.1 38.3 34.2 24.9 5.3 50.2-5.2 60.2-25.1 7.1-14.1 6.6-6.7 7-110.7l.3-93.7h40l-.3 96.7-.3 96.8-2.8 8.8c-5.2 16.7-12.7 28.9-25 40.3-31.8 29.6-87.8 32.7-124.3 6.9-18.1-12.9-31.3-34.2-35.3-56.9-.7-3.9-1.1-38.5-1.1-99.3V2451h39.9l.3 93.7zM2889 2469v18h-73v229h-40v-229h-73v-36h186v18zm404.5-15.2c28.7 8 48.8 27.3 56.5 54.2 3.3 11.5 3.8 28.9 1.2 41.3-5 24-19.3 42.8-40.7 53.2-17.1 8.4-19.6 8.8-63.7 9.3l-38.8.4V2716h-40v-265.1l58.8.3c57 .4 58.9.5 66.7 2.6z"/><path d="M2999.2 2487c-10.5 2.8-18.3 7.3-25.1 14.6-10.1 10.8-13.3 20.2-15.1 45.1-2.1 29.2-.8 78.7 2.4 94.3 2.1 9.7 5.9 17.2 12.7 24.4 6.9 7.4 14.7 11.9 25.5 14.6 9.8 2.5 17 2.5 26.8 0 10.8-2.7 18.6-7.2 25.5-14.6 10.1-10.8 13.3-20.2 15.1-45.1 2.1-29.2.8-78.7-2.4-94.3-2.1-9.7-5.9-17.2-12.7-24.4-6.9-7.4-14.7-11.9-25.5-14.6-9.6-2.5-17.7-2.5-27.2 0zM991.6 2569.7c-10.9 31.3-20.1 57.4-20.3 58-.4 1 8 1.3 40.2 1.3s40.6-.3 40.2-1.3c-.2-.6-9.1-26.7-19.7-58-10.7-31.2-19.6-56.7-19.9-56.7-.4 0-9.6 25.5-20.5 56.7zM1202 2528.6v41.6l35.8-.4c33.2-.4 36.1-.6 41.3-2.5 15.5-5.8 24-16.1 26.2-31.9 2.7-18.7-5.1-35.2-20.4-42.9-9.4-4.8-15.6-5.5-50.6-5.5H1202v41.6zM1743 2525v38h32.3c42.2 0 49.4-1.5 59.9-12.2 6.7-6.9 9.2-13.8 9.2-25.8 0-7.5-.5-10.7-2.3-15.3-2.8-7-9.7-14.4-16.5-17.6-9.5-4.4-15.9-5.1-50.3-5.1H1743v38zM1743 2639.5v40.6l37.3-.3c35.8-.3 37.4-.4 42.8-2.6 17.4-7 25.2-18.4 25.3-37.2.1-10.9-1-15.3-5.6-23-4-6.5-11.1-12.2-19.3-15.2-5.7-2.1-7.8-2.2-43.2-2.6l-37.3-.3v40.6zM3208 2531v44h33.8c27.1 0 34.9-.3 39.7-1.5 21.8-5.7 34.1-25.6 30.6-49.4-2.8-18.9-14.9-31.6-33.9-35.7-5-1-15-1.4-38.4-1.4H3208v44z"/></svg> \ No newline at end of file diff --git a/static/site.webmanifest b/static/site.webmanifest new file mode 100644 index 0000000000000000000000000000000000000000..1e511ab7256a397be3519f9576930648e7b59dc9 --- /dev/null +++ b/static/site.webmanifest @@ -0,0 +1,20 @@ +{ + "name": "Smart Bus Stop", + "short_name": "Smart Bus Stop", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#bfc0c2", + "background_color": "#bfc0c2", + "display": "standalone", + "orientation": "landscape" +} diff --git a/templates/internal/base.html b/templates/internal/base.html index 0bd960a4aeda15d81ba7f8ab539ec66ef490f2c8..6c40f2add4816ab41e5b4ffc080e9e8b338ae691 100644 --- a/templates/internal/base.html +++ b/templates/internal/base.html @@ -20,6 +20,19 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <!-- Favicons --> + <link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('root/favicon32', _external = True) }}"> + <link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('root/favicon16', _external = True) }}"> + <!-- Web App Manifest --> + <link rel="manifest" href="{{ url_for('root/manifest', _external = True) }}"> + <!-- Apple and Windows phone specific icons --> + <link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('root/touch-icon', _external = True) }}"> + <link rel="mask-icon" href="{{ url_for('root/mask-icon', _external = True) }}" color="#f7ac00"> + <meta name="apple-mobile-web-app-title" content="Smart Bus Stop"> + <meta name="application-name" content="Smart Bus Stop"> + <meta name="msapplication-TileColor" content="#bfc0c2"> + <meta name="theme-color" content="#bfc0c2"> + <!-- Bootstrap CSS --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">