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