umap-project 2.8.2__py3-none-any.whl → 2.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/admin.py +15 -2
- umap/asgi.py +12 -7
- umap/context_processors.py +1 -0
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/br/LC_MESSAGES/django.po +111 -67
- umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +110 -66
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +129 -85
- umap/locale/en/LC_MESSAGES/django.po +103 -60
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +114 -69
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +105 -61
- umap/locale/gl/LC_MESSAGES/django.mo +0 -0
- umap/locale/gl/LC_MESSAGES/django.po +216 -171
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +142 -98
- umap/locale/nl/LC_MESSAGES/django.mo +0 -0
- umap/locale/nl/LC_MESSAGES/django.po +196 -151
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +115 -71
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +109 -65
- umap/management/commands/empty_trash.py +12 -1
- umap/migrations/0026_datalayer_modified_at_datalayer_share_status.py +26 -0
- umap/models.py +43 -13
- umap/settings/base.py +5 -2
- umap/static/umap/base.css +5 -2
- umap/static/umap/content.css +2 -22
- umap/static/umap/css/bar.css +39 -10
- umap/static/umap/css/contextmenu.css +14 -2
- umap/static/umap/css/form.css +33 -39
- umap/static/umap/css/icon.css +47 -5
- umap/static/umap/css/panel.css +20 -2
- umap/static/umap/css/popup.css +0 -1
- umap/static/umap/css/tooltip.css +33 -31
- umap/static/umap/img/16-white.svg +5 -3
- umap/static/umap/img/16.svg +1 -1
- umap/static/umap/img/24-white.svg +17 -16
- umap/static/umap/img/24.svg +29 -18
- umap/static/umap/img/providers/bitbucket.png +0 -0
- umap/static/umap/img/providers/github.png +0 -0
- umap/static/umap/img/providers/keycloak.png +0 -0
- umap/static/umap/img/providers/openstreetmap-oauth2.png +0 -0
- umap/static/umap/img/providers/twitter-oauth2.png +0 -0
- umap/static/umap/img/source/16-white.svg +6 -4
- umap/static/umap/img/source/16.svg +1 -1
- umap/static/umap/img/source/24-white.svg +20 -18
- umap/static/umap/img/source/24.svg +30 -19
- umap/static/umap/js/components/alerts/alert.js +4 -1
- umap/static/umap/js/modules/browser.js +8 -8
- umap/static/umap/js/modules/caption.js +30 -7
- umap/static/umap/js/modules/data/features.js +101 -56
- umap/static/umap/js/modules/data/layer.js +108 -83
- umap/static/umap/js/modules/form/builder.js +242 -0
- umap/static/umap/js/modules/form/fields.js +1346 -0
- umap/static/umap/js/modules/formatter.js +9 -8
- umap/static/umap/js/modules/help.js +20 -24
- umap/static/umap/js/modules/importer.js +6 -3
- umap/static/umap/js/modules/permissions.js +11 -6
- umap/static/umap/js/modules/rendering/icon.js +5 -1
- umap/static/umap/js/modules/rendering/layers/classified.js +12 -8
- umap/static/umap/js/modules/rendering/layers/cluster.js +11 -1
- umap/static/umap/js/modules/rendering/map.js +1 -23
- umap/static/umap/js/modules/rendering/ui.js +20 -38
- umap/static/umap/js/modules/rules.js +3 -2
- umap/static/umap/js/modules/saving.js +5 -0
- umap/static/umap/js/modules/schema.js +8 -6
- umap/static/umap/js/modules/share.js +3 -3
- umap/static/umap/js/modules/sync/engine.js +56 -26
- umap/static/umap/js/modules/sync/updaters.js +15 -6
- umap/static/umap/js/modules/sync/websocket.js +50 -37
- umap/static/umap/js/modules/tableeditor.js +3 -2
- umap/static/umap/js/modules/ui/bar.js +101 -9
- umap/static/umap/js/modules/ui/base.js +7 -24
- umap/static/umap/js/modules/ui/contextmenu.js +9 -2
- umap/static/umap/js/modules/ui/panel.js +5 -1
- umap/static/umap/js/modules/ui/tooltip.js +19 -11
- umap/static/umap/js/modules/umap.js +121 -68
- umap/static/umap/js/modules/utils.js +196 -12
- umap/static/umap/js/umap.controls.js +11 -353
- umap/static/umap/locale/am_ET.js +17 -5
- umap/static/umap/locale/am_ET.json +17 -5
- umap/static/umap/locale/ar.js +17 -5
- umap/static/umap/locale/ar.json +17 -5
- umap/static/umap/locale/ast.js +17 -5
- umap/static/umap/locale/ast.json +17 -5
- umap/static/umap/locale/bg.js +17 -5
- umap/static/umap/locale/bg.json +17 -5
- umap/static/umap/locale/br.js +33 -20
- umap/static/umap/locale/br.json +33 -20
- umap/static/umap/locale/ca.js +17 -5
- umap/static/umap/locale/ca.json +17 -5
- umap/static/umap/locale/cs_CZ.js +15 -5
- umap/static/umap/locale/cs_CZ.json +15 -5
- umap/static/umap/locale/da.js +17 -5
- umap/static/umap/locale/da.json +17 -5
- umap/static/umap/locale/de.js +17 -5
- umap/static/umap/locale/de.json +17 -5
- umap/static/umap/locale/el.js +63 -51
- umap/static/umap/locale/el.json +63 -51
- umap/static/umap/locale/en.js +15 -5
- umap/static/umap/locale/en.json +15 -5
- umap/static/umap/locale/en_US.json +17 -5
- umap/static/umap/locale/es.js +25 -13
- umap/static/umap/locale/es.json +25 -13
- umap/static/umap/locale/et.js +17 -5
- umap/static/umap/locale/et.json +17 -5
- umap/static/umap/locale/eu.js +17 -5
- umap/static/umap/locale/eu.json +17 -5
- umap/static/umap/locale/fa_IR.js +17 -5
- umap/static/umap/locale/fa_IR.json +17 -5
- umap/static/umap/locale/fi.js +17 -5
- umap/static/umap/locale/fi.json +17 -5
- umap/static/umap/locale/fr.js +16 -6
- umap/static/umap/locale/fr.json +16 -6
- umap/static/umap/locale/gl.js +357 -345
- umap/static/umap/locale/gl.json +357 -345
- umap/static/umap/locale/he.js +17 -5
- umap/static/umap/locale/he.json +17 -5
- umap/static/umap/locale/hr.js +17 -5
- umap/static/umap/locale/hr.json +17 -5
- umap/static/umap/locale/hu.js +14 -5
- umap/static/umap/locale/hu.json +14 -5
- umap/static/umap/locale/id.js +17 -5
- umap/static/umap/locale/id.json +17 -5
- umap/static/umap/locale/is.js +17 -5
- umap/static/umap/locale/is.json +17 -5
- umap/static/umap/locale/it.js +125 -113
- umap/static/umap/locale/it.json +125 -113
- umap/static/umap/locale/ja.js +17 -5
- umap/static/umap/locale/ja.json +17 -5
- umap/static/umap/locale/ko.js +17 -5
- umap/static/umap/locale/ko.json +17 -5
- umap/static/umap/locale/lt.js +17 -5
- umap/static/umap/locale/lt.json +17 -5
- umap/static/umap/locale/ms.js +17 -5
- umap/static/umap/locale/ms.json +17 -5
- umap/static/umap/locale/nl.js +132 -119
- umap/static/umap/locale/nl.json +132 -119
- umap/static/umap/locale/no.js +17 -5
- umap/static/umap/locale/no.json +17 -5
- umap/static/umap/locale/pl.js +17 -5
- umap/static/umap/locale/pl.json +17 -5
- umap/static/umap/locale/pl_PL.json +17 -5
- umap/static/umap/locale/pt.js +38 -25
- umap/static/umap/locale/pt.json +38 -25
- umap/static/umap/locale/pt_BR.js +17 -5
- umap/static/umap/locale/pt_BR.json +17 -5
- umap/static/umap/locale/pt_PT.js +17 -5
- umap/static/umap/locale/pt_PT.json +17 -5
- umap/static/umap/locale/ro.js +17 -5
- umap/static/umap/locale/ro.json +17 -5
- umap/static/umap/locale/ru.js +17 -5
- umap/static/umap/locale/ru.json +17 -5
- umap/static/umap/locale/sk_SK.js +17 -5
- umap/static/umap/locale/sk_SK.json +17 -5
- umap/static/umap/locale/sl.js +17 -5
- umap/static/umap/locale/sl.json +17 -5
- umap/static/umap/locale/sr.js +17 -5
- umap/static/umap/locale/sr.json +17 -5
- umap/static/umap/locale/sv.js +17 -5
- umap/static/umap/locale/sv.json +17 -5
- umap/static/umap/locale/th_TH.js +17 -5
- umap/static/umap/locale/th_TH.json +17 -5
- umap/static/umap/locale/tr.js +17 -5
- umap/static/umap/locale/tr.json +17 -5
- umap/static/umap/locale/uk_UA.js +17 -5
- umap/static/umap/locale/uk_UA.json +17 -5
- umap/static/umap/locale/vi.js +17 -5
- umap/static/umap/locale/vi.json +17 -5
- umap/static/umap/locale/vi_VN.json +17 -5
- umap/static/umap/locale/zh.js +17 -5
- umap/static/umap/locale/zh.json +17 -5
- umap/static/umap/locale/zh_CN.json +17 -5
- umap/static/umap/locale/zh_TW.Big5.json +17 -5
- umap/static/umap/locale/zh_TW.js +15 -5
- umap/static/umap/locale/zh_TW.json +15 -5
- umap/static/umap/map.css +29 -76
- umap/static/umap/nav.css +6 -3
- umap/static/umap/unittests/utils.js +14 -0
- umap/static/umap/vars.css +3 -0
- umap/static/umap/vendors/dompurify/purify.es.js +138 -354
- umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -1
- umap/static/umap/vendors/editable/Leaflet.Editable.js +1 -0
- umap/sync/__init__.py +0 -0
- umap/sync/app.py +187 -0
- umap/sync/payloads.py +56 -0
- umap/templates/auth/user_detail.html +4 -0
- umap/templates/auth/user_form.html +9 -6
- umap/templates/auth/user_stars.html +4 -0
- umap/templates/base.html +1 -1
- umap/templates/registration/login.html +2 -5
- umap/templates/umap/about.html +5 -0
- umap/templates/umap/about_summary.html +2 -2
- umap/templates/umap/components/provider.html +8 -0
- umap/templates/umap/content_footer.html +1 -1
- umap/templates/umap/css.html +0 -2
- umap/templates/umap/js.html +0 -4
- umap/templates/umap/map_detail.html +1 -1
- umap/templates/umap/password_change.html +4 -0
- umap/templates/umap/password_change_done.html +4 -0
- umap/templates/umap/search.html +4 -0
- umap/templates/umap/search_bar.html +1 -0
- umap/templates/umap/team_confirm_delete.html +4 -0
- umap/templates/umap/team_detail.html +4 -0
- umap/templates/umap/team_form.html +4 -0
- umap/templates/umap/user_dashboard.html +1 -1
- umap/templates/umap/user_teams.html +4 -0
- umap/tests/base.py +3 -1
- umap/tests/integration/conftest.py +16 -23
- umap/tests/integration/test_anonymous_owned_map.py +2 -2
- umap/tests/integration/test_basics.py +4 -7
- umap/tests/integration/test_caption.py +1 -0
- umap/tests/integration/test_categorized_layer.py +4 -8
- umap/tests/integration/test_choropleth.py +1 -1
- umap/tests/integration/test_conditional_rules.py +3 -3
- umap/tests/integration/test_draw_polygon.py +14 -22
- umap/tests/integration/test_draw_polyline.py +6 -14
- umap/tests/integration/test_edit_datalayer.py +11 -11
- umap/tests/integration/test_edit_map.py +30 -4
- umap/tests/integration/test_edit_marker.py +5 -5
- umap/tests/integration/test_edit_polygon.py +6 -6
- umap/tests/integration/test_features_id_generation.py +2 -6
- umap/tests/integration/test_import.py +115 -29
- umap/tests/integration/test_optimistic_merge.py +1 -0
- umap/tests/integration/test_owned_map.py +1 -1
- umap/tests/integration/test_picto.py +8 -8
- umap/tests/integration/test_save.py +3 -2
- umap/tests/integration/test_star.py +13 -9
- umap/tests/integration/test_tableeditor.py +8 -7
- umap/tests/integration/test_view_marker.py +10 -0
- umap/tests/integration/test_websocket_sync.py +239 -64
- umap/tests/settings.py +2 -0
- umap/tests/test_datalayer.py +2 -3
- umap/tests/test_datalayer_views.py +20 -1
- umap/tests/test_empty_trash.py +10 -3
- umap/tests/test_map_views.py +11 -0
- umap/utils.py +27 -11
- umap/views.py +37 -6
- {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/METADATA +22 -22
- {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/RECORD +247 -248
- {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/WHEEL +1 -1
- umap/management/commands/run_websocket_server.py +0 -23
- umap/settings/local_s3.py +0 -45
- umap/static/umap/bitbucket.png +0 -0
- umap/static/umap/github.png +0 -0
- umap/static/umap/js/umap.forms.js +0 -1242
- umap/static/umap/keycloak.png +0 -0
- umap/static/umap/openstreetmap.png +0 -0
- umap/static/umap/twitter.png +0 -0
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +0 -468
- umap/static/umap/vendors/toolbar/leaflet.toolbar.css +0 -1
- umap/static/umap/vendors/toolbar/leaflet.toolbar.js +0 -1
- umap/tests/test_websocket_server.py +0 -22
- umap/websocket_server.py +0 -202
- {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.8.2.dist-info → umap_project-2.9.0.dist-info}/licenses/LICENSE +0 -0
umap/websocket_server.py
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
import asyncio
|
|
4
|
-
import logging
|
|
5
|
-
import uuid
|
|
6
|
-
from collections import defaultdict
|
|
7
|
-
from typing import Literal, Optional, Union
|
|
8
|
-
|
|
9
|
-
import websockets
|
|
10
|
-
from django.conf import settings
|
|
11
|
-
from django.core.signing import TimestampSigner
|
|
12
|
-
from pydantic import BaseModel, Field, RootModel, ValidationError
|
|
13
|
-
from websockets import WebSocketClientProtocol
|
|
14
|
-
from websockets.server import serve
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class Connections:
|
|
18
|
-
def __init__(self) -> None:
|
|
19
|
-
self._connections: set[WebSocketClientProtocol] = set()
|
|
20
|
-
self._ids: dict[WebSocketClientProtocol, str] = dict()
|
|
21
|
-
|
|
22
|
-
def join(self, websocket: WebSocketClientProtocol) -> str:
|
|
23
|
-
self._connections.add(websocket)
|
|
24
|
-
_id = str(uuid.uuid4())
|
|
25
|
-
self._ids[websocket] = _id
|
|
26
|
-
return _id
|
|
27
|
-
|
|
28
|
-
def leave(self, websocket: WebSocketClientProtocol) -> None:
|
|
29
|
-
self._connections.remove(websocket)
|
|
30
|
-
del self._ids[websocket]
|
|
31
|
-
|
|
32
|
-
def get(self, id) -> WebSocketClientProtocol:
|
|
33
|
-
# use an iterator to stop iterating as soon as we found
|
|
34
|
-
return next(k for k, v in self._ids.items() if v == id)
|
|
35
|
-
|
|
36
|
-
def get_id(self, websocket: WebSocketClientProtocol):
|
|
37
|
-
return self._ids[websocket]
|
|
38
|
-
|
|
39
|
-
def get_other_peers(
|
|
40
|
-
self, websocket: WebSocketClientProtocol
|
|
41
|
-
) -> set[WebSocketClientProtocol]:
|
|
42
|
-
return self._connections - {websocket}
|
|
43
|
-
|
|
44
|
-
def get_all_peers(self) -> set[WebSocketClientProtocol]:
|
|
45
|
-
return self._connections
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
# Contains the list of websocket connections handled by this process.
|
|
49
|
-
# It's a mapping of map_id to a set of the active websocket connections
|
|
50
|
-
CONNECTIONS: defaultdict[int, Connections] = defaultdict(Connections)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class JoinRequest(BaseModel):
|
|
54
|
-
kind: Literal["JoinRequest"] = "JoinRequest"
|
|
55
|
-
token: str
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
class OperationMessage(BaseModel):
|
|
59
|
-
"""Message sent from one peer to all the others"""
|
|
60
|
-
|
|
61
|
-
kind: Literal["OperationMessage"] = "OperationMessage"
|
|
62
|
-
verb: Literal["upsert", "update", "delete"]
|
|
63
|
-
subject: Literal["map", "datalayer", "feature"]
|
|
64
|
-
metadata: Optional[dict] = None
|
|
65
|
-
key: Optional[str] = None
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
class PeerMessage(BaseModel):
|
|
69
|
-
"""Message sent from a specific peer to another one"""
|
|
70
|
-
|
|
71
|
-
kind: Literal["PeerMessage"] = "PeerMessage"
|
|
72
|
-
sender: str
|
|
73
|
-
recipient: str
|
|
74
|
-
# The message can be whatever the peers want. It's not checked by the server.
|
|
75
|
-
message: dict
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
class ServerRequest(BaseModel):
|
|
79
|
-
"""A request towards the server"""
|
|
80
|
-
|
|
81
|
-
kind: Literal["Server"] = "Server"
|
|
82
|
-
action: Literal["list-peers"]
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class Request(RootModel):
|
|
86
|
-
"""Any message coming from the websocket should be one of these, and will be rejected otherwise."""
|
|
87
|
-
|
|
88
|
-
root: Union[ServerRequest, PeerMessage, OperationMessage] = Field(
|
|
89
|
-
discriminator="kind"
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
class JoinResponse(BaseModel):
|
|
94
|
-
"""Server response containing the list of peers"""
|
|
95
|
-
|
|
96
|
-
kind: Literal["JoinResponse"] = "JoinResponse"
|
|
97
|
-
peers: list
|
|
98
|
-
uuid: str
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
class ListPeersResponse(BaseModel):
|
|
102
|
-
kind: Literal["ListPeersResponse"] = "ListPeersResponse"
|
|
103
|
-
peers: list
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
async def join_and_listen(
|
|
107
|
-
map_id: int, permissions: list, user: str | int, websocket: WebSocketClientProtocol
|
|
108
|
-
):
|
|
109
|
-
"""Join a "room" with other connected peers, and wait for messages."""
|
|
110
|
-
logging.debug(f"{user} joined room #{map_id}")
|
|
111
|
-
connections: Connections = CONNECTIONS[map_id]
|
|
112
|
-
_id: str = connections.join(websocket)
|
|
113
|
-
|
|
114
|
-
# Assign an ID to the joining peer and return it the list of connected peers.
|
|
115
|
-
peers: list[WebSocketClientProtocol] = [
|
|
116
|
-
connections.get_id(p) for p in connections.get_all_peers()
|
|
117
|
-
]
|
|
118
|
-
response = JoinResponse(uuid=_id, peers=peers)
|
|
119
|
-
await websocket.send(response.model_dump_json())
|
|
120
|
-
|
|
121
|
-
# Notify all other peers of the new list of connected peers.
|
|
122
|
-
message = ListPeersResponse(peers=peers)
|
|
123
|
-
websockets.broadcast(
|
|
124
|
-
connections.get_other_peers(websocket), message.model_dump_json()
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
try:
|
|
128
|
-
async for raw_message in websocket:
|
|
129
|
-
if raw_message == "ping":
|
|
130
|
-
await websocket.send("pong")
|
|
131
|
-
continue
|
|
132
|
-
|
|
133
|
-
# recompute the peers list at the time of message-sending.
|
|
134
|
-
# as doing so beforehand would miss new connections
|
|
135
|
-
other_peers = connections.get_other_peers(websocket)
|
|
136
|
-
try:
|
|
137
|
-
incoming = Request.model_validate_json(raw_message)
|
|
138
|
-
except ValidationError as e:
|
|
139
|
-
error = f"An error occurred when receiving the following message: {raw_message!r}"
|
|
140
|
-
logging.error(error, e)
|
|
141
|
-
else:
|
|
142
|
-
match incoming.root:
|
|
143
|
-
# Broadcast all operation messages to connected peers
|
|
144
|
-
case OperationMessage():
|
|
145
|
-
websockets.broadcast(other_peers, raw_message)
|
|
146
|
-
|
|
147
|
-
# Send peer messages to the proper peer
|
|
148
|
-
case PeerMessage(recipient=_id):
|
|
149
|
-
peer = connections.get(_id)
|
|
150
|
-
if peer:
|
|
151
|
-
await peer.send(raw_message)
|
|
152
|
-
|
|
153
|
-
finally:
|
|
154
|
-
# On disconnect, remove the connection from the pool
|
|
155
|
-
connections.leave(websocket)
|
|
156
|
-
|
|
157
|
-
# TODO: refactor this in a separate method.
|
|
158
|
-
# Notify all other peers of the new list of connected peers.
|
|
159
|
-
peers = [connections.get_id(p) for p in connections.get_all_peers()]
|
|
160
|
-
message = ListPeersResponse(peers=peers)
|
|
161
|
-
websockets.broadcast(
|
|
162
|
-
connections.get_other_peers(websocket), message.model_dump_json()
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
async def handler(websocket: WebSocketClientProtocol):
|
|
167
|
-
"""Main WebSocket handler.
|
|
168
|
-
|
|
169
|
-
Check if the permission is granted and let the peer enter a room.
|
|
170
|
-
"""
|
|
171
|
-
raw_message = await websocket.recv()
|
|
172
|
-
|
|
173
|
-
# The first event should always be 'join'
|
|
174
|
-
message: JoinRequest = JoinRequest.model_validate_json(raw_message)
|
|
175
|
-
signed = TimestampSigner().unsign_object(message.token, max_age=30)
|
|
176
|
-
user, map_id, permissions = signed.values()
|
|
177
|
-
|
|
178
|
-
# Check if permissions for this map have been granted by the server
|
|
179
|
-
if "edit" in signed["permissions"]:
|
|
180
|
-
await join_and_listen(map_id, permissions, user, websocket)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
def run(host: str, port: int):
|
|
184
|
-
if not settings.WEBSOCKET_ENABLED:
|
|
185
|
-
msg = (
|
|
186
|
-
"WEBSOCKET_ENABLED should be set to True to run the WebSocket Server. "
|
|
187
|
-
"See the documentation at "
|
|
188
|
-
"https://docs.umap-project.org/en/stable/config/settings/#websocket_enabled "
|
|
189
|
-
"for more information."
|
|
190
|
-
)
|
|
191
|
-
print(msg)
|
|
192
|
-
exit(1)
|
|
193
|
-
|
|
194
|
-
async def _serve():
|
|
195
|
-
async with serve(handler, host, port):
|
|
196
|
-
logging.debug(f"Waiting for connections on {host}:{port}")
|
|
197
|
-
await asyncio.Future() # run forever
|
|
198
|
-
|
|
199
|
-
try:
|
|
200
|
-
asyncio.run(_serve())
|
|
201
|
-
except KeyboardInterrupt:
|
|
202
|
-
print("Closing WebSocket server")
|
|
File without changes
|
|
File without changes
|