Commit graph

160 commits

Author SHA1 Message Date
Yohan Boniface
73d19e849f Refactor share_status check in datalayers views 2023-09-22 17:24:01 +02:00
Brian DeRocher
6720f76d85 Set the map option. No need for setting boolean from query string.
Only add the owner property if the feature flag (map.options.featuresHaveOwner) is enabled.

Default to features do NOT have owners.
2023-09-20 13:16:52 -04:00
Brian DeRocher
77b56623ed Remove field from map settings form. 2023-09-20 13:07:12 -04:00
Brian DeRocher
6c58bf367d Use camelcase and fix typo. 2023-09-20 13:03:36 -04:00
Brian DeRocher
e25fb5d04f Add FeaturesHaveOwners map option.
WIP
2023-09-20 12:48:32 -04:00
Yohan Boniface
f6730a9829
Update umap/views.py
Co-authored-by: David Larlet <3556+davidbgk@users.noreply.github.com>
2023-09-20 15:17:29 +02:00
Yohan Boniface
43e5391c49 Fix map displayed more than once in user dashboard when multiple editors
fix #1325
2023-09-20 11:30:05 +02:00
David Larlet
6cacc7122b
Avoid using a tuple as a content type when guessed
Only use the content type with mimetypes.guess_type
2023-08-29 15:24:58 -04:00
Yohan Boniface
bcdac413be ajax proxy: quote URL before passing it to Nginx 2023-08-28 18:00:40 +02:00
Yohan Boniface
c4bdb04795 Use X-Accel-Redirect for serving ajax-proxy request
uMap allows to use remote URL as data sources, but those URLs
are not always CORS open, so this is why there is this "ajax-proxy"
feature, where the URL is passed to the backend.

Additionally, there is a caching feature, which duration is configurable
through frontend settings. Valid values are: disabled, 5 min, 1 hour,
1 day.

Initially, I wanted this to be totally handled by Nginx, but I never
found a wayt to set the proxy_cache_valid value from a query string.

Since then, at least in OSM France servers, the ajax-proxy is still
handled by a Django view, which then opens the remote URL and transfert
the data. This is not optimal. And I suppose this is what is causing
hicups on the OSM France servers lately.

This PR provides a mix option, where python deals with validating the
URL and parsing the TTL parameter, and then it passes the hand to
nginx which will serve the remote content.

So, roughtly:

- the client calls /ajax-proxy/?url=xxx&ttl=300
- python will validate the URL (not internal calls…)
- if UMAP_SENDFILE_HEADER is set, then the python returns an empty
  response with the path /proxy/http://url plus it will set the
  cache ttl through the header X-Accel-Expires
- this /proxy/ location is then handled by nginx
2023-08-24 13:41:34 +02:00
Yohan Boniface
25b3a66351 Allow to add more than one OAuth provider 2023-08-21 17:08:57 +02:00
Yohan Boniface
2b471be171 Very lite "My Profile" page to allow changing username 2023-08-21 15:09:30 +02:00
Yohan Boniface
b5d0b50183 Catch timeout error in ajax proxy 2023-08-17 17:43:25 +02:00
Yohan Boniface
fc37ad7c17 Adapt logout behaviour in ajax/not ajax modes 2023-07-27 15:02:51 +02:00
Yohan Boniface
2f89e99cb8 Add a timeout in proxy
This view should not be used in production, but it is sometimes, so
just in case…
2023-07-21 12:51:31 +02:00
Yohan Boniface
d91184a021 gzip file may not be yet created when computing the Last-Modified 2023-07-20 09:02:40 +02:00
Yohan Boniface
13a1c3bd5c Use gzip mtime for Last-Modified comparison when in gzip mode
Prior to 1.3.0, uMap was not setting the gzip mtime, so it was
whatever the time it get requested at first.
Since 1.3.0:
- when creating the geojson.gzip, we also force its mtime to be
  the geojson one
- we replaced If-Match by If-Unmodified, which relies on Last-Modified

When uMap is served by a proxy like Nginx (and X-Accel-Redirect),
and if user accepts gzip, then the Last-Modified would be the gzip
one, not the flat geojson one.

So when comparing that value in a subsequent update, we need to
compare with the correct value.

fix #1212
2023-07-19 14:21:00 +02:00
Yohan Boniface
617d6ba9ef Fix last maps returned when search was empty 2023-07-15 09:31:55 +02:00
Yohan Boniface
6b539b9d40 Add pagination to map table in user dashboard 2023-07-15 09:31:55 +02:00
Yohan Boniface
4d0ced9a98 Add very basic user dashboard 2023-07-12 09:09:01 +02:00
Yohan Boniface
339ef3555f Use LANGUAGE_CODE instead of locale name for browser APIs
fix #1187
2023-07-03 19:44:49 +02:00
David Larlet
51978f9f2a
Display latest created maps on empty search 2023-06-30 21:40:35 -04:00
David Larlet
a87309cee6
Add a setting for the number of maps per search
Useful for https://github.com/umap-project/umap-dsfr
2023-06-27 18:41:00 -04:00
Yohan Boniface
1d5c1a067a Expose version in /stats/ endpoint 2023-06-20 15:14:28 +02:00
Yohan Boniface
81fcc080d9 Allow to customize user display name and URL slug 2023-06-16 14:59:59 +02:00
David Larlet
3edad3976d
Display the number of maps on search results page 2023-06-14 09:58:48 -04:00
David Larlet
fad196bff7
Display the current version + link to changelog 2023-06-06 14:05:35 -04:00
Yohan Boniface
51a904dc07 Only return anonymous_url in anonymous context
Otherwise the frontend will treat map as anonymous even with
and owner and display a wrong message creation.

Also, this edit URL does not make sense (and will not work)
when there is an owner.
2023-06-04 08:05:48 +02:00
Yohan Boniface
6e0c4723a4
Merge pull request #1102 from umap-project/mail-link
Add a button to send edit link by email in anonymous mode
2023-06-02 23:32:34 +02:00
Yohan Boniface
1b791347d8 Also catch InvalidURL in ajax-proxy
fix #1119
2023-06-02 22:45:13 +02:00
Yohan Boniface
39a887a6f6 Also catch URLError in ajax-proxy
fix #1118
2023-06-02 22:36:02 +02:00
Yohan Boniface
5460876ff4
Update umap/views.py
Co-authored-by: David Larlet <3556+davidbgk@users.noreply.github.com>
2023-06-02 17:33:09 +02:00
Yohan Boniface
5d6afdfb1b Add a "Copy link" button near to the anonymous edit link 2023-05-31 18:32:51 +02:00
Yohan Boniface
8f77b63b08 Changed working of edit link alert + added a carriage return 2023-05-31 17:33:05 +02:00
Yohan Boniface
8f52d34bb2 WIP: final bit to make sending edit link working 2023-05-31 17:05:57 +02:00
Yohan Boniface
eb32dcc9b6 Make that Map.get_anonymous_edit_url returns full URL 2023-05-31 16:30:07 +02:00
Yohan Boniface
69bf6593ac (WIP) Add a button to send edit link by email in anonymous mode 2023-05-31 14:50:43 +02:00
David Larlet
3f28c04241
Banner + no create buttons when in read only mode
Fix #1095
2023-05-30 16:17:12 -04:00
David Larlet
9d752ea306 Add a very basic /stats/ JSON view
Will be useful to feed munin for instance.
2023-05-22 17:47:04 -04:00
Yohan Boniface
a2b1b7bc88 Refactor UserMaps and UserStars views 2023-05-15 14:50:18 +02:00
Yohan Boniface
8c113d9a19 Rename MapStar view in ToggleMapStarStatus 2023-05-15 12:22:28 +02:00
Yohan Boniface
1c5ffd8136 Update umap/views.py
Co-authored-by: David Larlet <3556+davidbgk@users.noreply.github.com>
2023-05-15 12:22:28 +02:00
Yohan Boniface
37b4d05da5 (WIP) Allow to star map and retrieve starred maps 2023-05-15 12:22:26 +02:00
David Larlet
da1e25be2a Remove the limit of visible maps in user’s view
It should not have any performance issue given that we paginate over the list anyway.

Fix #1025
2023-05-12 13:51:39 -04:00
Yohan Boniface
e3d5bd794f black is a colour 2023-05-11 11:33:30 +02:00
Yohan Boniface
1038836a72 Use Django full text instead of custom SQL 2023-05-11 11:33:08 +02:00
Yohan Boniface
005a759b81
Update umap/views.py
Co-authored-by: Adrien nayrat <adrien.nayrat@gmail.com>
2023-05-10 19:24:33 +02:00
Yohan Boniface
7384fda61a Allow to create search index without changing unaccent mutability
cf #519
2023-05-10 11:47:29 +02:00
Luc Didry
123af0a7c9
🐛 — Allow to use SHA1-signed anonymous edit URL
The default django.core.signing Signer uses SHA256 algorithm since Django 3.
Umap used Django 2 in the paste, so people had SHA1 signed anonymous edit URLs,
which became unusable when umap switch to Django 3.
This commit makes them usable again (the new SHA256-signed anonymous edit URLs
still works, obviously).
2023-03-29 12:49:32 +02:00
Yohan Boniface
83ca957263 Remove unused code 2023-03-01 19:13:45 +01:00
Yohan Boniface
e343ddb636 Do not deal with gzip while serving without x-accel-redirect
Let's keep this path simple, as it should not be used in normal
production context.
2023-02-27 13:49:21 +01:00
Yohan Boniface
6694306660 Use If-Unmodified-Since istead of If-Match
If-Match relies on ETag, which depends on the Content-Encoding,
which is more fragile given we updated the etag on save, while normal
files are served by nginx. So this may occurs false mismatch.
2023-02-27 13:45:15 +01:00
Yohan Boniface
5b7f08ed08 Refactor gzip creation 2023-02-27 12:04:09 +01:00
Yohan Boniface
abc1f119d5 black on views.py 2023-02-27 11:38:59 +01:00
Yohan Boniface
3aa34d124e black on views.py 2023-02-27 11:00:33 +01:00
Yohan Boniface
2bd4008f97 Use Nginx ETag algo
There is a situation where the ETag can be generated by Nginx,
but then used by Django: when the user starts editing a layer,
the js client will send the ETag received from Nginx to uMap
as value to check is there is an editing conflict.
2023-02-25 21:50:39 +01:00
Yohan Boniface
a8dee3fa07 Add Vary: Accept-Encoding header 2023-02-23 11:17:19 +01:00
Yohan Boniface
0300a5f962 ETag must be between double quotes per spec 2023-02-23 11:10:44 +01:00
Yohan Boniface
2fc30b117b Prepare for Django 4.x 2023-02-22 15:19:38 +01:00
Yohan Boniface
1200b82838 First attempt to upgrade to Django 3.X
Bloqued by https://github.com/peopledoc/django-agnocomplete/issues/119
2021-05-17 10:51:24 +02:00
Yohan Boniface
5b8a8904cc Add Map.BLOCKED share status 2019-04-07 11:12:38 +02:00
Yohan Boniface
7a49dcba99 Increase limit in owner maps page
fix #651
2019-01-30 12:07:35 +01:00
Yohan Boniface
706967d982 Keep python 3.5 compat for now 2018-09-23 11:02:36 +02:00
Yohan Boniface
f3ecc8ce28 Update permissions metadata at each map save
This fix the issue where the permissions panel was not available
on first save (without reloading the page).
2018-09-23 09:57:00 +02:00
Yohan Boniface
da4ee13deb Display a message on the site when trying to do a POST in readonly mode 2018-09-08 16:49:25 +02:00
Yohan Boniface
81f6b429bc allow to cache proxied remote data requests
cf #513
cf #510
cf #160
2018-08-04 20:50:03 +02:00
Yohan Boniface
e319fa963e Make sure map name is always read from backend
fix #605
2018-08-04 15:26:12 +02:00
Yohan Boniface
408bbd81aa Fix map/id/geojson content_type 2018-07-14 23:55:21 +02:00
Yohan Boniface
72b943d779 Remove Map.tilelayer foreignkey
Map tilelayer is saved in the settings since a long time now.
2018-07-14 13:59:40 +02:00
Yohan Boniface
1a815b313d Add an explicit button to attach an owner to an anonymous map
fix #568
2018-07-07 16:44:40 +02:00
Yohan Boniface
ac8b68b0e5 Remove OldMapUrl 2018-06-15 23:31:45 +02:00
Yohan Boniface
48185650b0 Move permissions form building to JS 2018-06-15 23:25:38 +02:00
Yohan Boniface
8655061817 Rename in JS/CSS: storage_ => umap_ storage- => umap- 2018-06-02 15:47:57 +02:00
Yohan Boniface
a0bff73401 Fix generate_js_locale paths 2018-06-02 14:44:01 +02:00
Yohan Boniface
62a825e6ed Replace LEAFLET_STORAGE_XXX settings by UMAP_XXXX
We keep a retrocompatibility for now.
2018-05-19 17:16:34 +02:00
Yohan Boniface
1ef5e13f48 Remove duplicate short_url declarations 2018-05-19 12:01:53 +02:00
Yohan Boniface
cb470198e6 Merge leaflet_storage locales 2018-05-19 11:12:19 +02:00
Yohan Boniface
e55d03bd5e Django 2.0
And update other deps
2018-05-19 10:05:18 +02:00
Yohan Boniface
0104337406 Add travis.yml 2017-05-12 10:42:02 +02:00
Yohan Boniface
5f63de9561 Remove print (cf #301) 2016-03-30 12:22:24 +02:00
Yohan Boniface
c4287bf39e Also use plainto_tsquery when using unaccent 2016-03-10 22:47:28 +01:00
Stephan Bösch-Plepelits
e8c7b41e6d Configuration: settings to configure count of showcased maps
- UMAP_MAPS_PER_PAGE
- UMAP_MAPS_PER_PAGE_OWNER
2016-01-03 21:47:31 +01:00
Stephan Bösch-Plepelits
d783366d9d Configuration: new setting UMAP_EXCLUDE_DEFAULT_MAPS
- This setting will exclude default maps (maps where the default center
  has not been updated)
- until now, the default was to exclude default maps - new default: not
  exclude
2016-01-03 21:44:14 +01:00
Yohan Boniface
d7649b3a66 Use plainto_tsquery instead of to_tsquery to allow multiple words 2015-12-23 22:03:09 +01:00
Yohan Boniface
d09e798dd6 Gives HttpResponse bytes 2015-10-17 13:09:58 +02:00
Yohan Boniface
f566247b91 Paginage by 10 in "My Maps" page (cf #211) 2015-10-11 22:19:51 +02:00
Yohan Boniface
7b5ea8df67 First shot in Django 1.8 / python 3 support
This also replaced pg_index with a simple builting seach
based on tsvector, as pg_index is not compliant with Django 1.8,
and as some old dependencies that would need to be upgrade too.
2015-08-02 18:08:31 +02:00
Yohan Boniface
a86d29dd0e The string to check on is actually spatialite, not sqlite 2014-09-09 19:13:11 +02:00
Yohan Boniface
61ae371649 Do not filter maps by center distance when running spatialite 2014-09-09 17:43:28 +02:00
Yohan Boniface
469187e4f1 Catch unkown domain in validate_url 2014-07-18 23:26:16 +02:00
Yohan Boniface
c52d63faf9 0.6.7 2014-06-19 14:39:45 +02:00
Yohan Boniface
21122dba4f Get rid of sesql and upgrade to django 1.6 2014-05-02 00:13:33 +02:00
Yohan Boniface
ab5444184f Allow user to scroll until 50 maps on its page (instead of 50) 2014-04-28 16:13:28 +02:00
Yohan Boniface
f1f7c90363 Increase number of showcase maps 2014-04-21 00:02:10 +02:00
Yohan Boniface
3ca24f5838 Quick hack to prevent django from adding vary:cookie on proxy view 2014-04-20 12:24:13 +02:00
Yohan Boniface
f0ce51683f Add user agent to proxy 2014-04-19 19:44:56 +02:00
Yohan Boniface
a389a76027 Validate URL before proxying 2014-04-19 17:54:51 +02:00
Yohan Boniface
9bf587a765 Use a query string for URL 2014-04-19 12:28:24 +02:00
Yohan Boniface
39f672641c First shot in GeoRSS support 2014-04-19 11:48:54 +02:00
Yohan Boniface
0cfd560b26 Add owner name in "map of the maps" popup 2014-02-10 21:37:12 +01:00