Files
whatsapp-web.js/src/util/Constants.js
༺ LᴇG̸ᴇɴD ༻ 76f7a6e279 feat: RemoteAuth Strategy (#1450)
* index.js

* [authReady] - new BaseAuthStrategy function

* [RemoteAuth] - new Class RemoteAuth added

* Eslint Fixes

* Eslint Fixes

* Added types for RemoteAuth (mostly assumed types from PR message and src/authStrategies/RemoteAuth.js)

* [dependency updates] - added unzipper & archiver

* [Types] - Fixing typescript declarations

* Renaming Base Class Hook

* auth hook rename on client

* [Error Handling] - Delegate responsability to end users

* [Refactor] - deletemetadata code refactor

* [Refactor] - backupSyncIntervalMs renamed

* [Refactor] - Minor improvement on deleteMetadata

* [Refactor] - backupSyncIntervalMs rename on index.d.ts

* [Update] - Fix for Ubuntu crahsing on extractSession

* [Update] - Delegate responsability to stores of making sure the previous session is deleted strictly only after the new one is saved

* [Update] - Improve file paths handling & naming (reduce assumptions between RemoteAuth and stores)

* [Update] - Adding new event <REMOTE_SESSION_SAVED> on Constants.js

* [Update] - Adding new authHooks <destroy> & <disconnect>

* [Update] - Adding <destroy> & <disconnect> hooks on Client.js

* [Update] - Adding new features to index.d.ts

* [RemoteAuth] - New Features added to RemoteAuth Class

* [dependency updates] - added fs-extra

* [Cross Platform] - Windows is now compatible with RemoteAuth

* [optionalDependencies] - moved archiver, fs-extra & unzipper to optional dependencies on package.json

* [optionalDependencies] - adding validation for when optional dependencies are missing

* [Update] - Node Deprecation warining for rmdir changed for rm instead

Co-authored-by: h110m <nichtwitzig228@gmail.com>
2022-08-10 13:03:07 +02:00

162 lines
3.5 KiB
JavaScript

'use strict';
exports.WhatsWebURL = 'https://web.whatsapp.com/';
exports.DefaultOptions = {
puppeteer: {
headless: true,
defaultViewport: null
},
authTimeoutMs: 0,
qrMaxRetries: 0,
takeoverOnConflict: false,
takeoverTimeoutMs: 0,
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36',
ffmpegPath: 'ffmpeg',
bypassCSP: false
};
/**
* Client status
* @readonly
* @enum {number}
*/
exports.Status = {
INITIALIZING: 0,
AUTHENTICATING: 1,
READY: 3
};
/**
* Events that can be emitted by the client
* @readonly
* @enum {string}
*/
exports.Events = {
AUTHENTICATED: 'authenticated',
AUTHENTICATION_FAILURE: 'auth_failure',
READY: 'ready',
MESSAGE_RECEIVED: 'message',
MESSAGE_CREATE: 'message_create',
MESSAGE_REVOKED_EVERYONE: 'message_revoke_everyone',
MESSAGE_REVOKED_ME: 'message_revoke_me',
MESSAGE_ACK: 'message_ack',
MESSAGE_REACTION: 'message_reaction',
MEDIA_UPLOADED: 'media_uploaded',
GROUP_JOIN: 'group_join',
GROUP_LEAVE: 'group_leave',
GROUP_UPDATE: 'group_update',
QR_RECEIVED: 'qr',
LOADING_SCREEN: 'loading_screen',
DISCONNECTED: 'disconnected',
STATE_CHANGED: 'change_state',
BATTERY_CHANGED: 'change_battery',
INCOMING_CALL: 'incoming_call',
REMOTE_SESSION_SAVED: 'remote_session_saved'
};
/**
* Message types
* @readonly
* @enum {string}
*/
exports.MessageTypes = {
TEXT: 'chat',
AUDIO: 'audio',
VOICE: 'ptt',
IMAGE: 'image',
VIDEO: 'video',
DOCUMENT: 'document',
STICKER: 'sticker',
LOCATION: 'location',
CONTACT_CARD: 'vcard',
CONTACT_CARD_MULTI: 'multi_vcard',
ORDER: 'order',
REVOKED: 'revoked',
PRODUCT: 'product',
UNKNOWN: 'unknown',
GROUP_INVITE: 'groups_v4_invite',
LIST: 'list',
LIST_RESPONSE: 'list_response',
BUTTONS_RESPONSE: 'buttons_response',
PAYMENT: 'payment',
BROADCAST_NOTIFICATION: 'broadcast_notification',
CALL_LOG: 'call_log',
CIPHERTEXT: 'ciphertext',
DEBUG: 'debug',
E2E_NOTIFICATION: 'e2e_notification',
GP2: 'gp2',
GROUP_NOTIFICATION: 'group_notification',
HSM: 'hsm',
INTERACTIVE: 'interactive',
NATIVE_FLOW: 'native_flow',
NOTIFICATION: 'notification',
NOTIFICATION_TEMPLATE: 'notification_template',
OVERSIZED: 'oversized',
PROTOCOL: 'protocol',
REACTION: 'reaction',
TEMPLATE_BUTTON_REPLY: 'template_button_reply',
};
/**
* Group notification types
* @readonly
* @enum {string}
*/
exports.GroupNotificationTypes = {
ADD: 'add',
INVITE: 'invite',
REMOVE: 'remove',
LEAVE: 'leave',
SUBJECT: 'subject',
DESCRIPTION: 'description',
PICTURE: 'picture',
ANNOUNCE: 'announce',
RESTRICT: 'restrict',
};
/**
* Chat types
* @readonly
* @enum {string}
*/
exports.ChatTypes = {
SOLO: 'solo',
GROUP: 'group',
UNKNOWN: 'unknown'
};
/**
* WhatsApp state
* @readonly
* @enum {string}
*/
exports.WAState = {
CONFLICT: 'CONFLICT',
CONNECTED: 'CONNECTED',
DEPRECATED_VERSION: 'DEPRECATED_VERSION',
OPENING: 'OPENING',
PAIRING: 'PAIRING',
PROXYBLOCK: 'PROXYBLOCK',
SMB_TOS_BLOCK: 'SMB_TOS_BLOCK',
TIMEOUT: 'TIMEOUT',
TOS_BLOCK: 'TOS_BLOCK',
UNLAUNCHED: 'UNLAUNCHED',
UNPAIRED: 'UNPAIRED',
UNPAIRED_IDLE: 'UNPAIRED_IDLE'
};
/**
* Message ACK
* @readonly
* @enum {number}
*/
exports.MessageAck = {
ACK_ERROR: -1,
ACK_PENDING: 0,
ACK_SERVER: 1,
ACK_DEVICE: 2,
ACK_READ: 3,
ACK_PLAYED: 4,
};