API & Client - update map attribution to match tile server - fix #54

This commit is contained in:
Sam 2020-09-16 13:01:15 +02:00
parent a5e40612ba
commit a5a2033918
16 changed files with 242 additions and 123 deletions

View File

@ -1,5 +1,16 @@
# Change log
## Version 0.x.x (unreleased)
### Issues Closed
#### New Features
* [#54](https://github.com/SamR1/Fittrackee/issues/54) - Tile server can be changed
In this release 1 issue weas closed.
## Version 0.3.0 - Administration (2020/07/15)
This version introduces some major changes:

View File

@ -2,6 +2,7 @@ WORKERS_PROCESSES = 1
export REACT_APP_API_URL=
export TILE_SERVER_URL=
export MAP_ATTRIBUTION=
export WEATHER_API=
export UI_URL=
export EMAIL_URL=

View File

@ -1,5 +1,16 @@
# Change log
## Version 0.x.x (unreleased)
### Issues Closed
#### New Features
* [#54](https://github.com/SamR1/Fittrackee/issues/54) - Tile server can be changed
In this release 1 issue weas closed.
## Version 0.3.0 - Administration (2020/07/15)
This version introduces some major changes:

View File

@ -185,22 +185,23 @@ The following environment variables must be defined in **Makefile.custom.config*
.. cssclass:: table-bordered table-striped
===================================== ======================================== ====================================
variable description app default value
===================================== ======================================== ====================================
``REACT_APP_API_URL`` Fittrackee API URL no default value, must be initialized
``REACT_APP_GPX_LIMIT_IMPORT`` max. number of gpx file in zip archive 10 (*deprecated in 0.3.0*)
``REACT_APP_MAX_SINGLE_FILE_SIZE`` max. size of a gpx or picture file 1MB (*deprecated in 0.3.0*)
``REACT_APP_MAX_ZIP_FILE_SIZE`` max. size of a zip archive 10MB (*deprecated in 0.3.0*)
``REACT_APP_ALLOW_REGISTRATION`` allows users to register true (*deprecated in 0.3.0*)
``REACT_APP_THUNDERFOREST_API_KEY`` ThunderForest API key (*deprecated*, use ``TILE_SERVER_URL`` instead)
``TILE_SERVER_URL`` Tile server URL (with api key if needed) ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``
``UI_URL`` application URL no default value, must be initialized
``EMAIL_URL`` email URL with credentials no default value, must be initialized (see below)
``SENDER_EMAIL`` application sender email address no default value, must be initialized
``REDIS_URL`` Redis instance used by Dramatiq local Redis instance
``WORKERS_PROCESSES`` number of process used by Dramatiq no default value, must be initialized
===================================== ======================================== ====================================
===================================== ============================================== ====================================
variable description app default value
===================================== ============================================== ====================================
``REACT_APP_API_URL`` Fittrackee API URL no default value, must be initialized
``REACT_APP_GPX_LIMIT_IMPORT`` max. number of gpx file in zip archive 10 (*deprecated in 0.3.0*)
``REACT_APP_MAX_SINGLE_FILE_SIZE`` max. size of a gpx or picture file 1MB (*deprecated in 0.3.0*)
``REACT_APP_MAX_ZIP_FILE_SIZE`` max. size of a zip archive 10MB (*deprecated in 0.3.0*)
``REACT_APP_ALLOW_REGISTRATION`` allows users to register true (*deprecated in 0.3.0*)
``REACT_APP_THUNDERFOREST_API_KEY`` ThunderForest API key (*deprecated in 0.x.x*, use ``TILE_SERVER_URL`` **and** ``MAP_ATTRIBUTION`` instead)
``TILE_SERVER_URL`` Tile server URL (with api key if needed) ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``
``MAP_ATTRIBUTION`` Map attribution (if using another tile server) ``&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors``
``UI_URL`` application URL no default value, must be initialized
``EMAIL_URL`` email URL with credentials no default value, must be initialized (see below)
``SENDER_EMAIL`` application sender email address no default value, must be initialized
``REDIS_URL`` Redis instance used by Dramatiq local Redis instance
``WORKERS_PROCESSES`` number of process used by Dramatiq no default value, must be initialized
===================================== ============================================== ====================================
.. warning::
Since FitTrackee 0.3.0, some applications parameters are now stored in database.
@ -208,9 +209,26 @@ variable description a
Emails
^^^^^^
*new in 0.3.0*
To send emails, a valid ``EMAIL_URL`` must be provided:
- with an unencrypted SMTP server: ``smtp://username:password@smtp.example.com:25``
- with SSL: ``smtp://username:password@smtp.example.com:465/?ssl=True``
- with STARTTLS: ``smtp://username:password@smtp.example.com:587/?tls=True``
- with STARTTLS: ``smtp://username:password@smtp.example.com:587/?tls=True``
Map tile server
^^^^^^^^^^^^^^^
*new in 0.x.x*
Default tile server is now **OpenStreetMap**'s standard tile layer (if environment variables are not initialized).
The tile server can be changed by updating ``TILE_SERVER_URL`` and ``MAP_ATTRIBUTION`` variables (`list of tile servers <https://wiki.openstreetmap.org/wiki/Tile_servers>`__).
To keep using ThunderForest Outdoors, the configuration is:
- ``TILE_SERVER_URL=https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=XXXX`` where **XXXX** is ThunderForest API key
- ``MAP_ATTRIBUTION=&copy; <a href="http://www.thunderforest.com/">Thunderforest</a>, &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors``
.. note::
Check the terms of service of tile provider for map attribution

View File

@ -76,67 +76,74 @@
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">Change log</a><ul>
<li><a class="reference internal" href="#version-0-3-0-administration-2020-07-15">Version 0.3.0 - Administration (2020/07/15)</a><ul>
<li><a class="reference internal" href="#version-0-x-x-unreleased">Version 0.x.x (unreleased)</a><ul>
<li><a class="reference internal" href="#issues-closed">Issues Closed</a><ul>
<li><a class="reference internal" href="#new-features">New Features</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-3-0-administration-2020-07-15">Version 0.3.0 - Administration (2020/07/15)</a><ul>
<li><a class="reference internal" href="#id1">Issues Closed</a><ul>
<li><a class="reference internal" href="#id2">New Features</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-2-5-fix-and-improvements-2020-01-31">Version 0.2.5 - Fix and improvements (2020/01/31)</a><ul>
<li><a class="reference internal" href="#misc">Misc</a></li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-2-4-minor-fix-2020-01-30">Version 0.2.4 - Minor fix (2020/01/30)</a><ul>
<li><a class="reference internal" href="#id1">Issues Closed</a><ul>
<li><a class="reference internal" href="#id3">Issues Closed</a><ul>
<li><a class="reference internal" href="#bugs-fixed">Bugs Fixed</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-2-3-fittrackee-available-in-french-2019-12-29">Version 0.2.3 - FitTrackee available in French (2019/12/29)</a><ul>
<li><a class="reference internal" href="#id2">Issues Closed</a><ul>
<li><a class="reference internal" href="#id3">New Features</a></li>
<li><a class="reference internal" href="#id4">Bugs Fixed</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-2-2-statistics-fix-2019-09-23">Version 0.2.2 - Statistics fix (2019/09/23)</a><ul>
<li><a class="reference internal" href="#id5">Issues Closed</a><ul>
<li><a class="reference internal" href="#id4">Issues Closed</a><ul>
<li><a class="reference internal" href="#id5">New Features</a></li>
<li><a class="reference internal" href="#id6">Bugs Fixed</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-2-1-fix-and-improvements-2019-09-01">Version 0.2.1 - Fix and improvements (2019/09/01)</a><ul>
<li><a class="reference internal" href="#version-0-2-2-statistics-fix-2019-09-23">Version 0.2.2 - Statistics fix (2019/09/23)</a><ul>
<li><a class="reference internal" href="#id7">Issues Closed</a><ul>
<li><a class="reference internal" href="#id8">New Features</a></li>
<li><a class="reference internal" href="#id9">Bugs Fixed</a></li>
<li><a class="reference internal" href="#id8">Bugs Fixed</a></li>
</ul>
</li>
<li><a class="reference internal" href="#id10">Misc</a></li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-2-1-fix-and-improvements-2019-09-01">Version 0.2.1 - Fix and improvements (2019/09/01)</a><ul>
<li><a class="reference internal" href="#id9">Issues Closed</a><ul>
<li><a class="reference internal" href="#id10">New Features</a></li>
<li><a class="reference internal" href="#id11">Bugs Fixed</a></li>
</ul>
</li>
<li><a class="reference internal" href="#id12">Misc</a></li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-2-0-statistics-2019-07-07">Version 0.2.0 - Statistics (2019/07/07)</a><ul>
<li><a class="reference internal" href="#id11">Issues Closed</a><ul>
<li><a class="reference internal" href="#id12">New Features</a></li>
<li><a class="reference internal" href="#id13">Issues Closed</a><ul>
<li><a class="reference internal" href="#id14">New Features</a></li>
</ul>
</li>
<li><a class="reference internal" href="#id13">Misc</a></li>
<li><a class="reference internal" href="#id15">Misc</a></li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-1-1-fix-and-improvements-2019-02-07">Version 0.1.1 - Fix and improvements (2019/02/07)</a><ul>
<li><a class="reference internal" href="#id14">Issues Closed</a><ul>
<li><a class="reference internal" href="#id15">New Features</a></li>
<li><a class="reference internal" href="#id16">Bugs Fixed</a></li>
<li><a class="reference internal" href="#id16">Issues Closed</a><ul>
<li><a class="reference internal" href="#id17">New Features</a></li>
<li><a class="reference internal" href="#id18">Bugs Fixed</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#version-0-1-0-first-release-2018-07-04">Version 0.1.0 - First release 🎉 (2018-07-04)</a><ul>
<li><a class="reference internal" href="#id17">Issues Closed</a><ul>
<li><a class="reference internal" href="#id18">New Features</a></li>
<li><a class="reference internal" href="#id19">Issues Closed</a><ul>
<li><a class="reference internal" href="#id20">New Features</a></li>
</ul>
</li>
</ul>
@ -188,6 +195,19 @@
<div class="section" id="change-log">
<h1>Change log<a class="headerlink" href="#change-log" title="Permalink to this headline"></a></h1>
<div class="section" id="version-0-x-x-unreleased">
<h2>Version 0.x.x (unreleased)<a class="headerlink" href="#version-0-x-x-unreleased" title="Permalink to this headline"></a></h2>
<div class="section" id="issues-closed">
<h3>Issues Closed<a class="headerlink" href="#issues-closed" title="Permalink to this headline"></a></h3>
<div class="section" id="new-features">
<h4>New Features<a class="headerlink" href="#new-features" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/54">#54</a> - Tile server can be changed</p></li>
</ul>
<p>In this release 1 issue weas closed.</p>
</div>
</div>
</div>
<div class="section" id="version-0-3-0-administration-2020-07-15">
<h2>Version 0.3.0 - Administration (2020/07/15)<a class="headerlink" href="#version-0-3-0-administration-2020-07-15" title="Permalink to this headline"></a></h2>
<p>This version introduces some major changes:</p>
@ -195,10 +215,10 @@
<li><p>FitTrackee administration is now available (see <a class="reference external" href="https://samr1.github.io/FitTrackee/features.html#administration">documentation</a>)<br />⚠️ Warning: some application parameters move from environment variables to database (see <a class="reference external" href="https://samr1.github.io/FitTrackee/installation.html#environment-variables">installation</a>).</p></li>
<li><p>in order to send emails, Redis is now a mandatory dependency</p></li>
</ul>
<div class="section" id="issues-closed">
<h3>Issues Closed<a class="headerlink" href="#issues-closed" title="Permalink to this headline"></a></h3>
<div class="section" id="new-features">
<h4>New Features<a class="headerlink" href="#new-features" title="Permalink to this headline"></a></h4>
<div class="section" id="id1">
<h3>Issues Closed<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<div class="section" id="id2">
<h4>New Features<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/50">#50</a> - A user can reset his password</p></li>
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/17">#17</a> - A user can delete his account</p></li>
@ -224,8 +244,8 @@ add URL interceptors to simplify routes definition</p></li>
</div>
<div class="section" id="version-0-2-4-minor-fix-2020-01-30">
<h2>Version 0.2.4 - Minor fix (2020/01/30)<a class="headerlink" href="#version-0-2-4-minor-fix-2020-01-30" title="Permalink to this headline"></a></h2>
<div class="section" id="id1">
<h3>Issues Closed<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<div class="section" id="id3">
<h3>Issues Closed<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
<div class="section" id="bugs-fixed">
<h4>Bugs Fixed<a class="headerlink" href="#bugs-fixed" title="Permalink to this headline"></a></h4>
<ul class="simple">
@ -238,17 +258,17 @@ add URL interceptors to simplify routes definition</p></li>
</div>
<div class="section" id="version-0-2-3-fittrackee-available-in-french-2019-12-29">
<h2>Version 0.2.3 - FitTrackee available in French (2019/12/29)<a class="headerlink" href="#version-0-2-3-fittrackee-available-in-french-2019-12-29" title="Permalink to this headline"></a></h2>
<div class="section" id="id2">
<h3>Issues Closed<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<div class="section" id="id3">
<h4>New Features<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h4>
<div class="section" id="id4">
<h3>Issues Closed<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h3>
<div class="section" id="id5">
<h4>New Features<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/43">#43</a> - Display weekend days with a different background color on calendar</p></li>
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/40">#40</a> - Localize FitTrackee (i18n)</p></li>
</ul>
</div>
<div class="section" id="id4">
<h4>Bugs Fixed<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h4>
<div class="section" id="id6">
<h4>Bugs Fixed<a class="headerlink" href="#id6" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/44">#44</a> - Cannot edit an activity that does not have a gpx file</p></li>
</ul>
@ -258,10 +278,10 @@ add URL interceptors to simplify routes definition</p></li>
</div>
<div class="section" id="version-0-2-2-statistics-fix-2019-09-23">
<h2>Version 0.2.2 - Statistics fix (2019/09/23)<a class="headerlink" href="#version-0-2-2-statistics-fix-2019-09-23" title="Permalink to this headline"></a></h2>
<div class="section" id="id5">
<h3>Issues Closed<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h3>
<div class="section" id="id6">
<h4>Bugs Fixed<a class="headerlink" href="#id6" title="Permalink to this headline"></a></h4>
<div class="section" id="id7">
<h3>Issues Closed<a class="headerlink" href="#id7" title="Permalink to this headline"></a></h3>
<div class="section" id="id8">
<h4>Bugs Fixed<a class="headerlink" href="#id8" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/41">#41</a> - User statistics are incorrect</p></li>
</ul>
@ -271,10 +291,10 @@ add URL interceptors to simplify routes definition</p></li>
</div>
<div class="section" id="version-0-2-1-fix-and-improvements-2019-09-01">
<h2>Version 0.2.1 - Fix and improvements (2019/09/01)<a class="headerlink" href="#version-0-2-1-fix-and-improvements-2019-09-01" title="Permalink to this headline"></a></h2>
<div class="section" id="id7">
<h3>Issues Closed<a class="headerlink" href="#id7" title="Permalink to this headline"></a></h3>
<div class="section" id="id8">
<h4>New Features<a class="headerlink" href="#id8" title="Permalink to this headline"></a></h4>
<div class="section" id="id9">
<h3>Issues Closed<a class="headerlink" href="#id9" title="Permalink to this headline"></a></h3>
<div class="section" id="id10">
<h4>New Features<a class="headerlink" href="#id10" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/4">#4</a> - Show points on the map when mouse over the chart</p></li>
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/14">#14</a> - Display segments informations</p></li>
@ -285,15 +305,15 @@ add URL interceptors to simplify routes definition</p></li>
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/37">#37</a> - Display map on activities list</p></li>
</ul>
</div>
<div class="section" id="id9">
<h4>Bugs Fixed<a class="headerlink" href="#id9" title="Permalink to this headline"></a></h4>
<div class="section" id="id11">
<h4>Bugs Fixed<a class="headerlink" href="#id11" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/34">#34</a> - Weather is not displayed anymore</p></li>
</ul>
</div>
</div>
<div class="section" id="id10">
<h3>Misc<a class="headerlink" href="#id10" title="Permalink to this headline"></a></h3>
<div class="section" id="id12">
<h3>Misc<a class="headerlink" href="#id12" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><strong><a class="reference external" href="https://poetry.eustace.io/">Poetry</a></strong> replaces <strong><a class="reference external" href="https://docs.pipenv.org">pipenv</a></strong> for Python packages management</p></li>
</ul>
@ -302,17 +322,17 @@ add URL interceptors to simplify routes definition</p></li>
</div>
<div class="section" id="version-0-2-0-statistics-2019-07-07">
<h2>Version 0.2.0 - Statistics (2019/07/07)<a class="headerlink" href="#version-0-2-0-statistics-2019-07-07" title="Permalink to this headline"></a></h2>
<div class="section" id="id11">
<h3>Issues Closed<a class="headerlink" href="#id11" title="Permalink to this headline"></a></h3>
<div class="section" id="id12">
<h4>New Features<a class="headerlink" href="#id12" title="Permalink to this headline"></a></h4>
<div class="section" id="id13">
<h3>Issues Closed<a class="headerlink" href="#id13" title="Permalink to this headline"></a></h3>
<div class="section" id="id14">
<h4>New Features<a class="headerlink" href="#id14" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/Fittrackee/issues/13">#13</a> - Detailed statistics</p></li>
</ul>
</div>
</div>
<div class="section" id="id13">
<h3>Misc<a class="headerlink" href="#id13" title="Permalink to this headline"></a></h3>
<div class="section" id="id15">
<h3>Misc<a class="headerlink" href="#id15" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Update dependencies</p></li>
</ul>
@ -321,17 +341,17 @@ add URL interceptors to simplify routes definition</p></li>
</div>
<div class="section" id="version-0-1-1-fix-and-improvements-2019-02-07">
<h2>Version 0.1.1 - Fix and improvements (2019/02/07)<a class="headerlink" href="#version-0-1-1-fix-and-improvements-2019-02-07" title="Permalink to this headline"></a></h2>
<div class="section" id="id14">
<h3>Issues Closed<a class="headerlink" href="#id14" title="Permalink to this headline"></a></h3>
<div class="section" id="id15">
<h4>New Features<a class="headerlink" href="#id15" title="Permalink to this headline"></a></h4>
<div class="section" id="id16">
<h3>Issues Closed<a class="headerlink" href="#id16" title="Permalink to this headline"></a></h3>
<div class="section" id="id17">
<h4>New Features<a class="headerlink" href="#id17" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/FitTrackee/issues/25">#25</a> - Display records on calendar</p></li>
<li><p><a class="reference external" href="https://github.com/SamR1/FitTrackee/issues/22">#22</a> - Add a total on current month statistics</p></li>
</ul>
</div>
<div class="section" id="id16">
<h4>Bugs Fixed<a class="headerlink" href="#id16" title="Permalink to this headline"></a></h4>
<div class="section" id="id18">
<h4>Bugs Fixed<a class="headerlink" href="#id18" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/FitTrackee/issues/31">#31</a> - Use moving duration for stats</p></li>
<li><p><a class="reference external" href="https://github.com/SamR1/FitTrackee/issues/29">#29</a> - Pause duration calculation with segments</p></li>
@ -380,10 +400,10 @@ add URL interceptors to simplify routes definition</p></li>
<li><p>no administration for now</p></li>
</ul>
<p>➡️ more informations: see <a class="reference external" href="https://samr1.github.io/FitTrackee/">documentation</a> and <a class="reference external" href="https://github.com/SamR1/FitTrackee/issues">current issues</a></p>
<div class="section" id="id17">
<h3>Issues Closed<a class="headerlink" href="#id17" title="Permalink to this headline"></a></h3>
<div class="section" id="id18">
<h4>New Features<a class="headerlink" href="#id18" title="Permalink to this headline"></a></h4>
<div class="section" id="id19">
<h3>Issues Closed<a class="headerlink" href="#id19" title="Permalink to this headline"></a></h3>
<div class="section" id="id20">
<h4>New Features<a class="headerlink" href="#id20" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SamR1/FitTrackee/issues/11">#11</a> - Timezone support</p></li>
<li><p><a class="reference external" href="https://github.com/SamR1/FitTrackee/issues/10">#10</a> - Add a note to an activity</p></li>

View File

@ -185,6 +185,7 @@ Map</a>.</div>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Change log</a><ul>
<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-x-x-unreleased">Version 0.x.x (unreleased)</a></li>
<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-3-0-administration-2020-07-15">Version 0.3.0 - Administration (2020/07/15)</a></li>
<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-2-5-fix-and-improvements-2020-01-31">Version 0.2.5 - Fix and improvements (2020/01/31)</a></li>
<li class="toctree-l2"><a class="reference internal" href="changelog.html#version-0-2-4-minor-fix-2020-01-30">Version 0.2.4 - Minor fix (2020/01/30)</a></li>

View File

@ -90,6 +90,7 @@
</li>
<li><a class="reference internal" href="#environment-variables">Environment variables</a><ul>
<li><a class="reference internal" href="#emails">Emails</a></li>
<li><a class="reference internal" href="#map-tile-server">Map tile server</a></li>
</ul>
</li>
</ul>
@ -328,9 +329,9 @@ $ make upgrade-db
<p>The following environment variables must be defined in <strong>Makefile.custom.config</strong>:</p>
<table class="table-bordered table-striped docutils align-default">
<colgroup>
<col style="width: 28%" />
<col style="width: 31%" />
<col style="width: 41%" />
<col style="width: 17%" />
<col style="width: 21%" />
<col style="width: 61%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>variable</p></th>
@ -361,29 +362,33 @@ $ make upgrade-db
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">REACT_APP_THUNDERFOREST_API_KEY</span></code></p></td>
<td><p>ThunderForest API key</p></td>
<td><p>(<em>deprecated</em>, use <code class="docutils literal notranslate"><span class="pre">TILE_SERVER_URL</span></code> instead)</p></td>
<td><p>(<em>deprecated in 0.x.x</em>, use <code class="docutils literal notranslate"><span class="pre">TILE_SERVER_URL</span></code> <strong>and</strong> <code class="docutils literal notranslate"><span class="pre">MAP_ATTRIBUTION</span></code> instead)</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">TILE_SERVER_URL</span></code></p></td>
<td><p>Tile server URL (with api key if needed)</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">UI_URL</span></code></p></td>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">MAP_ATTRIBUTION</span></code></p></td>
<td><p>Map attribution (if using another tile server)</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">&amp;copy;</span> <span class="pre">&lt;a</span> <span class="pre">href=&quot;http://www.openstreetmap.org/copyright&quot;</span> <span class="pre">target=&quot;_blank&quot;</span> <span class="pre">rel=&quot;noopener</span> <span class="pre">noreferrer&quot;&gt;OpenStreetMap&lt;/a&gt;</span> <span class="pre">contributors</span></code></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">UI_URL</span></code></p></td>
<td><p>application URL</p></td>
<td><p>no default value, must be initialized</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">EMAIL_URL</span></code></p></td>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">EMAIL_URL</span></code></p></td>
<td><p>email URL with credentials</p></td>
<td><p>no default value, must be initialized (see below)</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">SENDER_EMAIL</span></code></p></td>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">SENDER_EMAIL</span></code></p></td>
<td><p>application sender email address</p></td>
<td><p>no default value, must be initialized</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">REDIS_URL</span></code></p></td>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">REDIS_URL</span></code></p></td>
<td><p>Redis instance used by Dramatiq</p></td>
<td><p>local Redis instance</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">WORKERS_PROCESSES</span></code></p></td>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">WORKERS_PROCESSES</span></code></p></td>
<td><p>number of process used by Dramatiq</p></td>
<td><p>no default value, must be initialized</p></td>
</tr>
@ -396,6 +401,7 @@ Related environment variables are needed to initialize database.</p>
</div>
<div class="section" id="emails">
<h3>Emails<a class="headerlink" href="#emails" title="Permalink to this headline"></a></h3>
<p><em>new in 0.3.0</em></p>
<p>To send emails, a valid <code class="docutils literal notranslate"><span class="pre">EMAIL_URL</span></code> must be provided:</p>
<ul class="simple">
<li><p>with an unencrypted SMTP server: <code class="docutils literal notranslate"><span class="pre">smtp://username:password&#64;smtp.example.com:25</span></code></p></li>
@ -403,6 +409,21 @@ Related environment variables are needed to initialize database.</p>
<li><p>with STARTTLS: <code class="docutils literal notranslate"><span class="pre">smtp://username:password&#64;smtp.example.com:587/?tls=True</span></code></p></li>
</ul>
</div>
<div class="section" id="map-tile-server">
<h3>Map tile server<a class="headerlink" href="#map-tile-server" title="Permalink to this headline"></a></h3>
<p><em>new in 0.x.x</em></p>
<p>Default tile server is now <strong>OpenStreetMap</strong>s standard tile layer (if environment variables are not initialized).
The tile server can be changed by updating <code class="docutils literal notranslate"><span class="pre">TILE_SERVER_URL</span></code> and <code class="docutils literal notranslate"><span class="pre">MAP_ATTRIBUTION</span></code> variables (<a class="reference external" href="https://wiki.openstreetmap.org/wiki/Tile_servers">list of tile servers</a>).</p>
<p>To keep using ThunderForest Outdoors, the configuration is:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">TILE_SERVER_URL=https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=XXXX</span></code> where <strong>XXXX</strong> is ThunderForest API key</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">MAP_ATTRIBUTION=&amp;copy;</span> <span class="pre">&lt;a</span> <span class="pre">href=&quot;http://www.thunderforest.com/&quot;&gt;Thunderforest&lt;/a&gt;,</span> <span class="pre">&amp;copy;</span> <span class="pre">&lt;a</span> <span class="pre">href=&quot;http://www.openstreetmap.org/copyright&quot;&gt;OpenStreetMap&lt;/a&gt;</span> <span class="pre">contributors</span></code></p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Check the terms of service of tile provider for map attribution</p>
</div>
</div>
</div>
</div>

File diff suppressed because one or more lines are too long

View File

@ -185,22 +185,23 @@ The following environment variables must be defined in **Makefile.custom.config*
.. cssclass:: table-bordered table-striped
===================================== ======================================== ====================================
variable description app default value
===================================== ======================================== ====================================
``REACT_APP_API_URL`` Fittrackee API URL no default value, must be initialized
``REACT_APP_GPX_LIMIT_IMPORT`` max. number of gpx file in zip archive 10 (*deprecated in 0.3.0*)
``REACT_APP_MAX_SINGLE_FILE_SIZE`` max. size of a gpx or picture file 1MB (*deprecated in 0.3.0*)
``REACT_APP_MAX_ZIP_FILE_SIZE`` max. size of a zip archive 10MB (*deprecated in 0.3.0*)
``REACT_APP_ALLOW_REGISTRATION`` allows users to register true (*deprecated in 0.3.0*)
``REACT_APP_THUNDERFOREST_API_KEY`` ThunderForest API key (*deprecated*, use ``TILE_SERVER_URL`` instead)
``TILE_SERVER_URL`` Tile server URL (with api key if needed) ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``
``UI_URL`` application URL no default value, must be initialized
``EMAIL_URL`` email URL with credentials no default value, must be initialized (see below)
``SENDER_EMAIL`` application sender email address no default value, must be initialized
``REDIS_URL`` Redis instance used by Dramatiq local Redis instance
``WORKERS_PROCESSES`` number of process used by Dramatiq no default value, must be initialized
===================================== ======================================== ====================================
===================================== ============================================== ====================================
variable description app default value
===================================== ============================================== ====================================
``REACT_APP_API_URL`` Fittrackee API URL no default value, must be initialized
``REACT_APP_GPX_LIMIT_IMPORT`` max. number of gpx file in zip archive 10 (*deprecated in 0.3.0*)
``REACT_APP_MAX_SINGLE_FILE_SIZE`` max. size of a gpx or picture file 1MB (*deprecated in 0.3.0*)
``REACT_APP_MAX_ZIP_FILE_SIZE`` max. size of a zip archive 10MB (*deprecated in 0.3.0*)
``REACT_APP_ALLOW_REGISTRATION`` allows users to register true (*deprecated in 0.3.0*)
``REACT_APP_THUNDERFOREST_API_KEY`` ThunderForest API key (*deprecated in 0.x.x*, use ``TILE_SERVER_URL`` **and** ``MAP_ATTRIBUTION`` instead)
``TILE_SERVER_URL`` Tile server URL (with api key if needed) ``https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png``
``MAP_ATTRIBUTION`` Map attribution (if using another tile server) ``&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors``
``UI_URL`` application URL no default value, must be initialized
``EMAIL_URL`` email URL with credentials no default value, must be initialized (see below)
``SENDER_EMAIL`` application sender email address no default value, must be initialized
``REDIS_URL`` Redis instance used by Dramatiq local Redis instance
``WORKERS_PROCESSES`` number of process used by Dramatiq no default value, must be initialized
===================================== ============================================== ====================================
.. warning::
Since FitTrackee 0.3.0, some applications parameters are now stored in database.
@ -208,9 +209,26 @@ variable description a
Emails
^^^^^^
*new in 0.3.0*
To send emails, a valid ``EMAIL_URL`` must be provided:
- with an unencrypted SMTP server: ``smtp://username:password@smtp.example.com:25``
- with SSL: ``smtp://username:password@smtp.example.com:465/?ssl=True``
- with STARTTLS: ``smtp://username:password@smtp.example.com:587/?tls=True``
- with STARTTLS: ``smtp://username:password@smtp.example.com:587/?tls=True``
Map tile server
^^^^^^^^^^^^^^^
*new in 0.x.x*
Default tile server is now **OpenStreetMap**'s standard tile layer (if environment variables are not initialized).
The tile server can be changed by updating ``TILE_SERVER_URL`` and ``MAP_ATTRIBUTION`` variables (`list of tile servers <https://wiki.openstreetmap.org/wiki/Tile_servers>`__).
To keep using ThunderForest Outdoors, the configuration is:
- ``TILE_SERVER_URL=https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=XXXX`` where **XXXX** is ThunderForest API key
- ``MAP_ATTRIBUTION=&copy; <a href="http://www.thunderforest.com/">Thunderforest</a>, &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors``
.. note::
Check the terms of service of tile provider for map attribution

View File

@ -5,15 +5,7 @@ from datetime import datetime, timedelta
import requests
from fittrackee_api import appLog, db
from flask import (
Blueprint,
Response,
current_app,
jsonify,
request,
send_file,
stream_with_context,
)
from flask import Blueprint, Response, current_app, jsonify, request, send_file
from sqlalchemy import exc
from ..users.utils import (
@ -754,7 +746,7 @@ def get_map_tile(s, z, x, y):
Status codes are status codes returned by tile server
"""
url = current_app.config["TILE_SERVER_URL"].format(s=s, z=z, x=x, y=y)
url = current_app.config['TILE_SERVER']['URL'].format(s=s, z=z, x=x, y=y)
headers = {'User-Agent': 'Mozilla/5.0'}
response = requests.get(url, headers=headers)
return (

View File

@ -20,6 +20,10 @@ class AppConfig(db.Model):
nb_users = User.query.count()
return self.max_users == 0 or nb_users < self.max_users
@property
def map_attribution(self):
return current_app.config['TILE_SERVER']['ATTRIBUTION']
def serialize(self):
return {
"gpx_limit_import": self.gpx_limit_import,
@ -27,6 +31,7 @@ class AppConfig(db.Model):
"max_single_file_size": self.max_single_file_size,
"max_zip_file_size": self.max_zip_file_size,
"max_users": self.max_users,
"map_attribution": self.map_attribution,
}

View File

@ -28,9 +28,18 @@ class BaseConfig:
EMAIL_URL = os.environ.get('EMAIL_URL')
SENDER_EMAIL = os.environ.get('SENDER_EMAIL')
DRAMATIQ_BROKER = broker
TILE_SERVER_URL = os.environ.get(
'TILE_SERVER_URL', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
)
TILE_SERVER = {
'URL': os.environ.get(
'TILE_SERVER_URL',
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
),
'ATTRIBUTION': os.environ.get(
'MAP_ATTRIBUTION',
'&copy; <a href="http://www.openstreetmap.org/copyright" '
'target="_blank" rel="noopener noreferrer">OpenStreetMap</a>'
' contributors',
),
}
class DevelopmentConfig(BaseConfig):

View File

@ -48,6 +48,8 @@ def get_app(with_config=False):
@pytest.fixture
def app(monkeypatch):
monkeypatch.setenv('EMAIL_URL', 'smtp://none:none@0.0.0.0:1025')
monkeypatch.delenv('TILE_SERVER_URL')
monkeypatch.delenv('MAP_ATTRIBUTION')
yield from get_app(with_config=True)

View File

@ -26,6 +26,11 @@ class TestGetConfig:
assert data['data']['max_single_file_size'] == 1048576
assert data['data']['max_zip_file_size'] == 10485760
assert data['data']['max_users'] == 100
assert data['data']['map_attribution'] == (
'&copy; <a href="http://www.openstreetmap.org/copyright" '
'target="_blank" rel="noopener noreferrer">OpenStreetMap</a> '
'contributors'
)
def test_it_returns_error_if_application_has_no_config(
self, app_no_config, user_1_admin

View File

@ -12,3 +12,8 @@ class TestConfigModel:
assert serialized_app_config['max_single_file_size'] == 1048576
assert serialized_app_config['max_zip_file_size'] == 10485760
assert serialized_app_config['max_users'] == 100
assert serialized_app_config['map_attribution'] == (
'&copy; <a href="http://www.openstreetmap.org/copyright" '
'target="_blank" rel="noopener noreferrer">OpenStreetMap</a> '
'contributors'
)

View File

@ -44,7 +44,7 @@ class ActivityMap extends React.Component {
}
render() {
const { activity, coordinates, gpxContent } = this.props
const { activity, coordinates, gpxContent, mapAttribution } = this.props
const { jsonData } = getGeoJson(gpxContent)
const bounds = [
[activity.bounds[0], activity.bounds[1]],
@ -61,9 +61,8 @@ class ActivityMap extends React.Component {
>
<TileLayer
// eslint-disable-next-line max-len
attribution='&copy; <a href="http://www.thunderforest.com/">Thunderforest</a>, &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
attribution={mapAttribution}
url={`${apiUrl}activities/map_tile/{s}/{z}/{x}/{y}.png`}
/>
<GeoJSON
// hash as a key to force re-rendering
@ -85,6 +84,7 @@ class ActivityMap extends React.Component {
export default connect(
state => ({
gpxContent: state.gpx,
mapAttribution: state.application.config.map_attribution,
}),
dispatch => ({
loadActivityGpx: activityId => {