Mercurial > libervia-web
comparison libervia/server/restricted_bridge.py @ 1350:a32f3f47e4a8
server (restricted_bridge): added `interestsRegisterFileSharing` + filter extra_s in `FISInvite`
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 05 Sep 2020 21:59:20 +0200 |
parents | fe353fceec38 |
children | 4c51f22a813a |
comparison
equal
deleted
inserted
replaced
1349:886d1856e9de | 1350:a32f3f47e4a8 |
---|---|
15 | 15 |
16 # You should have received a copy of the GNU Affero General Public License | 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/>. | 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | 18 |
19 from libervia.server.constants import Const as C | 19 from libervia.server.constants import Const as C |
20 from sat.tools.common import data_format | |
20 | 21 |
21 | 22 |
22 class RestrictedBridge: | 23 class RestrictedBridge: |
23 """Bridge with limited access, which can be used in browser | 24 """Bridge with limited access, which can be used in browser |
24 | 25 |
54 async def fileSharingDelete( | 55 async def fileSharingDelete( |
55 self, service_jid, path, namespace, profile): | 56 self, service_jid, path, namespace, profile): |
56 return await self.host.bridgeCall( | 57 return await self.host.bridgeCall( |
57 "fileSharingDelete", service_jid, path, namespace, profile) | 58 "fileSharingDelete", service_jid, path, namespace, profile) |
58 | 59 |
60 async def interestsRegisterFileSharing( | |
61 self, service, repos_type, namespace, path, name, extra_s, profile | |
62 ): | |
63 if extra_s: | |
64 # we only allow "thumb_url" here | |
65 extra = data_format.deserialise(extra_s) | |
66 if "thumb_url" in extra: | |
67 extra_s = data_format.serialise({"thumb_url": extra["thumb_url"]}) | |
68 else: | |
69 extra_s = "" | |
70 | |
71 return await self.host.bridgeCall( | |
72 "interestsRegisterFileSharing", service, repos_type, namespace, path, name, | |
73 extra_s, profile | |
74 ) | |
75 | |
59 async def interestRetract( | 76 async def interestRetract( |
60 self, service_jid, item_id, profile | 77 self, service_jid, item_id, profile |
61 ): | 78 ): |
62 return await self.host.bridgeCall( | 79 return await self.host.bridgeCall( |
63 "interestRetract", service_jid, item_id, profile) | 80 "interestRetract", service_jid, item_id, profile) |
64 | 81 |
65 async def FISInvite( | 82 async def FISInvite( |
66 self, invitee_jid_s, service_s, repos_type, namespace, path, name, extra_s, | 83 self, invitee_jid_s, service_s, repos_type, namespace, path, name, extra_s, |
67 profile | 84 profile |
68 ): | 85 ): |
86 if extra_s: | |
87 # we only allow "thumb_url" here | |
88 extra = data_format.deserialise(extra_s) | |
89 if "thumb_url" in extra: | |
90 extra_s = data_format.serialise({"thumb_url": extra["thumb_url"]}) | |
91 else: | |
92 extra_s = "" | |
93 | |
69 return await self.host.bridgeCall( | 94 return await self.host.bridgeCall( |
70 "FISInvite", invitee_jid_s, service_s, repos_type, namespace, path, name, | 95 "FISInvite", invitee_jid_s, service_s, repos_type, namespace, path, name, |
71 extra_s, profile | 96 extra_s, profile |
72 ) | 97 ) |
73 | 98 |