fix(whatsapp.gblib): Fix in bot switching.
This commit is contained in:
parent
1e8b66f9b4
commit
d7e00a2154
2 changed files with 15 additions and 3 deletions
|
@ -108,6 +108,10 @@ export class GBDeployer implements IGBDeployer {
|
||||||
if (min['cacheToken']) {
|
if (min['cacheToken']) {
|
||||||
return min['cacheToken'];
|
return min['cacheToken'];
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// Get token as root only if the bot does not have
|
||||||
|
// an custom tenant for retrieving packages.
|
||||||
|
|
||||||
token = await (min.adminService as any)['acquireElevatedToken']
|
token = await (min.adminService as any)['acquireElevatedToken']
|
||||||
(min.instance.instanceId, min.instance.authenticatorTenant?false:true);
|
(min.instance.instanceId, min.instance.authenticatorTenant?false:true);
|
||||||
|
|
||||||
|
|
|
@ -60,10 +60,18 @@ export class GBImporter {
|
||||||
localPath: string,
|
localPath: string,
|
||||||
additionalInstance: IGBInstance = null
|
additionalInstance: IGBInstance = null
|
||||||
) {
|
) {
|
||||||
const settingsJson = JSON.parse(Fs.readFileSync(urlJoin(localPath, 'settings.json'), 'utf8'));
|
const file = urlJoin(localPath, 'settings.json');
|
||||||
|
|
||||||
|
let settingsJson = {botId: botId};
|
||||||
|
if (Fs.existsSync(file)){
|
||||||
|
|
||||||
|
settingsJson = JSON.parse(Fs.readFileSync(file, 'utf8'));
|
||||||
if (botId === undefined) {
|
if (botId === undefined) {
|
||||||
botId = settingsJson.botId;
|
botId = settingsJson.botId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
let instance: IGBInstance;
|
let instance: IGBInstance;
|
||||||
if (botId === undefined) {
|
if (botId === undefined) {
|
||||||
botId = GBConfigService.get('BOT_ID');
|
botId = GBConfigService.get('BOT_ID');
|
||||||
|
|
Loading…
Add table
Reference in a new issue