Преглед изворни кода

better integration : automatic token and username in example template

Guénaël Muller пре 7 година
родитељ
комит
e0fc13f795
2 измењених фајлова са 9 додато и 4 уклоњено
  1. 6 1
      tracim/tracim/controllers/root.py
  2. 3 3
      tracim/tracim/templates/videoconf.mak

+ 6 - 1
tracim/tracim/controllers/root.py Прегледај датотеку

@@ -32,6 +32,7 @@ from tracim.model.data import ContentType
32 32
 from tracim.model.serializers import Context
33 33
 from tracim.model.serializers import CTX
34 34
 from tracim.model.serializers import DictLikeClass
35
+from tracim.lib.jitsi_meet.jitsi_meet import JitsiMeetRoom
35 36
 
36 37
 
37 38
 class RootController(StandardController):
@@ -185,5 +186,9 @@ class RootController(StandardController):
185 186
         user = tmpl_context.current_user
186 187
         current_user_content = Context(CTX.CURRENT_USER).toDict(user)
187 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 Прегледај датотеку

@@ -44,8 +44,8 @@
44 44
         var options = {
45 45
 	    // jitsi-meet support now(10-2017) only one way to auto-auth, token,
46 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 49
             parentNode: document.querySelector('#jitsi'),
50 50
 	    // has external API use iframe, height is a problem
51 51
             height: 800,
@@ -83,7 +83,7 @@
83 83
         // when others clients use resource part of the Jabber id to do it.
84 84
         // That's why displayName compat with others XMPP client is not optimal.
85 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 87
         // We can override also avatar.
88 88
         api.executeCommand('avatarUrl', 'https://avatars0.githubusercontent.com/u/3671647');
89 89
     </script>