Use authorization header for websocket authentication
This commit is contained in:
parent
276a145fea
commit
f730b0c82b
3 changed files with 7 additions and 6 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -126,7 +126,7 @@
|
||||||
"@indutny/parallel-prettier": "3.0.0",
|
"@indutny/parallel-prettier": "3.0.0",
|
||||||
"@indutny/rezip-electron": "1.3.1",
|
"@indutny/rezip-electron": "1.3.1",
|
||||||
"@indutny/symbolicate-mac": "2.3.0",
|
"@indutny/symbolicate-mac": "2.3.0",
|
||||||
"@signalapp/mock-server": "6.11.0",
|
"@signalapp/mock-server": "7.0.1",
|
||||||
"@storybook/addon-a11y": "8.1.11",
|
"@storybook/addon-a11y": "8.1.11",
|
||||||
"@storybook/addon-actions": "8.1.11",
|
"@storybook/addon-actions": "8.1.11",
|
||||||
"@storybook/addon-controls": "8.1.11",
|
"@storybook/addon-controls": "8.1.11",
|
||||||
|
@ -7274,9 +7274,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@signalapp/mock-server": {
|
"node_modules/@signalapp/mock-server": {
|
||||||
"version": "6.11.0",
|
"version": "7.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@signalapp/mock-server/-/mock-server-6.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@signalapp/mock-server/-/mock-server-7.0.1.tgz",
|
||||||
"integrity": "sha512-wIPUtsLcngcum0dkGuJ1YfTuWso7DhH0JZUA5ZS82XlmF2Qz0ZF03AdeeNcQx4XY4mJU1+nIEhTZpB0AFqEM4Q==",
|
"integrity": "sha512-iwH57apXyTHKjozaV1ZJW6nbVhFH3KlVOQYaJiO2bT3YgAGdYoJvHp8+MMIQ8OFYVGRo3g7wouqX/JT5HElAvw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -210,7 +210,7 @@
|
||||||
"@indutny/parallel-prettier": "3.0.0",
|
"@indutny/parallel-prettier": "3.0.0",
|
||||||
"@indutny/rezip-electron": "1.3.1",
|
"@indutny/rezip-electron": "1.3.1",
|
||||||
"@indutny/symbolicate-mac": "2.3.0",
|
"@indutny/symbolicate-mac": "2.3.0",
|
||||||
"@signalapp/mock-server": "6.11.0",
|
"@signalapp/mock-server": "7.0.1",
|
||||||
"@storybook/addon-a11y": "8.1.11",
|
"@storybook/addon-a11y": "8.1.11",
|
||||||
"@storybook/addon-actions": "8.1.11",
|
"@storybook/addon-actions": "8.1.11",
|
||||||
"@storybook/addon-controls": "8.1.11",
|
"@storybook/addon-controls": "8.1.11",
|
||||||
|
|
|
@ -42,6 +42,7 @@ import { ConnectTimeoutError, HTTPError } from './Errors';
|
||||||
import type { IRequestHandler, WebAPICredentials } from './Types.d';
|
import type { IRequestHandler, WebAPICredentials } from './Types.d';
|
||||||
import { connect as connectWebSocket } from './WebSocket';
|
import { connect as connectWebSocket } from './WebSocket';
|
||||||
import { isAlpha, isBeta, isStaging } from '../util/version';
|
import { isAlpha, isBeta, isStaging } from '../util/version';
|
||||||
|
import { getBasicAuth } from '../util/getBasicAuth';
|
||||||
|
|
||||||
const FIVE_MINUTES = 5 * durations.MINUTE;
|
const FIVE_MINUTES = 5 * durations.MINUTE;
|
||||||
|
|
||||||
|
@ -192,7 +193,6 @@ export class SocketManager extends EventListener {
|
||||||
: this.connectResource({
|
: this.connectResource({
|
||||||
name: AUTHENTICATED_CHANNEL_NAME,
|
name: AUTHENTICATED_CHANNEL_NAME,
|
||||||
path: '/v1/websocket/',
|
path: '/v1/websocket/',
|
||||||
query: { login: username, password },
|
|
||||||
resourceOptions: {
|
resourceOptions: {
|
||||||
name: AUTHENTICATED_CHANNEL_NAME,
|
name: AUTHENTICATED_CHANNEL_NAME,
|
||||||
keepalive: { path: '/v1/keepalive' },
|
keepalive: { path: '/v1/keepalive' },
|
||||||
|
@ -201,6 +201,7 @@ export class SocketManager extends EventListener {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
extraHeaders: {
|
extraHeaders: {
|
||||||
|
Authorization: getBasicAuth({ username, password }),
|
||||||
'X-Signal-Receive-Stories': String(!this.hasStoriesDisabled),
|
'X-Signal-Receive-Stories': String(!this.hasStoriesDisabled),
|
||||||
},
|
},
|
||||||
proxyAgent,
|
proxyAgent,
|
||||||
|
|
Loading…
Reference in a new issue