diff options
author | Joas Schilling <coding@schilljs.com> | 2021-06-14 12:33:01 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-06-14 12:33:13 +0300 |
commit | 32b3737ccd1a7459d985ca359e0d77783b0dc8c6 (patch) | |
tree | 73562c4aaefc2cad596335cd61f74a633a434a2f | |
parent | 4b0a2afbf689aeb48940d7c7e9280691a1980e00 (diff) |
Replace password with apptoken
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | docs/Talkbuchet.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/Talkbuchet.js b/docs/Talkbuchet.js index 535aaa0f1..ba5017eb8 100644 --- a/docs/Talkbuchet.js +++ b/docs/Talkbuchet.js @@ -22,8 +22,8 @@ /** * HOW TO SETUP: * ----------------------------------------------------------------------------- - * - Set the right values in "user" and "password" (a user must be used; guests - * do not work). + * - Set the right values in "user" and "appToken" (a user must be used; guests + * do not work; generate an apptoken at index.php/settings/user/security ). * - If HPB clustering is enabled, set the token of a conversation in "token" * (otherwise leave empty). * - Set whether to use audio, video or both in "mediaConstraints". @@ -127,7 +127,7 @@ // Regular users do not need to join the conversation, so the same user can be // connected several times to the HPB. const user = '' -const password = '' +const appToken = '' const signalingApiVersion = 2 // FIXME get from capabilities endpoint const conversationApiVersion = 3 // FIXME get from capabilities endpoint @@ -165,7 +165,7 @@ const subscribers = [] const stream = await navigator.mediaDevices.getUserMedia(mediaConstraints) -async function getSignalingSettings(user, password, token) { +async function getSignalingSettings(user, appToken, token) { const fetchOptions = { headers: { 'OCS-ApiRequest': true, @@ -174,7 +174,7 @@ async function getSignalingSettings(user, password, token) { } if (user) { - fetchOptions.headers['Authorization'] = 'Basic ' + btoa(user + ':' + password) + fetchOptions.headers['Authorization'] = 'Basic ' + btoa(user + ':' + appToken) } const signalingSettingsResponse = await fetch(signalingSettingsUrl + '?token=' + token, fetchOptions) @@ -519,7 +519,7 @@ function listenToPublisherConnectionChanges() { async function initPublishers() { for (let i = 0; i < publishersCount; i++) { - const signalingSettings = await getSignalingSettings(user, password, token) + const signalingSettings = await getSignalingSettings(user, appToken, token) let signaling = null try { signaling = new Signaling(user, signalingSettings) @@ -573,7 +573,7 @@ async function initSubscribers() { for (let i = 0; i < subscribersPerPublisherCount; i++) { // The same signaling session can be shared between subscribers to // different publishers. - const signalingSettings = await getSignalingSettings(user, password, token) + const signalingSettings = await getSignalingSettings(user, appToken, token) let signaling = null try { signaling = new Signaling(user, signalingSettings) |