Browse Source

better integration : automatic token and username in example template

Guénaël Muller 7 years ago
parent
commit
e0fc13f795
2 changed files with 9 additions and 4 deletions
  1. 6 1
      tracim/tracim/controllers/root.py
  2. 3 3
      tracim/tracim/templates/videoconf.mak

+ 6 - 1
tracim/tracim/controllers/root.py View File

32
 from tracim.model.serializers import Context
32
 from tracim.model.serializers import Context
33
 from tracim.model.serializers import CTX
33
 from tracim.model.serializers import CTX
34
 from tracim.model.serializers import DictLikeClass
34
 from tracim.model.serializers import DictLikeClass
35
+from tracim.lib.jitsi_meet.jitsi_meet import JitsiMeetRoom
35
 
36
 
36
 
37
 
37
 class RootController(StandardController):
38
 class RootController(StandardController):
185
         user = tmpl_context.current_user
186
         user = tmpl_context.current_user
186
         current_user_content = Context(CTX.CURRENT_USER).toDict(user)
187
         current_user_content = Context(CTX.CURRENT_USER).toDict(user)
187
         fake_api = Context(CTX.CURRENT_USER).toDict({'current_user': current_user_content})
188
         fake_api = Context(CTX.CURRENT_USER).toDict({'current_user': current_user_content})
189
+        room = 'test'
190
+        token = JitsiMeetRoom.generate_token(room)
188
 
191
 
189
-        return DictLikeClass(fake_api=fake_api)
192
+        return DictLikeClass(fake_api=fake_api,
193
+                             token=token,
194
+                             room=room)

+ 3 - 3
tracim/tracim/templates/videoconf.mak View File

44
         var options = {
44
         var options = {
45
 	    // jitsi-meet support now(10-2017) only one way to auto-auth, token,
45
 	    // jitsi-meet support now(10-2017) only one way to auto-auth, token,
46
 	    // which is anonymous BOSH auth with specific url (with token value in params of the url).
46
 	    // which is anonymous BOSH auth with specific url (with token value in params of the url).
47
-	    jwt:"INSERTTOKENHERE",
48
-            roomName : "test",
47
+            jwt: '${token}',
48
+            roomName : '${room}',
49
             parentNode: document.querySelector('#jitsi'),
49
             parentNode: document.querySelector('#jitsi'),
50
 	    // has external API use iframe, height is a problem
50
 	    // has external API use iframe, height is a problem
51
             height: 800,
51
             height: 800,
83
         // when others clients use resource part of the Jabber id to do it.
83
         // when others clients use resource part of the Jabber id to do it.
84
         // That's why displayName compat with others XMPP client is not optimal.
84
         // That's why displayName compat with others XMPP client is not optimal.
85
         // check this : https://github.com/jitsi/jitsi-meet/pull/2068
85
         // check this : https://github.com/jitsi/jitsi-meet/pull/2068
86
-        api.executeCommand('displayName', 'Bidule');
86
+        api.executeCommand('displayName', '${fake_api.current_user.name}');
87
         // We can override also avatar.
87
         // We can override also avatar.
88
         api.executeCommand('avatarUrl', 'https://avatars0.githubusercontent.com/u/3671647');
88
         api.executeCommand('avatarUrl', 'https://avatars0.githubusercontent.com/u/3671647');
89
     </script>
89
     </script>