Disable websocket in sticker-creator
This commit is contained in:
parent
19f4bdd337
commit
f5a85a0488
2 changed files with 16 additions and 5 deletions
|
@ -212,6 +212,7 @@ window.encryptAndUpload = async (
|
||||||
const server = WebAPI.connect({
|
const server = WebAPI.connect({
|
||||||
username: username || oldUsername,
|
username: username || oldUsername,
|
||||||
password,
|
password,
|
||||||
|
disableWebSockets: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const uniqueStickers = uniqBy(
|
const uniqueStickers = uniqBy(
|
||||||
|
|
|
@ -753,8 +753,12 @@ type AjaxOptionsType = {
|
||||||
validateResponse?: any;
|
validateResponse?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type WebAPIConnectOptionsType = WebAPICredentials & {
|
||||||
|
disableWebSockets?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export type WebAPIConnectType = {
|
export type WebAPIConnectType = {
|
||||||
connect: (options: WebAPICredentials) => WebAPIType;
|
connect: (options: WebAPIConnectOptionsType) => WebAPIType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CapabilitiesType = {
|
export type CapabilitiesType = {
|
||||||
|
@ -1071,7 +1075,8 @@ export function initialize({
|
||||||
function connect({
|
function connect({
|
||||||
username: initialUsername,
|
username: initialUsername,
|
||||||
password: initialPassword,
|
password: initialPassword,
|
||||||
}: WebAPICredentials) {
|
disableWebSockets = false,
|
||||||
|
}: WebAPIConnectOptionsType) {
|
||||||
let username = initialUsername;
|
let username = initialUsername;
|
||||||
let password = initialPassword;
|
let password = initialPassword;
|
||||||
const PARSE_RANGE_HEADER = /\/(\d+)$/;
|
const PARSE_RANGE_HEADER = /\/(\d+)$/;
|
||||||
|
@ -1088,7 +1093,9 @@ export function initialize({
|
||||||
window.Whisper.events.trigger('unlinkAndDisconnect');
|
window.Whisper.events.trigger('unlinkAndDisconnect');
|
||||||
});
|
});
|
||||||
|
|
||||||
socketManager.authenticate({ username, password });
|
if (!disableWebSockets) {
|
||||||
|
socketManager.authenticate({ username, password });
|
||||||
|
}
|
||||||
|
|
||||||
// Thanks, function hoisting!
|
// Thanks, function hoisting!
|
||||||
return {
|
return {
|
||||||
|
@ -1156,7 +1163,8 @@ export function initialize({
|
||||||
param.urlParameters = '';
|
param.urlParameters = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const useWebSocket = WEBSOCKET_CALLS.has(param.call);
|
const useWebSocket =
|
||||||
|
!disableWebSockets && WEBSOCKET_CALLS.has(param.call);
|
||||||
|
|
||||||
return _outerAjax(null, {
|
return _outerAjax(null, {
|
||||||
socketManager: useWebSocket ? socketManager : undefined,
|
socketManager: useWebSocket ? socketManager : undefined,
|
||||||
|
@ -1210,7 +1218,9 @@ export function initialize({
|
||||||
username = newUsername;
|
username = newUsername;
|
||||||
password = newPassword;
|
password = newPassword;
|
||||||
|
|
||||||
await socketManager.authenticate({ username, password });
|
if (!disableWebSockets) {
|
||||||
|
await socketManager.authenticate({ username, password });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSocketStatus(): SocketStatus {
|
function getSocketStatus(): SocketStatus {
|
||||||
|
|
Loading…
Reference in a new issue