Commit graph

226 commits

Author SHA1 Message Date
Yohan Boniface
5c38bc7970 chore: redirect to user dashboard after map delete
If user is authenticated.

We do not display alert messages on the home page.
2025-04-09 08:54:44 +02:00
Yohan Boniface
c0c55075b7 chore: rename WEBSOCKET_ENABLED in REALTIME_ENABLED
Co-authored-by: David Larlet <david@larlet.fr>
2025-04-07 18:55:18 +02:00
Yohan Boniface
1344fe6b46 feat: basic filtering by tags 2025-04-03 11:10:36 +02:00
Yohan Boniface
8599199afa feat: add more users counts in /stats/
Co-authored-by: David Larlet <david@larlet.fr>
2025-03-10 16:38:53 +01:00
Yohan Boniface
1981f73212 feat: expose active sessions in stats endpoint 2025-03-05 10:02:42 +01:00
Yohan Boniface
470fc14d6d fix: be defensive when getting the backend name from the session
Seems that in some situation it is not defined.
2025-03-04 11:20:49 +01:00
Yohan Boniface
284ca8fd9c chore: be more persuasive in deprecating twitter login backend
- always redirect user from map to their profile page when they
  used a deprecated backend to log in
- change the Twitter image to make clear it is to be removed

Co-authored-by: David Larlet <david@larlet.fr>
2025-03-03 18:24:23 +01:00
Yohan Boniface
ee1a87cdeb feat: add DEPRECATED_AUTHENTICATION_PROVIDERS setting 2025-01-30 11:04:02 +01:00
Yohan Boniface
fd8a1971f8 feat: soft delete datalayers
When deleting a datalayer, it will now be moved to a state "deleted", and
it will only be deleted for real when running the command `umap empty_trash`.

This is what we already do for the map itself, but until now if a user
deleted a only a datalayer by mistake (not the map itself) it could not retrieve
it.
2025-01-29 19:08:59 +01:00
Yohan Boniface
d20943a487
feat: move star button to caption (#2442)
fix #2282


![image](https://github.com/user-attachments/assets/45fda270-035b-4ec2-9ac1-3e2f2798663b)
![Screenshot From 2025-01-23
10-42-23](https://github.com/user-attachments/assets/ef323c82-bb12-41ef-97e6-b21dfeef01ba)
2025-01-27 17:18:28 +01:00
Yohan Boniface
36d9e9bf06 wip(sync): use the correct URL for websocket
Co-authored-by: David Larlet <david@larlet.fr>
2025-01-23 17:17:16 +01:00
Yohan Boniface
48f9afdedd feat: move star button to caption
fix #2282
2025-01-23 11:25:09 +01:00
Yohan Boniface
49cde00361
feat: display map's "created at" and "modified at" in the caption (#2424)
fix #2110 


![image](https://github.com/user-attachments/assets/a7db6197-4cc6-417e-b480-8e1434d73687)
2025-01-10 16:23:42 +01:00
Yohan Boniface
e7fe92c070 feat: display map's "created at" and "modified at" in the caption 2025-01-10 15:49:05 +01:00
Yohan Boniface
92b7be3ad9 fix: update map.modified_at when saving a datalayer
fix #2421
2025-01-10 12:01:13 +01:00
Yohan Boniface
8a38dd63c9 fix: show private/draft maps in team maps for members 2024-12-17 10:37:07 +01:00
Yohan Boniface
8db974b96a chore: more logs in the ajax proxy validate url
This should only be used in localhost, but there are a bunch of
check and it's often that we need to add print to understand why
the URL does not validate, which is usually an issue with the SITE_URL
or this kind. So let's make those print permanent.
2024-12-12 21:06:09 +01:00
Yohan Boniface
86c634db28 fix: make sure we set X-DataLayer-Version even when using X-Accel-Redirect 2024-12-12 18:19:02 +01:00
Yohan Boniface
a04624c4c8 feat: support storing layer data in S3 like servers
fix #2290
2024-12-10 18:51:58 +01:00
Yohan Boniface
29d243b3c5 feat: move map to trash on delete
This also:
- adds a `umap empty_trash` command
- remove the previous purgatory concept
2024-12-10 16:30:23 +01:00
Yohan Boniface
1aaea0beb9 feat: introduce Map.share_status=DRAFT and DELETED 2024-12-10 15:14:12 +01:00
Yohan Boniface
78d6699a81 feat: allow to configure the default label keys per instance
fix #2289
2024-12-02 12:58:19 +01:00
7dadb83ff5 feat(sync): Let the clients set layers UUID
This make it possible to synchronize datalayers before their creation on
the server, allowing at the same time to solve issues related to them
not being saved (e.g. duplication of geometries)

We use the DataLayer._referenceVersion to track if a DataLayer has been
saved on the server.

After a save, the _referenceVersion is synched with other peers.

To pass the reference version from the server to the frontend, we have two
options:
- use a header
- populate the `options.version` field

In the case of a GET on a Datalayer, we could not use the `options` scenario
because:
- the value in the file is not up to date (it was the value the client has
 before the save)
- the python cannot change it on the fly, as the file is served by nginx

So we decided to keep using a header. But on the map view, we load all
datalayers metadatas in the map options, so here we cannot use the header
scenario, so in this specific case we had to populate `options._referenceVersion`.

At the same time, we also changed:
- Umap.options.umap_id => Umap.id
- DataLayer.umap_id => Datalayer.id
- fixed the version number returned by DataLayer.version_metadata
2024-11-15 15:22:36 +01:00
Yohan Boniface
73c83cfa86 chore: always return user infos on map save 2024-10-04 17:34:59 +02:00
Yohan Boniface
ff5195a787 fix: make sure anonymous is owner at create
The tricky thing is that the Map.is_owner() method check for cookies
on the request, but at create this cookie is not set yet on the
request, so we have to deal with an exception here.

fix #2176
2024-10-04 17:34:59 +02:00
5485fb99ab feat(sync): Send remote operations to peers when they join.
- Operations are now stored locally in memory. All operations are tied
  to an HLC (Hybrid Logical Clock), making it possible to order them
  concistently.

- Messages are handled in their `on*` methods, leading to a clearer
  implementation.

- When a new peer joins, it asks a random peer for the list of
  operations, and re-apply them locally.

- Messages types names have been updated to follow CamelCase, and to be
  similar across the client and the server.

- Pass `sync=False` to `makeFeature` in the updaters, to avoid
  generating duplicate operations on message retrieval.
2024-09-27 18:26:47 +02:00
Yohan Boniface
5f67c9c229 fix: do not call teams.all() on anonymous user
In the same move, refactor the can_edit/_view/_delete functions to
only take the request, which is what really happen in the code, and
adapt the test in that way.
2024-09-10 17:56:14 +02:00
David Larlet
a877dd1714
chore: remove logo_url from Team model 2024-08-30 10:55:26 -04:00
Yohan Boniface
13735a5739 chore: use our own Team model
We suppose we'll quickly want more than a name, like a description
or a logo_url, and maybe a access_status or permissions…
2024-08-30 15:53:18 +02:00
Yohan Boniface
6b6be017bb wip: use autocomplete to add users in groups 2024-08-29 20:12:24 +02:00
Yohan Boniface
a5a68cc922 wip: show user groups maps in dashboard 2024-08-29 20:12:24 +02:00
Yohan Boniface
9b2a99019b wip: add very basic CRUD for groups 2024-08-29 20:12:24 +02:00
Yohan Boniface
a3e972bf5d wip: add group maps page and display group as author when defined 2024-08-29 20:12:22 +02:00
Yohan Boniface
dce0ee5f73 wip: use auth.models.Group and manage permissions 2024-08-29 20:11:19 +02:00
Yohan Boniface
5145404dc4 fix: show delete button for owner and anonymous owner 2024-07-31 22:29:29 +02:00
Yohan Boniface
3bdd5bedf1 fix: catch login_required from map page and add a way to login 2024-07-30 14:41:10 +02:00
Yohan Boniface
c09adffb64 fix: make sure to quote spaces in URL when using proxy
space is a control character, and thus is forbidden in an URL, and
we do have spaces in overpass URL (containing raw queries).
2024-06-26 22:57:25 +02:00
Yohan Boniface
74e0b43311 fix: correct syntax for translating string when sending emails 2024-06-14 20:41:53 +02:00
Yohan Boniface
d928195a5b wip: rename and document UMAP_IMPORTERS 2024-06-14 18:40:05 +02:00
Yohan Boniface
f5eea1fe3f wip(naming): replace "plugin" by "importer"
We are not ready yet to talk about plugins
2024-06-14 18:38:30 +02:00
Yohan Boniface
93a189497b wip: control plugins from settings 2024-06-14 18:38:29 +02:00
David Larlet
6f715c109b
chore: improve message/choice in case of conflicts 2024-06-12 18:03:04 -04:00
David Larlet
5c2528900e
chore: Use web components to display alerts + a11y roles 2024-06-12 18:03:04 -04:00
940ae77602 settings: Make the websocket settings clearer.
It is now using `WEBSOCKET_BACK_HOST`, `WEBSOCKET_BACK_PORT` and
`WEBSOCKET_FRONT_URI`.

We need to take in consideration that the "front" WebSocket address
(that clients will connect to) might be different than the "back" ip and
port which are bound in the host.

This happens for instance for reverse proxies, or when running inside
a container.

We considered using a `WEBSOCKET_TLS` setting, to try guessing the
"front" address based on `WEBSOCKET_HOST`, `WEBSOCKET_PORT` and
`WEBSOCKET_TLS`, but as the back and front address can differ, this
would need to introduce a `WEBSOCKET_URI` in any case, so we went with
just using it, and not adding an extra `WEBSOCKET_TLS`.
2024-06-07 18:21:30 +02:00
90780fbf6d fixup: changes after @ybon's review. 2024-06-07 18:21:30 +02:00
ce0f3c9d3e fix(sync): Import the data when syncing GeoJSON objects.
Prior to these changes, the data wasn't transmitted over WebSocket, and
even if present it wasn't taken into account.
2024-06-07 18:21:30 +02:00
66eb90ffd1 chore(sync): Move the sync flag in the options
The goal being for it to be hidden for now.

- Add a `is_owner` method on the map and use it in the view
- Remove duplicated line in `global.js`
- Rename `Datalayer` to `DataLayer` everywhere
- Move the sync flag in the map options (next to slideshow)
2024-06-07 18:21:30 +02:00
32a4f3feda feat(sync): Add WebSocket specific settings
`WEBSOCKET_ENABLED`, `WEBSOCKET_HOST`, `WEBSOCKET_PORT` and
`WEBSOCKET_URI` have been added.

They are being transmitted to the client via the `map.options`.
When `WEBSOCKET_ENABLED` is set to `False`, the client doesn't have
the ability to be synced.
2024-06-07 18:21:30 +02:00
f255c3c8a5 feat(websockets): Authenticate with signed tokens.
Authentication is now done using a signed token provided by the Django
server, sent by the JS client and checked by the WebSocket server.

The token contains a `permissions` key that's checked to ensure the user
has access to the map "room", where events will be shared by the peers.
2024-06-07 18:21:30 +02:00
Yohan Boniface
99207638d9 fix: make sure to order datalayer versions by time
When we changed from id to uuid, we broke the sorting, which
supposed to have a constant id as string prefix from version to
the other.
2024-03-25 20:13:34 +01:00