@open-wa/wa-automate 4.30.8 → 4.30.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/config-schema.json +1 -1
- package/dist/api/Client.js +3 -2
- package/dist/cli/cli-options.d.ts +9 -0
- package/dist/cli/cli-options.js +229 -0
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.js +7 -232
- package/dist/controllers/auth.js +1 -0
- package/dist/controllers/initializer.js +2 -0
- package/package.json +11 -11
package/bin/config-schema.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
[{"env":"WA_SESSION_DATA","p":"session-data","description":"The base64 encoded sessionData used to restore a session.","type":"string","key":"sessionData"},{"env":"WA_BROWSER_WS_ENDPOINT","p":"browser-ws-endpoint","type":"string","description":"ALPHA EXPERIMENTAL FEATURE! DO NOT USE IN PRODUCTION, REQUIRES TESTING.\n\nLearn more:\n\nhttps://pptr.dev/#?product=Puppeteer&version=v3.1.0&show=api-puppeteerconnectoptions\n\nhttps://medium.com/@jaredpotter1/connecting-puppeteer-to-existing-chrome-window-8a10828149e0","key":"browserWSEndpoint"},{"env":"WA_SESSION_DATA_PATH","p":"session-data-path","type":"string","description":"The path relative to the current working directory (i.e where you run the command to start your process). This will be used to store and read your `.data.json` files. defualt to ''","key":"sessionDataPath"},{"env":"WA_SKIP_UPDATE_CHECK","p":"skip-update-check","type":"boolean","description":"If set to true, `skipUpdateCheck` will bypass the latest version check. This saves some time on boot (around 150 ms).","key":"skipUpdateCheck"},{"env":"WA_SESSION_ID","p":"session-id","type":"string","description":"This is the name of the session. You have to make sure that this is unique for every session.","key":"sessionId"},{"env":"WA_LICENSE_KEY","p":"license-key","description":"The license key to use with the session.","type":"string","key":"licenseKey"},{"env":"WA_CUSTOM_USER_AGENT","p":"custom-user-agent","type":"string","description":"You may set a custom user agent. However, due to recent developments, this is not really neccessary any more.","key":"customUserAgent"},{"env":"WA_BLOCK_CRASH_LOGS","p":"block-crash-logs","type":"boolean","description":"Setting this to true will block any network calls to crash log servers. This should keep anything you do under the radar.","key":"blockCrashLogs"},{"env":"WA_CACHE_ENABLED","p":"cache-enabled","type":"boolean","description":"Setting this to false turn off the cache. This may improve memory usage.","key":"cacheEnabled"},{"env":"WA_BROWSER_REVISION","p":"browser-revision","type":"string","description":"This is the specific browser revision to be downlaoded and used. You can find browser revision strings here: http://omahaproxy.appspot.com/ Learn more about it here: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-browserfetcher If you're having trouble with sending images, try '737027'. If you go too far back things will start breaking !!!!!! NOTE: THIS WILL OVERRIDE useChrome and executablePath. ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING.","key":"browserRevision"},{"env":"WA_HEADLESS","p":"headless","type":"boolean","description":"By default, all instances of @open-wa/wa-automate are headless (i.e you don't see a chrome window open), you can set this to false to show the chrome/chromium window.","key":"headless"},{"env":"WA_QR_TIMEOUT","p":"qr-timeout","type":"number","description":"This determines how long the process should wait for a QR code to be scanned before killing the process entirely. To have the system wait continuously, set this to `0`.","default":60,"key":"qrTimeout"},{"env":"WA_USE_CHROME","p":"use-chrome","type":"boolean","description":"If true, the program will automatically try to detect the instance of chorme on the machine. Please note this DOES NOT override executablePath.","key":"useChrome"},{"env":"WA_QR_LOG_SKIP","p":"qr-log-skip","type":"boolean","description":"If true, skips logging the QR Code to the console.","key":"qrLogSkip"},{"env":"WA_DISABLE_SPINS","p":"disable-spins","type":"boolean","description":"Setting this to true will simplify logs for use within docker containers by disabling spins (will still print raw messages).","key":"disableSpins"},{"env":"WA_LOG_CONSOLE","p":"log-console","type":"boolean","description":"If true, this will log any console messages from the browser.","key":"logConsole"},{"env":"WA_LOG_CONSOLE_ERRORS","p":"log-console-errors","type":"boolean","description":"If true, this will log any error messages from the browser instance","key":"logConsoleErrors"},{"env":"WA_AUTH_TIMEOUT","p":"auth-timeout","type":"number","description":"This determines how long the process should wait for the session authentication. If exceeded, checks if phone is out of reach (turned of or without internet connection) and throws an error. It does not relate to the amount of time spent waiting for a qr code scan (see [[qrTimeout]]). To have the system wait continuously, set this to `0`.","key":"authTimeout"},{"env":"WA_SAFE_MODE","p":"safe-mode","type":"boolean","description":"If true, client will check if the page is valid before each command. If page is not valid, it will throw an error.","key":"safeMode"},{"env":"WA_SKIP_SESSION_SAVE","p":"skip-session-save","type":"boolean","description":"If true, the process will not save a data.json file. This means that sessions will not be saved and you will need to pass sessionData as a config param or create the session data.json file yourself","key":"skipSessionSave"},{"env":"WA_POPUP","p":"popup","type":["boolean","number"],"description":"If true, the process will open a browser window where you will see basic event logs and QR codes to authenticate the session. Usually it will open on port 3000. It can also be set to a preferred port.\n\nYou can also get the QR code png at (if localhost and port 3000):\n\n`http://localhost:3000/qr`\n\nor if you have multiple session:\n\n `http://localhost:3000/qr?sessionId=[sessionId]`","key":"popup"},{"env":"WA_QR_POP_UP_ONLY","p":"qr-pop-up-only","type":"boolean","description":"This needs to be used in conjuction with `popup`, if `popup` is not true or a number (representing a desired port) then this will not work.\n\nSetting this to true will make sure that only the qr code png is served via the web server. This is useful if you do not need the whole status page.\n\nAs mentioned in [popup](#popup), the url for the qr code is `http://localhost:3000/qr` if the port is 3000.","key":"qrPopUpOnly"},{"env":"WA_BLOCK_ASSETS","p":"block-assets","type":"boolean","description":"Setting this to true will block all assets from loading onto the page. This may result in some load time improvements but also increases instability.","key":"blockAssets"},{"env":"WA_KEEP_UPDATED","p":"keep-updated","type":"boolean","description":"[ALPHA FEATURE - ONLY IMPLEMENTED FOR TESTING - DO NOT USE IN PRODUCTION YET] Setting this to true will result in the library making sure it is always starting with the latest version of itself. This overrides `skipUpdateCheck`.","key":"keepUpdated"},{"env":"WA_RESIZABLE","p":"resizable","type":"boolean","description":"Syncs the viewport size with the window size which is how normal browsers act. Only relevant when `headless: false` and this overrides `viewport` config.","key":"resizable"},{"env":"WA_VIEWPORT","p":"viewport","type":"object","properties":{"width":{"type":"number","description":"Page width in pixels"},"height":{"type":"number","description":"Page height in pixels"}},"additionalProperties":false,"description":"Set the desired viewport height and width. For CLI, use [width]x[height] format. E.g `--viewport 1920x1080`.","key":"viewport"},{"env":"WA_LEGACY","p":"legacy","type":"boolean","description":"As the library is constantly evolving, some parts will be replaced with more efficient and improved code. In some of the infinite edge cases these new changes may not work for you. Set this to true to roll back on 'late beta' features. The reason why legacy is false by default is that in order for features to be tested they have to be released and used by everyone to find the edge cases and fix them.","key":"legacy"},{"env":"WA_DELETE_SESSION_DATA_ON_LOGOUT","p":"delete-session-data-on-logout","type":"boolean","description":"Deletes the session data file (if found) on logout event. This results in a quicker login when you restart the process.","key":"deleteSessionDataOnLogout"},{"env":"WA_KILL_PROCESS_ON_TIMEOUT","p":"kill-process-on-timeout","type":"boolean","description":"If set to true, the system will kill the whole node process when either an [[authTimeout]] or a [[qrTimeout]] has been reached. This is useful to prevent hanging processes.","key":"killProcessOnTimeout"},{"env":"WA_CORS_FIX","p":"cors-fix","type":"boolean","description":"Setting this to true will bypass web security. DO NOT DO THIS IF YOU DO NOT HAVE TO. CORS issue may arise when using a proxy.","key":"corsFix"},{"env":"WA_CALL_TIMEOUT","p":"call-timeout","type":"number","description":"Amount of time (in ms) to wait for a client method (specifically methods that interact with the WA web session) to resolve. If a client method results takes longer than the timout value then it will result in a [[PageEvaluationTimeout]] error.\n\nIf you get this error, it does not automatically mean that the method failed - it just stops your program from waiting for a client method to resolve.\n\nThis is useful if you do not rely on the results of a client method (e.g the message ID).\n\nIf set to `0`, the process will wait indefinitely for a client method to resolve.","default":0,"key":"callTimeout"},{"env":"WA_SCREENSHOT_ON_INITIALIZATION_BROWSER_ERROR","p":"screenshot-on-initialization-browser-error","type":"boolean","description":"When true, this option will take a screenshot of the browser when an unexpected error occurs within the browser during `create` initialization. The path will be `[working directory]/logs/[session ID]/[start timestamp]/[timestamp].jpg`","key":"screenshotOnInitializationBrowserError"},{"env":"WA_EVENT_MODE","p":"event-mode","type":"boolean","description":"Setting listeners may not be your cup of tea. With eventMode, all [[SimpleListener]] events will be registered automatically and be filed via the built in Events Listener.\n\nThis is useful because you can register/deregister the event listener as needed whereas the legacy method of setting callbacks are only be set once","key":"eventMode"},{"env":"WA_LOG_FILE","p":"log-file","type":"boolean","description":"If true, the system will automatically create a log of all processes relating to actions sent to the web session.\n\nThe location of the file will be relative to the process directory (pd)\n\n`[pd]/[sessionId]/[start timestamp].log`","default":false,"key":"logFile"},{"env":"WA_ID_CORRECTION","p":"id-correction","type":"boolean","description":"When true, the system will attempt to correct chatIds and groupChatIds. This means you can ignore `@c.us` and `@g.us` distinctions in some parameters.","default":false,"key":"idCorrection"},{"env":"WA_STICKER_SERVER_ENDPOINT","p":"sticker-server-endpoint","type":["string","boolean"],"description":"Redundant until self-hostable sticker server is available.","key":"stickerServerEndpoint"},{"env":"WA_GH_PATCH","p":"gh-patch","type":"boolean","description":"This will force the library to use the default cached raw github link for patches to shave a few hundred milliseconds from your launch time. If you use this option, you will need to wait about 5 minutes before trying out new patches.","key":"ghPatch"},{"env":"WA_CACHED_PATCH","p":"cached-patch","type":"boolean","description":"Setting this to `true` will save a local copy of the patches.json file (as patches.ignore.data.json) which will be used in subsequent instantiations of the session. While the rest of the launch procedure is running, the library will fetch and save a recent version of the patches to ensure your patches don't go stale. This will be ignored if the cached patches are more than a day old.","key":"cachedPatch"},{"env":"WA_LOG_DEBUG_INFO_AS_OBJECT","p":"log-debug-info-as-object","type":"boolean","description":"Setting `this` to true will replace the `console.table` with a stringified logging of the debug info object instead. This would be useful to set for smaller terminal windows. If `disableSpins` is `true` then this will also be `true`.","key":"logDebugInfoAsObject"},{"env":"WA_KILL_CLIENT_ON_LOGOUT","p":"kill-client-on-logout","type":"boolean","description":"Kill the client when a logout is detected","key":"killClientOnLogout"},{"env":"WA_THROW_ON_EXPIRED_SESSION_DATA","p":"throw-on-expired-session-data","type":"boolean","description":"This will make the `create` command return `false` if the detected session data is expired.\n\nThis will mean, the process will not attempt to automatically get a new QR code.","key":"throwOnExpiredSessionData"},{"env":"WA_USE_NATIVE_PROXY","p":"use-native-proxy","type":"boolean","description":"Some sessions may experience issues with sending media when using proxies. Using the native proxy system instead of the recommended 3rd party library may fix these issues.","key":"useNativeProxy"},{"env":"WA_RASPI","p":"raspi","type":"boolean","description":"Set this to `true` to make the library work on Raspberry Pi OS.\n\nMake sure to run the following command before running the library the first time:\n\n``` > sudo apt update -y && sudo apt install chromium-browser chromium-codecs-ffmpeg -y && sudo apt upgrade ```\n\nIf you're using the CLI, you can set this value to `true` by adding the following flag to the CLI command\n\n``` > npx @open-wa/wa-automate ... --raspi ```","key":"raspi"},{"env":"WA_MULTI_DEVICE","p":"multi-device","type":"boolean","description":"Please note that multi-device is still in beta so a lot of things may not work. It is HIGHLY suggested to NOT use this in production!!!!\n\nSet this to true if you're using the multidevice beta.","key":"multiDevice"},{"env":"WA_SESSION_DATA_BUCKET_AUTH","p":"session-data-bucket-auth","type":"string","description":"Base64 encoded S3 Bucket & Authentication object for session data files. The object should be in the same format as cloudUploadOptions.","key":"sessionDataBucketAuth"},{"env":"WA_AUTO_EMOJI","p":"auto-emoji","type":"string","description":"Set the automatic emoji detection character. Set this to false to disable auto emoji. Default is `:`.","key":"autoEmoji"},{"env":"WA_MAX_CHATS","p":"max-chats","type":"number","description":"Set the maximum amount of chats to be present in a session.","key":"maxChats"},{"env":"WA_MAX_MESSAGES","p":"max-messages","type":"number","description":"Set the maximum amount of messages to be present in a session.","key":"maxMessages"},{"env":"WA_DISCORD","p":"discord","type":"string","description":"Your Discord ID to get onto the sticker leaderboard!","key":"discord"},{"env":"WA_IGNORE_NUKE","p":"ignore-nuke","type":"boolean","description":"Don't implicitly determine if the host logged out.","key":"ignoreNuke"},{"env":"WA_ENSURE_HEADFUL_INTEGRITY","p":"ensure-headful-integrity","type":"boolean","description":"Makes sure the headless session is usable even on first login. Headful sessions are ususally only usable on reauthentication.","key":"ensureHeadfulIntegrity"},{"env":"WA_WAIT_FOR_RIPE_SESSION","p":"wait-for-ripe-session","type":"boolean","description":"wait for a valid headful session. Not required in recent versions.","key":"waitForRipeSession"},{"env":"WA_QR_MAX","p":"qr-max","type":"number","description":"Automatically kill the process after a set amount of qr codes","key":"qrMax"},{"env":"WA_EZQR","p":"ezqr","type":"boolean","description":"Expose a URL where you can easily scan the qr code","key":"ezqr"},{"env":"WA_LOGGING","p":"logging","type":"array","items":{"$ref":"#/definitions/ConfigLogTransport"},"description":"An array of [winston](https://github.com/winstonjs/winston/blob/master/docs/transports.md#additional-transports) logging transport configurations.\n\n[Check this discussion to see how to set up logging](https://github.com/open-wa/wa-automate-nodejs/discussions/2373)","key":"logging"}]
|
1
|
+
[{"env":"WA_SESSION_DATA","p":"session-data","description":"The base64 encoded sessionData used to restore a session.","type":"string","key":"sessionData"},{"env":"WA_BROWSER_WS_ENDPOINT","p":"browser-ws-endpoint","type":"string","description":"ALPHA EXPERIMENTAL FEATURE! DO NOT USE IN PRODUCTION, REQUIRES TESTING.\n\nLearn more:\n\nhttps://pptr.dev/#?product=Puppeteer&version=v3.1.0&show=api-puppeteerconnectoptions\n\nhttps://medium.com/@jaredpotter1/connecting-puppeteer-to-existing-chrome-window-8a10828149e0","key":"browserWSEndpoint"},{"env":"WA_SESSION_DATA_PATH","p":"session-data-path","type":"string","description":"The path relative to the current working directory (i.e where you run the command to start your process). This will be used to store and read your `.data.json` files. defualt to ''","key":"sessionDataPath"},{"env":"WA_SKIP_UPDATE_CHECK","p":"skip-update-check","type":"boolean","description":"If set to true, `skipUpdateCheck` will bypass the latest version check. This saves some time on boot (around 150 ms).","default":"`false`","key":"skipUpdateCheck"},{"env":"WA_SESSION_ID","p":"session-id","type":"string","description":"This is the name of the session. You have to make sure that this is unique for every session.","default":"`session`","key":"sessionId"},{"env":"WA_LICENSE_KEY","p":"license-key","description":"The license key to use with the session.","type":"string","key":"licenseKey"},{"env":"WA_CUSTOM_USER_AGENT","p":"custom-user-agent","type":"string","description":"You may set a custom user agent. However, due to recent developments, this is not really neccessary any more.","key":"customUserAgent"},{"env":"WA_BLOCK_CRASH_LOGS","p":"block-crash-logs","type":"boolean","description":"Setting this to true will block any network calls to crash log servers. This should keep anything you do under the radar.","default":"`true`","key":"blockCrashLogs"},{"env":"WA_CACHE_ENABLED","p":"cache-enabled","type":"boolean","description":"Setting this to false turn off the cache. This may improve memory usage.","default":"`false`","key":"cacheEnabled"},{"env":"WA_BROWSER_REVISION","p":"browser-revision","type":"string","description":"This is the specific browser revision to be downlaoded and used. You can find browser revision strings here: http://omahaproxy.appspot.com/ Learn more about it here: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-browserfetcher If you're having trouble with sending images, try '737027'. If you go too far back things will start breaking !!!!!! NOTE: THIS WILL OVERRIDE useChrome and executablePath. ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING.","key":"browserRevision"},{"env":"WA_HEADLESS","p":"headless","type":"boolean","description":"By default, all instances of @open-wa/wa-automate are headless (i.e you don't see a chrome window open), you can set this to false to show the chrome/chromium window.","default":"`true`","key":"headless"},{"env":"WA_QR_TIMEOUT","p":"qr-timeout","type":"number","description":"This determines how long the process should wait for a QR code to be scanned before killing the process entirely. To have the system wait continuously, set this to `0`.","default":60,"key":"qrTimeout"},{"env":"WA_USE_CHROME","p":"use-chrome","type":"boolean","description":"If true, the program will automatically try to detect the instance of chorme on the machine. Please note this DOES NOT override executablePath.","default":"`false`","key":"useChrome"},{"env":"WA_QR_LOG_SKIP","p":"qr-log-skip","type":"boolean","description":"If true, skips logging the QR Code to the console.","default":"`false`","key":"qrLogSkip"},{"env":"WA_DISABLE_SPINS","p":"disable-spins","type":"boolean","description":"Setting this to true will simplify logs for use within docker containers by disabling spins (will still print raw messages).","default":"`false`","key":"disableSpins"},{"env":"WA_LOG_CONSOLE","p":"log-console","type":"boolean","description":"If true, this will log any console messages from the browser.","default":"`false`","key":"logConsole"},{"env":"WA_LOG_CONSOLE_ERRORS","p":"log-console-errors","type":"boolean","description":"If true, this will log any error messages from the browser instance","default":"`false`","key":"logConsoleErrors"},{"env":"WA_AUTH_TIMEOUT","p":"auth-timeout","type":"number","description":"This determines how long the process should wait for the session authentication. If exceeded, checks if phone is out of reach (turned of or without internet connection) and throws an error. It does not relate to the amount of time spent waiting for a qr code scan (see [[qrTimeout]]). To have the system wait continuously, set this to `0`.","default":"`60`","key":"authTimeout"},{"env":"WA_SAFE_MODE","p":"safe-mode","type":"boolean","description":"If true, client will check if the page is valid before each command. If page is not valid, it will throw an error.","default":"`false`","key":"safeMode"},{"env":"WA_SKIP_SESSION_SAVE","p":"skip-session-save","type":"boolean","description":"If true, the process will not save a data.json file. This means that sessions will not be saved and you will need to pass sessionData as a config param or create the session data.json file yourself","default":"`false`","key":"skipSessionSave"},{"env":"WA_POPUP","p":"popup","type":["boolean","number"],"description":"If true, the process will open a browser window where you will see basic event logs and QR codes to authenticate the session. Usually it will open on port 3000. It can also be set to a preferred port.\n\nYou can also get the QR code png at (if localhost and port 3000):\n\n`http://localhost:3000/qr`\n\nor if you have multiple session:\n\n `http://localhost:3000/qr?sessionId=[sessionId]`","default":"`false | 3000`","key":"popup"},{"env":"WA_QR_POP_UP_ONLY","p":"qr-pop-up-only","type":"boolean","description":"This needs to be used in conjuction with `popup`, if `popup` is not true or a number (representing a desired port) then this will not work.\n\nSetting this to true will make sure that only the qr code png is served via the web server. This is useful if you do not need the whole status page.\n\nAs mentioned in [popup](#popup), the url for the qr code is `http://localhost:3000/qr` if the port is 3000.","key":"qrPopUpOnly"},{"env":"WA_BLOCK_ASSETS","p":"block-assets","type":"boolean","description":"Setting this to true will block all assets from loading onto the page. This may result in some load time improvements but also increases instability.","default":"`false`","key":"blockAssets"},{"env":"WA_KEEP_UPDATED","p":"keep-updated","type":"boolean","description":"[ALPHA FEATURE - ONLY IMPLEMENTED FOR TESTING - DO NOT USE IN PRODUCTION YET] Setting this to true will result in the library making sure it is always starting with the latest version of itself. This overrides `skipUpdateCheck`.","default":"`false`","key":"keepUpdated"},{"env":"WA_RESIZABLE","p":"resizable","type":"boolean","description":"Syncs the viewport size with the window size which is how normal browsers act. Only relevant when `headless: false` and this overrides `viewport` config.","default":"`true`","key":"resizable"},{"env":"WA_VIEWPORT","p":"viewport","type":"object","properties":{"width":{"type":"number","description":"Page width in pixels","default":"`1440`"},"height":{"type":"number","description":"Page height in pixels","default":"`900`"}},"additionalProperties":false,"description":"Set the desired viewport height and width. For CLI, use [width]x[height] format. E.g `--viewport 1920x1080`.","key":"viewport"},{"env":"WA_LEGACY","p":"legacy","type":"boolean","description":"As the library is constantly evolving, some parts will be replaced with more efficient and improved code. In some of the infinite edge cases these new changes may not work for you. Set this to true to roll back on 'late beta' features. The reason why legacy is false by default is that in order for features to be tested they have to be released and used by everyone to find the edge cases and fix them.","default":"`false`","key":"legacy"},{"env":"WA_DELETE_SESSION_DATA_ON_LOGOUT","p":"delete-session-data-on-logout","type":"boolean","description":"Deletes the session data file (if found) on logout event. This results in a quicker login when you restart the process.","default":"`false`","key":"deleteSessionDataOnLogout"},{"env":"WA_KILL_PROCESS_ON_TIMEOUT","p":"kill-process-on-timeout","type":"boolean","description":"If set to true, the system will kill the whole node process when either an [[authTimeout]] or a [[qrTimeout]] has been reached. This is useful to prevent hanging processes.","default":"`false`","key":"killProcessOnTimeout"},{"env":"WA_CORS_FIX","p":"cors-fix","type":"boolean","description":"Setting this to true will bypass web security. DO NOT DO THIS IF YOU DO NOT HAVE TO. CORS issue may arise when using a proxy.","default":"`false`","key":"corsFix"},{"env":"WA_CALL_TIMEOUT","p":"call-timeout","type":"number","description":"Amount of time (in ms) to wait for a client method (specifically methods that interact with the WA web session) to resolve. If a client method results takes longer than the timout value then it will result in a [[PageEvaluationTimeout]] error.\n\nIf you get this error, it does not automatically mean that the method failed - it just stops your program from waiting for a client method to resolve.\n\nThis is useful if you do not rely on the results of a client method (e.g the message ID).\n\nIf set to `0`, the process will wait indefinitely for a client method to resolve.","default":0,"key":"callTimeout"},{"env":"WA_SCREENSHOT_ON_INITIALIZATION_BROWSER_ERROR","p":"screenshot-on-initialization-browser-error","type":"boolean","description":"When true, this option will take a screenshot of the browser when an unexpected error occurs within the browser during `create` initialization. The path will be `[working directory]/logs/[session ID]/[start timestamp]/[timestamp].jpg`","default":"`false`","key":"screenshotOnInitializationBrowserError"},{"env":"WA_EVENT_MODE","p":"event-mode","type":"boolean","description":"Setting listeners may not be your cup of tea. With eventMode, all [[SimpleListener]] events will be registered automatically and be filed via the built in Events Listener.\n\nThis is useful because you can register/deregister the event listener as needed whereas the legacy method of setting callbacks are only be set once","default":"`true`;","key":"eventMode"},{"env":"WA_LOG_FILE","p":"log-file","type":"boolean","description":"If true, the system will automatically create a log of all processes relating to actions sent to the web session.\n\nThe location of the file will be relative to the process directory (pd)\n\n`[pd]/[sessionId]/[start timestamp].log`","default":false,"key":"logFile"},{"env":"WA_ID_CORRECTION","p":"id-correction","type":"boolean","description":"When true, the system will attempt to correct chatIds and groupChatIds. This means you can ignore `@c.us` and `@g.us` distinctions in some parameters.","default":false,"key":"idCorrection"},{"env":"WA_STICKER_SERVER_ENDPOINT","p":"sticker-server-endpoint","type":["string","boolean"],"description":"Redundant until self-hostable sticker server is available.","default":"`https://sticker-api.openwa.dev`","key":"stickerServerEndpoint"},{"env":"WA_GH_PATCH","p":"gh-patch","type":"boolean","description":"This will force the library to use the default cached raw github link for patches to shave a few hundred milliseconds from your launch time. If you use this option, you will need to wait about 5 minutes before trying out new patches.","default":"`false`","key":"ghPatch"},{"env":"WA_CACHED_PATCH","p":"cached-patch","type":"boolean","description":"Setting this to `true` will save a local copy of the patches.json file (as patches.ignore.data.json) which will be used in subsequent instantiations of the session. While the rest of the launch procedure is running, the library will fetch and save a recent version of the patches to ensure your patches don't go stale. This will be ignored if the cached patches are more than a day old.","default":"`false`","key":"cachedPatch"},{"env":"WA_LOG_DEBUG_INFO_AS_OBJECT","p":"log-debug-info-as-object","type":"boolean","description":"Setting `this` to true will replace the `console.table` with a stringified logging of the debug info object instead. This would be useful to set for smaller terminal windows. If `disableSpins` is `true` then this will also be `true`.","default":"`false`","key":"logDebugInfoAsObject"},{"env":"WA_KILL_CLIENT_ON_LOGOUT","p":"kill-client-on-logout","type":"boolean","description":"Kill the client when a logout is detected","default":"`false`","key":"killClientOnLogout"},{"env":"WA_THROW_ON_EXPIRED_SESSION_DATA","p":"throw-on-expired-session-data","type":"boolean","description":"This will make the `create` command return `false` if the detected session data is expired.\n\nThis will mean, the process will not attempt to automatically get a new QR code.","default":"`false`","key":"throwOnExpiredSessionData"},{"env":"WA_USE_NATIVE_PROXY","p":"use-native-proxy","type":"boolean","description":"Some sessions may experience issues with sending media when using proxies. Using the native proxy system instead of the recommended 3rd party library may fix these issues.","default":"`false`","key":"useNativeProxy"},{"env":"WA_RASPI","p":"raspi","type":"boolean","description":"Set this to `true` to make the library work on Raspberry Pi OS.\n\nMake sure to run the following command before running the library the first time:\n\n``` > sudo apt update -y && sudo apt install chromium-browser chromium-codecs-ffmpeg -y && sudo apt upgrade ```\n\nIf you're using the CLI, you can set this value to `true` by adding the following flag to the CLI command\n\n``` > npx @open-wa/wa-automate ... --raspi ```","default":"`false`","key":"raspi"},{"env":"WA_MULTI_DEVICE","p":"multi-device","type":"boolean","description":"Please note that multi-device is still in beta so a lot of things may not work. It is HIGHLY suggested to NOT use this in production!!!!\n\nSet this to true if you're using the multidevice beta.","default":"`false`","key":"multiDevice"},{"env":"WA_SESSION_DATA_BUCKET_AUTH","p":"session-data-bucket-auth","type":"string","description":"Base64 encoded S3 Bucket & Authentication object for session data files. The object should be in the same format as cloudUploadOptions.","key":"sessionDataBucketAuth"},{"env":"WA_AUTO_EMOJI","p":"auto-emoji","type":"string","description":"Set the automatic emoji detection character. Set this to false to disable auto emoji. Default is `:`.","default":"`:`","key":"autoEmoji"},{"env":"WA_MAX_CHATS","p":"max-chats","type":"number","description":"Set the maximum amount of chats to be present in a session.","key":"maxChats"},{"env":"WA_MAX_MESSAGES","p":"max-messages","type":"number","description":"Set the maximum amount of messages to be present in a session.","key":"maxMessages"},{"env":"WA_DISCORD","p":"discord","type":"string","description":"Your Discord ID to get onto the sticker leaderboard!","key":"discord"},{"env":"WA_IGNORE_NUKE","p":"ignore-nuke","type":"boolean","description":"Don't implicitly determine if the host logged out.","key":"ignoreNuke"},{"env":"WA_ENSURE_HEADFUL_INTEGRITY","p":"ensure-headful-integrity","type":"boolean","description":"Makes sure the headless session is usable even on first login. Headful sessions are ususally only usable on reauthentication.","key":"ensureHeadfulIntegrity"},{"env":"WA_WAIT_FOR_RIPE_SESSION","p":"wait-for-ripe-session","type":"boolean","description":"wait for a valid headful session. Not required in recent versions.","key":"waitForRipeSession"},{"env":"WA_QR_MAX","p":"qr-max","type":"number","description":"Automatically kill the process after a set amount of qr codes","key":"qrMax"},{"env":"WA_EZQR","p":"ezqr","type":"boolean","description":"Expose a URL where you can easily scan the qr code","key":"ezqr"},{"env":"WA_LOGGING","p":"logging","type":"array","items":{"$ref":"#/definitions/ConfigLogTransport"},"description":"An array of [winston](https://github.com/winstonjs/winston/blob/master/docs/transports.md#additional-transports) logging transport configurations.\n\n[Check this discussion to see how to set up logging](https://github.com/open-wa/wa-automate-nodejs/discussions/2373)","key":"logging"}]
|
package/dist/api/Client.js
CHANGED
@@ -434,6 +434,7 @@ class Client {
|
|
434
434
|
pup(pageFunction, ...args) {
|
435
435
|
var _a, _b, _c, _d, _e;
|
436
436
|
return __awaiter(this, void 0, void 0, function* () {
|
437
|
+
const invocation_id = (0, uuid_1.v4)().slice(-5);
|
437
438
|
const { safeMode, callTimeout, idCorrection, logging } = this._createConfig;
|
438
439
|
let _t;
|
439
440
|
if (safeMode) {
|
@@ -472,13 +473,13 @@ class Client {
|
|
472
473
|
if (logging) {
|
473
474
|
const wapis = (_e = (((_d = pageFunction === null || pageFunction === void 0 ? void 0 : pageFunction.toString()) === null || _d === void 0 ? void 0 : _d.match(/WAPI\.(\w*)\(/g)) || [])) === null || _e === void 0 ? void 0 : _e.map(s => s.replace(/WAPI|\.|\(/g, ''));
|
474
475
|
_t = Date.now();
|
475
|
-
logging_1.log.info(`
|
476
|
+
logging_1.log.info(`IN ${invocation_id}`, Object.assign({ _method: (wapis === null || wapis === void 0 ? void 0 : wapis.length) === 1 ? wapis[0] : wapis }, args[0]));
|
476
477
|
}
|
477
478
|
if (callTimeout)
|
478
479
|
return yield Promise.race([this._page.evaluate(pageFunction, ...args), new Promise((resolve, reject) => { var _a; return setTimeout(reject, (_a = this._createConfig) === null || _a === void 0 ? void 0 : _a.callTimeout, new errors_1.PageEvaluationTimeout()); })]);
|
479
480
|
const res = yield this._page.evaluate(pageFunction, ...args);
|
480
481
|
if (_t && logging) {
|
481
|
-
logging_1.log.info(`
|
482
|
+
logging_1.log.info(`OUT ${invocation_id}: ${Date.now() - _t}ms`, { res });
|
482
483
|
}
|
483
484
|
if (this._createConfig.onError && typeof res == "string" && (res.startsWith("Error") || res.startsWith("ERROR"))) {
|
484
485
|
const e = this._createConfig.onError;
|
@@ -0,0 +1,229 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.optionList = void 0;
|
4
|
+
exports.optionList = [{
|
5
|
+
name: 'no-api',
|
6
|
+
default: false,
|
7
|
+
alias: 'n',
|
8
|
+
type: Boolean,
|
9
|
+
description: "Don't expose the api. This may be useful if you just want to set the webhooks."
|
10
|
+
}, {
|
11
|
+
name: 'bot-press-url',
|
12
|
+
alias: 'b',
|
13
|
+
type: String,
|
14
|
+
typeLabel: '{blue {underline http://localhost:3000/api/v1/bots/cool-bot}}',
|
15
|
+
description: "The Botpress URL that ends with your bot id."
|
16
|
+
}, {
|
17
|
+
name: 'twilio-webhook',
|
18
|
+
alias: 't',
|
19
|
+
type: String,
|
20
|
+
typeLabel: '{blue {underline http://localhost:5555/incoming}}',
|
21
|
+
description: "Send twillio payloads to this URL. EASY API will also parse and processes twillio response message payloads."
|
22
|
+
}, {
|
23
|
+
name: 'chatwoot-url',
|
24
|
+
type: String,
|
25
|
+
typeLabel: '{blue {underline http://localhost:3000/api/v1/accounts/3/inboxes/1}}',
|
26
|
+
description: "The URL of the specific Chatwoot inbox you set up for this session"
|
27
|
+
}, {
|
28
|
+
name: 'chatwoot-api-access-token',
|
29
|
+
type: String,
|
30
|
+
typeLabel: '{blue {underline mEEwUGEEML2ZThMm252rLg1M}}',
|
31
|
+
description: "The access token of the specific Chatwoot inbox you set up for this session"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
name: 'port',
|
35
|
+
alias: 'p',
|
36
|
+
default: 8002,
|
37
|
+
type: Number,
|
38
|
+
typeLabel: '{blue {underline 8080}}',
|
39
|
+
description: "Set the port for the api. Default to 8002."
|
40
|
+
},
|
41
|
+
{
|
42
|
+
name: 'api-host',
|
43
|
+
type: String,
|
44
|
+
typeLabel: '{yellow {underline localhost}}',
|
45
|
+
description: "The easy API may be sitting behind a reverse proxy. In this case set --api-host in order to make sure the api docs and api explorer are working properly. You will need to include the protocol as well."
|
46
|
+
},
|
47
|
+
{
|
48
|
+
name: 'host',
|
49
|
+
alias: 'h',
|
50
|
+
default: 'localhost',
|
51
|
+
type: String,
|
52
|
+
typeLabel: '{red {underline localhost}}',
|
53
|
+
description: "Set the hostname for the api documantation and statistics. Overrides --api-host. Default: localhost."
|
54
|
+
},
|
55
|
+
{
|
56
|
+
name: 'webhook',
|
57
|
+
alias: 'w',
|
58
|
+
type: String,
|
59
|
+
typeLabel: '{yellow {underline https://webhook.site/....}}',
|
60
|
+
description: "Webhook to use for the listeners."
|
61
|
+
},
|
62
|
+
{
|
63
|
+
name: 'ev',
|
64
|
+
alias: 'e',
|
65
|
+
type: String,
|
66
|
+
typeLabel: '{green {underline https://webhook.site/....}}',
|
67
|
+
description: "Send launch events to this URL."
|
68
|
+
},
|
69
|
+
{
|
70
|
+
name: 'ef',
|
71
|
+
type: String,
|
72
|
+
//@ts-ignore
|
73
|
+
default: ["qr", "STARTUP", "MD_DETECT"],
|
74
|
+
isMultiple: true,
|
75
|
+
typeLabel: '{blueBright {underline qr,STARTUP}}',
|
76
|
+
description: "Filters which namespaces trigger the webhook set in -e/--ev."
|
77
|
+
},
|
78
|
+
{
|
79
|
+
name: 'allow-session-data-wh',
|
80
|
+
alias: 'x',
|
81
|
+
default: false,
|
82
|
+
type: Boolean,
|
83
|
+
description: "By default, if you set -e flag, the session data is not transferred to the webhook as it is extremely sensitive data. In order to bypass this security measure, use this flag."
|
84
|
+
},
|
85
|
+
{
|
86
|
+
name: 'key',
|
87
|
+
alias: 'k',
|
88
|
+
type: String,
|
89
|
+
typeLabel: '{redBright {underline apikey}}',
|
90
|
+
description: "Specify an api key to use as a check for all requests. If you add -k by itself, a key will be autogenerated for you."
|
91
|
+
},
|
92
|
+
{
|
93
|
+
name: 'config',
|
94
|
+
alias: 'c',
|
95
|
+
type: String,
|
96
|
+
typeLabel: '{yellowBright {underline ./config.json}}',
|
97
|
+
description: "The relative json file that contains the config. By default the system will look for config.json which will override any config variables set. Default: './config.json'."
|
98
|
+
},
|
99
|
+
{
|
100
|
+
name: 'session',
|
101
|
+
alias: 's',
|
102
|
+
type: String,
|
103
|
+
typeLabel: '{magentaBright {underline BASE64}}',
|
104
|
+
description: "A base64 string representing the session data."
|
105
|
+
},
|
106
|
+
{
|
107
|
+
name: 'keep-alive',
|
108
|
+
alias: 'a',
|
109
|
+
type: Boolean,
|
110
|
+
description: "If true, the system will force the session to refocus in this process. This will prevent you from opening a session elsewhere."
|
111
|
+
},
|
112
|
+
{
|
113
|
+
name: 'use-session-id-in-path',
|
114
|
+
alias: 'i',
|
115
|
+
type: Boolean,
|
116
|
+
description: "If true, all API paths will include the session id. default to false and the default session Id is 'session'."
|
117
|
+
},
|
118
|
+
{
|
119
|
+
name: 'generate-api-docs',
|
120
|
+
alias: 'd',
|
121
|
+
type: Boolean,
|
122
|
+
default: true,
|
123
|
+
description: "Generate postman collection and expose api docs to open in browser."
|
124
|
+
},
|
125
|
+
{
|
126
|
+
name: 'session-data-only',
|
127
|
+
alias: 'o',
|
128
|
+
type: Boolean,
|
129
|
+
description: "Kill the process when the session data is saved.",
|
130
|
+
default: false
|
131
|
+
},
|
132
|
+
{
|
133
|
+
name: 'skip-save-postman-collection',
|
134
|
+
type: Boolean,
|
135
|
+
description: "Don't save the postman collection.",
|
136
|
+
default: false
|
137
|
+
},
|
138
|
+
{
|
139
|
+
name: 'headful',
|
140
|
+
type: Boolean,
|
141
|
+
description: "Show the browser window on your machine.",
|
142
|
+
default: false
|
143
|
+
},
|
144
|
+
{
|
145
|
+
name: 'pre-auth-docs',
|
146
|
+
type: Boolean,
|
147
|
+
description: "Pre authenticate documentation site [High security risk]."
|
148
|
+
},
|
149
|
+
{
|
150
|
+
name: 'stats',
|
151
|
+
type: Boolean,
|
152
|
+
description: "Exposes API swagger-statistics.",
|
153
|
+
default: false
|
154
|
+
},
|
155
|
+
{
|
156
|
+
name: 'pre-auth-docs',
|
157
|
+
type: Boolean,
|
158
|
+
description: "Grab config options from the environment variables.",
|
159
|
+
default: false
|
160
|
+
},
|
161
|
+
{
|
162
|
+
name: 'no-kill-on-logout',
|
163
|
+
type: Boolean,
|
164
|
+
description: "Keeps the process alive when host account logs out of session. default is false",
|
165
|
+
default: false
|
166
|
+
},
|
167
|
+
{
|
168
|
+
name: 'debug',
|
169
|
+
type: Boolean,
|
170
|
+
description: "Print out the CLI flag values and the WA_* env vars. default is false",
|
171
|
+
default: false
|
172
|
+
},
|
173
|
+
{
|
174
|
+
name: 'cors',
|
175
|
+
type: Boolean,
|
176
|
+
description: "Enable all cors requests",
|
177
|
+
default: false
|
178
|
+
},
|
179
|
+
{
|
180
|
+
name: 'socket',
|
181
|
+
type: Boolean,
|
182
|
+
description: "Expose a socket.io middleware on the server.",
|
183
|
+
default: false
|
184
|
+
},
|
185
|
+
{
|
186
|
+
name: 'license-key',
|
187
|
+
alias: 'l',
|
188
|
+
type: String,
|
189
|
+
typeLabel: '{yellowBright {underline B2BJ4JFB-2UN2J3ND-2J5I.....}}',
|
190
|
+
description: "The license key you want to use for this server. License keys are used to unlock features. Learn more here https://github.com/open-wa/wa-automate-nodejs#license-key"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
name: 'ready-webhook',
|
194
|
+
type: String,
|
195
|
+
typeLabel: '{yellow {underline https://webhook.site/....}}',
|
196
|
+
description: "Webhook that fires when the EASY API is completely ready"
|
197
|
+
},
|
198
|
+
{
|
199
|
+
name: 'on-call',
|
200
|
+
type: String,
|
201
|
+
typeLabel: '{yellow {underline "Please do not call this number"}}',
|
202
|
+
description: "A default message to send to any number that is trying to call the host account"
|
203
|
+
},
|
204
|
+
{
|
205
|
+
name: 'auto-reject',
|
206
|
+
type: Boolean,
|
207
|
+
description: "Automatically reject incoming phone and video calls to the host account."
|
208
|
+
},
|
209
|
+
{
|
210
|
+
name: 'emit-unread',
|
211
|
+
type: Boolean,
|
212
|
+
description: "Emit all unread messages via onMessage webhooks on launch.",
|
213
|
+
default: false
|
214
|
+
},
|
215
|
+
{
|
216
|
+
name: 'skip-url-check',
|
217
|
+
type: Boolean,
|
218
|
+
description: "Don't validate webhook URLs. Enables use of non-FQDNs."
|
219
|
+
},
|
220
|
+
{
|
221
|
+
name: 'tunnel',
|
222
|
+
type: Boolean,
|
223
|
+
description: "Expose a tunnel to your EASY API session - this is for testing and it is unsecured."
|
224
|
+
},
|
225
|
+
{
|
226
|
+
name: 'help',
|
227
|
+
description: 'Print this usage guide.'
|
228
|
+
}
|
229
|
+
];
|
package/dist/cli/setup.d.ts
CHANGED
@@ -14,7 +14,7 @@ export declare const cliOptionNames: import("type-fest").Simplify<import("type-f
|
|
14
14
|
description?: string;
|
15
15
|
typeLabel?: string;
|
16
16
|
}, meow.AnyFlag>>, {
|
17
|
-
type?:
|
17
|
+
type?: StringConstructor | BooleanConstructor | NumberConstructor;
|
18
18
|
}>>;
|
19
19
|
export declare const meowFlags: () => AnyFlags;
|
20
20
|
export declare const helptext: string;
|
package/dist/cli/setup.js
CHANGED
@@ -44,242 +44,17 @@ const events_1 = require("../controllers/events");
|
|
44
44
|
const is_url_superb_1 = __importDefault(require("is-url-superb"));
|
45
45
|
const path = __importStar(require("path"));
|
46
46
|
const logging_1 = require("../logging/logging");
|
47
|
+
const cli_options_1 = require("./cli-options");
|
47
48
|
let checkUrl = url => typeof url === 'string' ? (0, is_url_superb_1.default)(url) : false;
|
48
49
|
const configWithCases = (0, fs_extra_1.readJsonSync)(path.join(__dirname, '../../bin/config-schema.json'));
|
49
|
-
|
50
|
-
|
51
|
-
default: false,
|
52
|
-
alias: 'n',
|
53
|
-
type: Boolean,
|
54
|
-
description: "Don't expose the api. This may be useful if you just want to set the webhooks."
|
55
|
-
}, {
|
56
|
-
name: 'bot-press-url',
|
57
|
-
alias: 'b',
|
58
|
-
type: String,
|
59
|
-
typeLabel: '{blue {underline http://localhost:3000/api/v1/bots/cool-bot}}',
|
60
|
-
description: "The Botpress URL that ends with your bot id."
|
61
|
-
}, {
|
62
|
-
name: 'twilio-webhook',
|
63
|
-
alias: 't',
|
64
|
-
type: String,
|
65
|
-
typeLabel: '{blue {underline http://localhost:5555/incoming}}',
|
66
|
-
description: "Send twillio payloads to this URL. EASY API will also parse and processes twillio response message payloads."
|
67
|
-
}, {
|
68
|
-
name: 'chatwoot-url',
|
69
|
-
type: String,
|
70
|
-
typeLabel: '{blue {underline http://localhost:3000/api/v1/accounts/3/inboxes/1}}',
|
71
|
-
description: "The URL of the specific Chatwoot inbox you set up for this session"
|
72
|
-
}, {
|
73
|
-
name: 'chatwoot-api-access-token',
|
74
|
-
type: String,
|
75
|
-
typeLabel: '{blue {underline mEEwUGEEML2ZThMm252rLg1M}}',
|
76
|
-
description: "The access token of the specific Chatwoot inbox you set up for this session"
|
77
|
-
},
|
78
|
-
{
|
79
|
-
name: 'port',
|
80
|
-
alias: 'p',
|
81
|
-
default: 8002,
|
82
|
-
type: Number,
|
83
|
-
typeLabel: '{blue {underline 8080}}',
|
84
|
-
description: "Set the port for the api. Default to 8002."
|
85
|
-
},
|
86
|
-
{
|
87
|
-
name: 'api-host',
|
88
|
-
type: String,
|
89
|
-
typeLabel: '{yellow {underline localhost}}',
|
90
|
-
description: "The easy API may be sitting behind a reverse proxy. In this case set --api-host in order to make sure the api docs and api explorer are working properly. You will need to include the protocol as well."
|
91
|
-
},
|
92
|
-
{
|
93
|
-
name: 'host',
|
94
|
-
alias: 'h',
|
95
|
-
default: 'localhost',
|
96
|
-
type: String,
|
97
|
-
typeLabel: '{red {underline localhost}}',
|
98
|
-
description: "Set the hostname for the api documantation and statistics. Overrides --api-host. Default: localhost."
|
99
|
-
},
|
100
|
-
{
|
101
|
-
name: 'webhook',
|
102
|
-
alias: 'w',
|
103
|
-
type: String,
|
104
|
-
typeLabel: '{yellow {underline https://webhook.site/....}}',
|
105
|
-
description: "Webhook to use for the listeners."
|
106
|
-
},
|
107
|
-
{
|
108
|
-
name: 'ev',
|
109
|
-
alias: 'e',
|
110
|
-
type: String,
|
111
|
-
typeLabel: '{green {underline https://webhook.site/....}}',
|
112
|
-
description: "Send launch events to this URL."
|
113
|
-
},
|
114
|
-
{
|
115
|
-
name: 'ef',
|
116
|
-
type: String,
|
117
|
-
//@ts-ignore
|
118
|
-
default: ["qr", "STARTUP"],
|
119
|
-
isMultiple: true,
|
120
|
-
typeLabel: '{blueBright {underline qr,STARTUP}}',
|
121
|
-
description: "Filters which namespaces trigger the webhook set in -e/--ev."
|
122
|
-
},
|
123
|
-
{
|
124
|
-
name: 'allow-session-data-wh',
|
125
|
-
alias: 'x',
|
126
|
-
default: false,
|
127
|
-
type: Boolean,
|
128
|
-
description: "By default, if you set -e flag, the session data is not transferred to the webhook as it is extremely sensitive data. In order to bypass this security measure, use this flag."
|
129
|
-
},
|
130
|
-
{
|
131
|
-
name: 'key',
|
132
|
-
alias: 'k',
|
133
|
-
type: String,
|
134
|
-
typeLabel: '{redBright {underline apikey}}',
|
135
|
-
description: "Specify an api key to use as a check for all requests. If you add -k by itself, a key will be autogenerated for you."
|
136
|
-
},
|
137
|
-
{
|
138
|
-
name: 'config',
|
139
|
-
alias: 'c',
|
140
|
-
type: String,
|
141
|
-
typeLabel: '{yellowBright {underline ./config.json}}',
|
142
|
-
description: "The relative json file that contains the config. By default the system will look for config.json which will override any config variables set. Default: './config.json'."
|
143
|
-
},
|
144
|
-
{
|
145
|
-
name: 'session',
|
146
|
-
alias: 's',
|
147
|
-
type: String,
|
148
|
-
typeLabel: '{magentaBright {underline BASE64}}',
|
149
|
-
description: "A base64 string representing the session data."
|
150
|
-
},
|
151
|
-
{
|
152
|
-
name: 'keep-alive',
|
153
|
-
alias: 'a',
|
154
|
-
type: Boolean,
|
155
|
-
description: "If true, the system will force the session to refocus in this process. This will prevent you from opening a session elsewhere."
|
156
|
-
},
|
157
|
-
{
|
158
|
-
name: 'use-session-id-in-path',
|
159
|
-
alias: 'i',
|
160
|
-
type: Boolean,
|
161
|
-
description: "If true, all API paths will include the session id. default to false and the default session Id is 'session'."
|
162
|
-
},
|
163
|
-
{
|
164
|
-
name: 'generate-api-docs',
|
165
|
-
alias: 'd',
|
166
|
-
type: Boolean,
|
167
|
-
default: true,
|
168
|
-
description: "Generate postman collection and expose api docs to open in browser."
|
169
|
-
},
|
170
|
-
{
|
171
|
-
name: 'session-data-only',
|
172
|
-
alias: 'o',
|
173
|
-
type: Boolean,
|
174
|
-
description: "Kill the process when the session data is saved.",
|
175
|
-
default: false
|
176
|
-
},
|
177
|
-
{
|
178
|
-
name: 'skip-save-postman-collection',
|
179
|
-
type: Boolean,
|
180
|
-
description: "Don't save the postman collection.",
|
181
|
-
default: false
|
182
|
-
},
|
183
|
-
{
|
184
|
-
name: 'headful',
|
185
|
-
type: Boolean,
|
186
|
-
description: "Show the browser window on your machine.",
|
187
|
-
default: false
|
188
|
-
},
|
189
|
-
{
|
190
|
-
name: 'headful',
|
191
|
-
type: Boolean,
|
192
|
-
description: "Pre authenticate documentation site [High security risk]."
|
193
|
-
},
|
194
|
-
{
|
195
|
-
name: 'stats',
|
196
|
-
type: Boolean,
|
197
|
-
description: "Exposes API swagger-statistics.",
|
198
|
-
default: false
|
199
|
-
},
|
200
|
-
{
|
201
|
-
name: 'pre-auth-docs',
|
202
|
-
type: Boolean,
|
203
|
-
description: "Grab config options from the environment variables.",
|
204
|
-
default: false
|
205
|
-
},
|
206
|
-
{
|
207
|
-
name: 'no-kill-on-logout',
|
208
|
-
type: Boolean,
|
209
|
-
description: "Keeps the process alive when host account logs out of session. default is false",
|
210
|
-
default: false
|
211
|
-
},
|
212
|
-
{
|
213
|
-
name: 'debug',
|
214
|
-
type: Boolean,
|
215
|
-
description: "Print out the CLI flag values and the WA_* env vars. default is false",
|
216
|
-
default: false
|
217
|
-
},
|
218
|
-
{
|
219
|
-
name: 'cors',
|
220
|
-
type: Boolean,
|
221
|
-
description: "Enable all cors requests",
|
222
|
-
default: false
|
223
|
-
},
|
224
|
-
{
|
225
|
-
name: 'socket',
|
226
|
-
type: Boolean,
|
227
|
-
description: "Expose a socket.io middleware on the server.",
|
228
|
-
default: false
|
229
|
-
},
|
230
|
-
{
|
231
|
-
name: 'license-key',
|
232
|
-
alias: 'l',
|
233
|
-
type: String,
|
234
|
-
typeLabel: '{yellowBright {underline B2BJ4JFB-2UN2J3ND-2J5I.....}}',
|
235
|
-
description: "The license key you want to use for this server. License keys are used to unlock features. Learn more here https://github.com/open-wa/wa-automate-nodejs#license-key"
|
236
|
-
},
|
237
|
-
{
|
238
|
-
name: 'ready-webhook',
|
239
|
-
type: String,
|
240
|
-
typeLabel: '{yellow {underline https://webhook.site/....}}',
|
241
|
-
description: "Webhook that fires when the EASY API is completely ready"
|
242
|
-
},
|
243
|
-
{
|
244
|
-
name: 'on-call',
|
245
|
-
type: String,
|
246
|
-
typeLabel: '{yellow {underline "Please do not call this number"}}',
|
247
|
-
description: "A default message to send to any number that is trying to call the host account"
|
248
|
-
},
|
249
|
-
{
|
250
|
-
name: 'auto-reject',
|
251
|
-
type: Boolean,
|
252
|
-
description: "Automatically reject incoming phone and video calls to the host account."
|
253
|
-
},
|
254
|
-
{
|
255
|
-
name: 'emit-unread',
|
256
|
-
type: Boolean,
|
257
|
-
description: "Emit all unread messages via onMessage webhooks on launch.",
|
258
|
-
default: false
|
259
|
-
},
|
260
|
-
{
|
261
|
-
name: 'skip-url-check',
|
262
|
-
type: Boolean,
|
263
|
-
description: "Don't validate webhook URLs. Enables use of non-FQDNs."
|
264
|
-
},
|
265
|
-
{
|
266
|
-
name: 'tunnel',
|
267
|
-
type: Boolean,
|
268
|
-
description: "Expose a tunnel to your EASY API session - this is for testing and it is unsecured."
|
269
|
-
},
|
270
|
-
{
|
271
|
-
name: 'help',
|
272
|
-
description: 'Print this usage guide.'
|
273
|
-
}
|
274
|
-
];
|
275
|
-
exports.optionKeys = optionList.map(({ name }) => (0, tools_1.camelize)(name));
|
276
|
-
exports.optionKeysWithDefalts = [...optionList.filter(o => o.hasOwnProperty('default')).map(({ name }) => (0, tools_1.camelize)(name)), 'popup'];
|
50
|
+
exports.optionKeys = cli_options_1.optionList.map(({ name }) => (0, tools_1.camelize)(name));
|
51
|
+
exports.optionKeysWithDefalts = [...cli_options_1.optionList.filter(o => o.hasOwnProperty('default')).map(({ name }) => (0, tools_1.camelize)(name)), 'popup'];
|
277
52
|
exports.PrimitiveConverter = {
|
278
53
|
Number: 1,
|
279
54
|
Boolean: true,
|
280
55
|
String: "hello"
|
281
56
|
};
|
282
|
-
exports.cliOptionNames = optionList.reduce((acc, c) => {
|
57
|
+
exports.cliOptionNames = cli_options_1.optionList.reduce((acc, c) => {
|
283
58
|
if (!c.type)
|
284
59
|
return acc;
|
285
60
|
acc[(0, tools_1.camelize)(c.name)] = typeof exports.PrimitiveConverter[c.type.name];
|
@@ -299,7 +74,7 @@ const meowFlags = () => {
|
|
299
74
|
};
|
300
75
|
});
|
301
76
|
const res = {};
|
302
|
-
optionList.map(option => {
|
77
|
+
cli_options_1.optionList.map(option => {
|
303
78
|
var _a, _b;
|
304
79
|
res[(0, tools_1.camelize)(option.name)] = Object.assign(Object.assign({}, option), {
|
305
80
|
//@ts-ignore
|
@@ -314,7 +89,7 @@ exports.helptext = (0, command_line_usage_1.default)([{
|
|
314
89
|
},
|
315
90
|
{
|
316
91
|
header: '',
|
317
|
-
optionList
|
92
|
+
optionList: cli_options_1.optionList
|
318
93
|
},
|
319
94
|
{
|
320
95
|
header: "Session config flags",
|
@@ -383,7 +158,7 @@ const cli = () => {
|
|
383
158
|
* 3. CLI flags
|
384
159
|
*/
|
385
160
|
const nonCliConfigs = Object.assign(Object.assign({}, (0, exports.envArgs)()), ((0, exports.configFile)(_cli.flags.config) || {}));
|
386
|
-
optionList.filter(option => option.default);
|
161
|
+
cli_options_1.optionList.filter(option => option.default);
|
387
162
|
const cliConfig = Object.assign(Object.assign(Object.assign({ sessionId: "session" }, nonCliConfigs), _cli.flags), exports.optionKeysWithDefalts.reduce((p, c) => nonCliConfigs.hasOwnProperty(c) ? Object.assign(Object.assign({}, p), { [c]: nonCliConfigs[c] }) : p, {}));
|
388
163
|
//firstly set up logger
|
389
164
|
if (cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.logging) {
|
package/dist/controllers/auth.js
CHANGED
@@ -205,6 +205,7 @@ class QRManager {
|
|
205
205
|
const fn = (qrData) => __awaiter(this, void 0, void 0, function* () {
|
206
206
|
if (qrData.length > 200 && !(config === null || config === void 0 ? void 0 : config.multiDevice)) {
|
207
207
|
spinner.fail(`Multi-Device detected, please set multiDevice to true in your config or add the --multi-device flag`);
|
208
|
+
spinner.emit(true, "MD_DETECT");
|
208
209
|
return resolve(md);
|
209
210
|
}
|
210
211
|
if (!gotResult && (qrData === 'QR_CODE_SUCCESS' || qrData === md)) {
|
@@ -401,6 +401,8 @@ function create(config = {}) {
|
|
401
401
|
config.eventMode = true;
|
402
402
|
const client = new Client_1.Client(waPage, config, debugInfo);
|
403
403
|
const { me } = yield client.getMe();
|
404
|
+
const licIndex = process.argv.findIndex(arg => arg === "--license-key" || arg === "-l");
|
405
|
+
config.licenseKey = config.licenseKey || licIndex !== -1 && process.argv[licIndex + 1];
|
404
406
|
if ((config === null || config === void 0 ? void 0 : config.licenseKey) || me._serialized !== earlyWid) {
|
405
407
|
yield (0, patch_manager_1.getAndInjectLicense)(waPage, config, me, debugInfo, spinner, me._serialized !== earlyWid ? false : yield licensePromise);
|
406
408
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@open-wa/wa-automate",
|
3
|
-
"version": "4.30.
|
3
|
+
"version": "4.30.12",
|
4
4
|
"licenseCheckUrl": "https://openwa.dev/license-check",
|
5
5
|
"brokenMethodReportUrl": "https://openwa.dev/report-bm",
|
6
6
|
"patches": "https://cdn.openwa.dev/patches.json",
|
@@ -73,22 +73,22 @@
|
|
73
73
|
"@types/fs-extra": "^9.0.11",
|
74
74
|
"@types/line-reader": "0.0.34",
|
75
75
|
"@types/localtunnel": "^2.0.1",
|
76
|
-
"@types/marked": "^
|
76
|
+
"@types/marked": "^4.0.2",
|
77
77
|
"@types/mime-types": "^2.1.0",
|
78
|
-
"@types/node": "^
|
78
|
+
"@types/node": "^17.0.13",
|
79
79
|
"@types/puppeteer": "^5.4.0",
|
80
80
|
"@types/shelljs": "^0.8.5",
|
81
81
|
"@types/winston-syslog": "^2.4.0",
|
82
82
|
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
83
|
-
"@typescript-eslint/parser": "^
|
83
|
+
"@typescript-eslint/parser": "^5.10.1",
|
84
84
|
"auto-changelog": "^2.0.0",
|
85
|
-
"ava": "^
|
85
|
+
"ava": "^4.0.1",
|
86
86
|
"changelog-parser": "^2.8.0",
|
87
87
|
"command-line-args": "^5.1.1",
|
88
88
|
"eslint": "^8.1.0",
|
89
89
|
"husky": "^7.0.0",
|
90
90
|
"line-reader": "^0.4.0",
|
91
|
-
"marked": "^
|
91
|
+
"marked": "^4.0.10",
|
92
92
|
"node-emoji": "^1.10.0",
|
93
93
|
"onchange": "^7.0.2",
|
94
94
|
"precise-commits": "^1.0.2",
|
@@ -101,18 +101,18 @@
|
|
101
101
|
"typeconv": "^1.7.0",
|
102
102
|
"typedoc": "^0.21.6",
|
103
103
|
"typedoc-plugin-pages": "^1.0.1",
|
104
|
-
"typescript": "^4.
|
104
|
+
"typescript": "^4.4.4"
|
105
105
|
},
|
106
106
|
"dependencies": {
|
107
|
-
"@discordjs/collection": "^0.
|
107
|
+
"@discordjs/collection": "^0.5.0",
|
108
108
|
"@open-wa/wa-decrypt": "^4.3.1",
|
109
109
|
"atob": "^2.1.2",
|
110
110
|
"aws4": "^1.11.0",
|
111
|
-
"axios": "^0.
|
111
|
+
"axios": "^0.25.0",
|
112
112
|
"boxen": "^5.0.0",
|
113
113
|
"cfonts": "^2.8.5",
|
114
114
|
"change-case": "^4.1.2",
|
115
|
-
"chrome-launcher": "^0.
|
115
|
+
"chrome-launcher": "^0.15.0",
|
116
116
|
"command-exists": "^1.2.9",
|
117
117
|
"command-line-usage": "^6.1.1",
|
118
118
|
"cors": "^2.8.5",
|
@@ -163,7 +163,7 @@
|
|
163
163
|
"terminal-link": "^2.1.1",
|
164
164
|
"terminate": "^2.5.0",
|
165
165
|
"traverse": "^0.6.6",
|
166
|
-
"ts-json-schema-generator": "^0.
|
166
|
+
"ts-json-schema-generator": "^0.97.0",
|
167
167
|
"ts-morph": "^12.0.0",
|
168
168
|
"type-fest": "^1.1.1",
|
169
169
|
"update-notifier": "^5.0.0",
|