Skip to content

Commit

Permalink
fix: Fixed func is not a exported function
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta authored Mar 27, 2024
1 parent a00bd75 commit 59db1a5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/conn/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import * as webpack from '../webpack';
import { IsOfficialClient } from '../whatsapp';
import { wrapModuleFunction } from '../whatsapp/exportModule';
import { isLegitErrorStack } from '../whatsapp/functions';

webpack.onInjected(() => {
/**
Expand All @@ -26,7 +27,7 @@ webpack.onInjected(() => {
});

webpack.onFullReady(() => {
wrapModuleFunction(IsOfficialClient.isLegitErrorStack, () => {
wrapModuleFunction(isLegitErrorStack, () => {
return true;
});
}, 1000);
1 change: 1 addition & 0 deletions src/whatsapp/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export * from './handleSingleMsg';
export * from './initializeAltDeviceLinking';
export * from './isAnimatedWebp';
export * from './isAuthenticated';
export * from './isLegitErrorStack';
export * from './isRegistered';
export * from './isUnreadTypeMsg';
export * from './joinGroupViaInvite';
Expand Down
30 changes: 30 additions & 0 deletions src/whatsapp/functions/isLegitErrorStack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*!
* Copyright 2024 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { exportModule } from '../exportModule';

/**
* @whatsapp 525438
*/
export declare function isLegitErrorStack(): boolean;

exportModule(
exports,
{
isLegitErrorStack: 'isLegitErrorStack',
},
(m) => m.isLegitErrorStack
);
4 changes: 1 addition & 3 deletions src/whatsapp/misc/IsOfficialClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ import { exportModule } from '../exportModule';
* @whatsapp >= 2.3000.x
*/
export declare namespace IsOfficialClient {
function isLegitErrorStack(): boolean;
let isOfficialClient: boolean;
}

exportModule(
exports,
'IsOfficialClient',
(m) => m.isOfficialClient && m.isLegitErrorStack
(m) => typeof m.isOfficialClient !== 'undefined'
);

webpack.injectFallbackModule('IsOfficialClient', {
isOfficialClient: true,
isLegitErrorStack: () => true,
});

0 comments on commit 59db1a5

Please sign in to comment.