Mercurial > libervia-web
annotate libervia/web/server/restricted_bridge.py @ 1539:bc856e74f74d
server (restricted_bridge): add `url_preview_get`
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 28 Jun 2023 10:05:16 +0200 |
parents | 49ad8dd210d0 |
children | 7f3f5ae7d65a |
rev | line source |
---|---|
1287 | 1 #!/usr/bin/env python3 |
2 | |
3 # Libervia: a SàT frontend | |
1396 | 4 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) |
1287 | 5 |
6 # This program is free software: you can redistribute it and/or modify | |
7 # it under the terms of the GNU Affero General Public License as published by | |
8 # the Free Software Foundation, either version 3 of the License, or | |
9 # (at your option) any later version. | |
10 | |
11 # This program is distributed in the hope that it will be useful, | |
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 # GNU Affero General Public License for more details. | |
15 | |
16 # You should have received a copy of the GNU Affero General Public License | |
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | |
1518
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1516
diff
changeset
|
19 from libervia.backend.tools.common import data_format |
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1516
diff
changeset
|
20 from libervia.backend.core import exceptions |
eb00d593801d
refactoring: rename `libervia` to `libervia.web` + update imports following backend changes
Goffi <goffi@goffi.org>
parents:
1516
diff
changeset
|
21 from libervia.web.server.constants import Const as C |
1287 | 22 |
23 | |
24 class RestrictedBridge: | |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
25 """bridge with limited access, which can be used in browser |
1287 | 26 |
27 Only a few method are implemented, with potentially dangerous argument controlled. | |
28 Security limit is used | |
29 """ | |
30 | |
31 def __init__(self, host): | |
32 self.host = host | |
33 self.security_limit = C.SECURITY_LIMIT | |
34 | |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
35 def no_service_profile(self, profile): |
1480
e739600267cd
server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents:
1414
diff
changeset
|
36 """Raise an error if service profile is used""" |
e739600267cd
server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents:
1414
diff
changeset
|
37 if profile == C.SERVICE_PROFILE: |
e739600267cd
server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents:
1414
diff
changeset
|
38 raise exceptions.PermissionError( |
e739600267cd
server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents:
1414
diff
changeset
|
39 "This action is not allowed for service profile" |
e739600267cd
server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents:
1414
diff
changeset
|
40 ) |
e739600267cd
server (restricted_bridge): don't allow bridge methods modifying anything with service profile
Goffi <goffi@goffi.org>
parents:
1414
diff
changeset
|
41 |
1516
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
42 async def action_launch( |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
43 self, callback_id: str, data_s: str, profile: str |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
44 ) -> str: |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
45 self.no_service_profile(profile) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
46 return await self.host.bridge_call( |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
47 "action_launch", callback_id, data_s, profile |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
48 ) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
49 |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
50 async def call_start(self, entity: str, call_data_s: str, profile: str) -> None: |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
51 self.no_service_profile(profile) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
52 return await self.host.bridge_call( |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
53 "call_start", entity, call_data_s, profile |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
54 ) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
55 |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
56 async def call_end(self, session_id: str, call_data: str, profile: str) -> None: |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
57 self.no_service_profile(profile) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
58 return await self.host.bridge_call( |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
59 "call_end", session_id, call_data, profile |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
60 ) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
61 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
62 async def contacts_get(self, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
63 return await self.host.bridge_call("contacts_get", profile) |
1329
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
64 |
1516
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
65 async def external_disco_get(self, entity, profile): |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
66 self.no_service_profile(profile) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
67 return await self.host.bridge_call( |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
68 "external_disco_get", entity, profile) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
69 |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
70 async def ice_candidates_add(self, session_id, media_ice_data_s, profile): |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
71 self.no_service_profile(profile) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
72 return await self.host.bridge_call( |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
73 "ice_candidates_add", session_id, media_ice_data_s, profile |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
74 ) |
a3ca1bab6eb1
server, restricted bridge: add new methods and signals to prepare calls implementation:
Goffi <goffi@goffi.org>
parents:
1509
diff
changeset
|
75 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
76 async def identity_get(self, entity, metadata_filter, use_cache, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
77 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
78 "identity_get", entity, metadata_filter, use_cache, profile) |
1329
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
79 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
80 async def identities_get(self, entities, metadata_filter, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
81 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
82 "identities_get", entities, metadata_filter, profile) |
1329
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
83 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
84 async def identities_base_get(self, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
85 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
86 "identities_base_get", profile) |
1329
ed28ad7d484c
browser (cache): new `cache` module to handle cache of roster and identities:
Goffi <goffi@goffi.org>
parents:
1315
diff
changeset
|
87 |
1534
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
88 async def message_send( |
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
89 self, to_jid_s, message, subject, mess_type, extra_s, |
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
90 profile |
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
91 ): |
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
92 self.no_service_profile(profile) |
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
93 return await self.host.bridge_call( |
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
94 "message_send", to_jid_s, message, subject, mess_type, extra_s, profile |
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
95 ) |
49ad8dd210d0
server (restricted_bridge): add `message_send` method
Goffi <goffi@goffi.org>
parents:
1518
diff
changeset
|
96 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
97 async def ps_node_delete(self, service_s, node, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
98 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
99 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
100 "ps_node_delete", service_s, node, profile) |
1379
4c51f22a813a
server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents:
1350
diff
changeset
|
101 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
102 async def ps_node_affiliations_set(self, service_s, node, affiliations, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
103 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
104 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
105 "ps_node_affiliations_set", service_s, node, affiliations, profile) |
1379
4c51f22a813a
server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents:
1350
diff
changeset
|
106 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
107 async def ps_item_retract(self, service_s, node, item_id, notify, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
108 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
109 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
110 "ps_item_retract", service_s, node, item_id, notify, profile) |
1379
4c51f22a813a
server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents:
1350
diff
changeset
|
111 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
112 async def mb_preview(self, service_s, node, data, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
113 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
114 "mb_preview", service_s, node, data, profile) |
1414
97b8ce9ce54b
server (restricted_bridge): add mbPreview
Goffi <goffi@goffi.org>
parents:
1396
diff
changeset
|
115 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
116 async def list_set(self, service_s, node, values, schema, item_id, extra, profile): |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
117 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
118 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
119 "list_set", service_s, node, values, "", item_id, "", profile) |
1391
fc20818a5266
server (restricted_bridge): add `listSet` method
Goffi <goffi@goffi.org>
parents:
1379
diff
changeset
|
120 |
fc20818a5266
server (restricted_bridge): add `listSet` method
Goffi <goffi@goffi.org>
parents:
1379
diff
changeset
|
121 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
122 async def file_http_upload_get_slot( |
1287 | 123 self, filename, size, content_type, upload_jid, profile): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
124 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
125 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
126 "file_http_upload_get_slot", filename, size, content_type, |
1287 | 127 upload_jid, profile) |
1295
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
128 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
129 async def file_sharing_delete( |
1295
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
130 self, service_jid, path, namespace, profile): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
131 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
132 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
133 "file_sharing_delete", service_jid, path, namespace, profile) |
1295
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
134 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
135 async def interests_file_sharing_register( |
1350
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
136 self, service, repos_type, namespace, path, name, extra_s, profile |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
137 ): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
138 self.no_service_profile(profile) |
1350
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
139 if extra_s: |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
140 # we only allow "thumb_url" here |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
141 extra = data_format.deserialise(extra_s) |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
142 if "thumb_url" in extra: |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
143 extra_s = data_format.serialise({"thumb_url": extra["thumb_url"]}) |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
144 else: |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
145 extra_s = "" |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
146 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
147 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
148 "interests_file_sharing_register", service, repos_type, namespace, path, name, |
1350
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
149 extra_s, profile |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
150 ) |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
151 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
152 async def interest_retract( |
1295
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
153 self, service_jid, item_id, profile |
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
154 ): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
155 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
156 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
157 "interest_retract", service_jid, item_id, profile) |
1295
0930b06f022f
server (restricted_bridge): added fileSharingDelete and interestRetract
Goffi <goffi@goffi.org>
parents:
1287
diff
changeset
|
158 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
159 async def ps_invite( |
1379
4c51f22a813a
server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents:
1350
diff
changeset
|
160 self, invitee_jid_s, service_s, node, item_id, name, extra_s, profile |
4c51f22a813a
server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents:
1350
diff
changeset
|
161 ): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
162 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
163 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
164 "ps_invite", invitee_jid_s, service_s, node, item_id, name, extra_s, profile |
1379
4c51f22a813a
server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents:
1350
diff
changeset
|
165 ) |
4c51f22a813a
server (restricted_bridge): added `psNodeDelete`, `psNodeAffiliationsSet`, `psItemRetract` and `psInvite`
Goffi <goffi@goffi.org>
parents:
1350
diff
changeset
|
166 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
167 async def fis_invite( |
1315
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
168 self, invitee_jid_s, service_s, repos_type, namespace, path, name, extra_s, |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
169 profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
170 ): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
171 self.no_service_profile(profile) |
1350
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
172 if extra_s: |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
173 # we only allow "thumb_url" here |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
174 extra = data_format.deserialise(extra_s) |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
175 if "thumb_url" in extra: |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
176 extra_s = data_format.serialise({"thumb_url": extra["thumb_url"]}) |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
177 else: |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
178 extra_s = "" |
a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
Goffi <goffi@goffi.org>
parents:
1331
diff
changeset
|
179 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
180 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
181 "fis_invite", invitee_jid_s, service_s, repos_type, namespace, path, name, |
1315
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
182 extra_s, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
183 ) |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
184 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
185 async def fis_affiliations_set( |
1315
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
186 self, service_s, namespace, path, affiliations, profile |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
187 ): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
188 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
189 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
190 "fis_affiliations_set", service_s, namespace, path, affiliations, profile |
1315
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
191 ) |
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
192 |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
193 async def invitation_simple_create( |
1331
fe353fceec38
browser (invitation, photos/album): invitation manager improvments:
Goffi <goffi@goffi.org>
parents:
1329
diff
changeset
|
194 self, invitee_email, invitee_name, url_template, extra_s, profile |
fe353fceec38
browser (invitation, photos/album): invitation manager improvments:
Goffi <goffi@goffi.org>
parents:
1329
diff
changeset
|
195 ): |
1509
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
196 self.no_service_profile(profile) |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
197 return await self.host.bridge_call( |
106bae41f5c8
massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents:
1480
diff
changeset
|
198 "invitation_simple_create", invitee_email, invitee_name, url_template, extra_s, |
1331
fe353fceec38
browser (invitation, photos/album): invitation manager improvments:
Goffi <goffi@goffi.org>
parents:
1329
diff
changeset
|
199 profile |
1315
991ff12241e0
server (restricted_bridge): added `FISInvite`, `FISAffiliationsSet` and `invitationSimpleCreate`
Goffi <goffi@goffi.org>
parents:
1295
diff
changeset
|
200 ) |
1539
bc856e74f74d
server (restricted_bridge): add `url_preview_get`
Goffi <goffi@goffi.org>
parents:
1534
diff
changeset
|
201 |
bc856e74f74d
server (restricted_bridge): add `url_preview_get`
Goffi <goffi@goffi.org>
parents:
1534
diff
changeset
|
202 async def url_preview_get( |
bc856e74f74d
server (restricted_bridge): add `url_preview_get`
Goffi <goffi@goffi.org>
parents:
1534
diff
changeset
|
203 self, url, options_s, profile |
bc856e74f74d
server (restricted_bridge): add `url_preview_get`
Goffi <goffi@goffi.org>
parents:
1534
diff
changeset
|
204 ): |
bc856e74f74d
server (restricted_bridge): add `url_preview_get`
Goffi <goffi@goffi.org>
parents:
1534
diff
changeset
|
205 self.no_service_profile(profile) |
bc856e74f74d
server (restricted_bridge): add `url_preview_get`
Goffi <goffi@goffi.org>
parents:
1534
diff
changeset
|
206 return await self.host.bridge_call( |
bc856e74f74d
server (restricted_bridge): add `url_preview_get`
Goffi <goffi@goffi.org>
parents:
1534
diff
changeset
|
207 "url_preview_get", url, options_s, profile |
bc856e74f74d
server (restricted_bridge): add `url_preview_get`
Goffi <goffi@goffi.org>
parents:
1534
diff
changeset
|
208 ) |