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`.
This allows the merge algorithm to not be lost when receiving changes.
Without this change, the optimistic merge algorithm isn't able to make
the distinction between peers, and features end up duplicated.
It's now it's responsability to get the authentication token from
the http server and pass it to the websocket server, it will make it
possible to redo the roundtrip when getting disconnected.
In some cases, you want to stop the propagation of events. The previous
code was using `fromSync=true` and `sync=false` interchangeably. This
makes it use `sync=false` everywhere.
Because we're relying on the `geoJSONToFeatures` method, we don't need
anymore updaters, the default ones (map, datalayer, feature) are enough.
It also makes the codebase compatible with our eslint configuration.
This can arise when the form isn't bound to a "syncable" object. We
might want to provide an utility to check an object is *syncable*, or a
specific form to not attempt to sync objects which don't need it.
Removing the `id` from the feature when cloning makes it generate a new
one. Without this change, the cloned feature keep the already existing
`id`, and during sync, the original object is lost (replaced by the
clone).
Nobody wants to be replaced by a clone.
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)
`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.
This changes how the syncEngine works. At the moment, it's always
instanciated, even if no syncing is configured. It just does nothing.
This is to avoid doing `if (engine) engine.update()` calls everywhere
we use it.
You now need to `start()` and `stop()` it.
This also changes the interface between the synced classes and the sync
engine.
The sync engines only requires two methods now:
- `getSyncMetadata()` which returns all the metadata needed, including
the `engine`.
- `render()` which renders the object, updating the needed parts.
Added a new `geometryToFeature` method in `umap.layer.js` which can
update a given geometry if needed.
A new `id` property can also be passed to the features on creation, to
make it possible to have the same features `id` on different peers.
Synced objects now expose different methods, such as:
- `getSyncEngine` which returns the location of the sync object.
- `getMetadata` which returns the associated metadata with the object.
Hooks have been added when features are created or changed, so the
changes can be synced with other peers.
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.
A new SyncEngine module has been added to the JavaScript code. It aims
to sync the local changes with remote ones. This first implementation
relies on a websocket connection.
There is one "room" per map, and the server relays messages to all the
other connected peers.
Messages are checked for compliance with what's allowed as a security
measure. They should also be checked in the clients to avoid potential
attack vectors.
Basically, we do not add `<br>` anymore, but instead let the newline
and use the css `white-space: pre-line;`. Also remove new lines after
title.
While doing that change, I needed to reorder regex so the ones needing
a newline before would still have it (bullets points).
I've added tests and removed some to cover those changes.
fix#1854
cf https://forum.openstreetmap.fr/t/umap-2-3-changement-de-gestion-des-pop-up/23680/3
Trying to make this panel expanded/condenses thing simpler and more intuitive.
It's mode can be set:
- by explicitely setting defaultPanelMode = xxx
- or, if defaultPanelMode is undefined, with sensible default when there is
an onLoadPanel defined, and to respect previous uMap behaviour
- or, if defaultPanelMode is unset, and some feature opens in the panel, it
will be set to expanded (here again to respect previous behaviour
- then, when user change it manually (by clicking on the toggle button), then
we should never change it automatically, and respect the previous mode when
reopening the panel
(We are only talking about the left panel, here.)