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({
|
||||
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');
|
||||
});
|
||||
|
||||
socketManager.authenticate({ username, password });
|
||||
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,7 +1218,9 @@ export function initialize({
|
|||
username = newUsername;
|
||||
password = newPassword;
|
||||
|
||||
await socketManager.authenticate({ username, password });
|
||||
if (!disableWebSockets) {
|
||||
await socketManager.authenticate({ username, password });
|
||||
}
|
||||
}
|
||||
|
||||
function getSocketStatus(): SocketStatus {
|
||||
|
|
Loading…
Reference in a new issue