Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(settings): verify hello-v1 response (shared secret) #14121

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/AdminSettings/SignalingServer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ export default {
{ caption: t('spreed', 'WebSocket URL'), description: signalingTest.url },
{ caption: t('spreed', 'Available features'), description: signalingTest.features.join(', ') },
]
if (signalingTest.hasFeature('hello-v2')) {
// additionally verify hello-v1 ticket
const signalingTestV1 = createConnection(settings, url, true)
await signalingTestV1.connect()
this.signalingTestInfo.push(
{ caption: t('spreed', '"Hello" response'), description: 'OK' },
)
}
} catch (exception) {
console.error(exception)
this.errorMessage = t('spreed', 'Error: Websocket connection failed. Check browser console')
Expand Down
10 changes: 6 additions & 4 deletions src/utils/SignalingStandaloneTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import { generateOcsUrl } from '@nextcloud/router'

class StandaloneTest {

constructor(settings, url) {
constructor(settings, url, forceHelloV1 = false) {
this.settings = settings
this.forceHelloV1 = forceHelloV1
this.features = null
this.version = null

Expand Down Expand Up @@ -128,7 +129,7 @@ class StandaloneTest {
}

sendHello() {
const version = this.hasFeature('hello-v2') ? '2.0' : '1.0'
const version = (!this.forceHelloV1 && this.hasFeature('hello-v2')) ? '2.0' : '1.0'

const msg = {
type: 'hello',
Expand Down Expand Up @@ -162,13 +163,14 @@ class StandaloneTest {
* Returns test instance
* @param {object} settings signaling settings
* @param {string} url HPB server URL
* @param {boolean} [forceHelloV1] param to test hello-v1 connection
*/
function createConnection(settings, url) {
function createConnection(settings, url, forceHelloV1 = false) {
if (!settings) {
console.error('Signaling settings are not given')
}

return new StandaloneTest(settings, url)
return new StandaloneTest(settings, url, forceHelloV1)
}

export { createConnection }
Loading