Skip to content

Commit

Permalink
fix: Added option to disable device name override
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Oct 12, 2021
1 parent d04e5ac commit 961e6e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
* ```
*/
export interface Config {
deviceName: string;
/**
* Set the device name connected, false to disable
* @default 'WPPConnect'
*/
deviceName: string | false;
}

export const defaultConfig: Config = {
Expand Down
7 changes: 5 additions & 2 deletions src/deviceName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@
* limitations under the License.
*/

import * as packageJSON from '../package.json';
import { config } from './config';
import * as webpack from './webpack';

// Update deviceName connected
webpack.onInjected(() => {
if (!config.deviceName) {
return;
}

const m = webpack.search((m) => m.default.info && m.default.hardRefresh);
if (m) {
const info = m.default.info();

info.os = config.deviceName;
info.version = `${packageJSON.version}`;
info.version = undefined;
info.name = undefined;
info.ua = undefined;

Expand Down

0 comments on commit 961e6e2

Please sign in to comment.