fix(all): Create bot working again.
This commit is contained in:
parent
fc28eb9ec0
commit
ed74c5b003
1 changed files with 15 additions and 15 deletions
|
@ -90,7 +90,7 @@ export class GBAdminService implements IGBAdminService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async getADALCredentialsFromUsername(username: string, password: string) {
|
public static async getADALCredentialsFromUsername(username: string, password: string) {
|
||||||
|
|
||||||
return await msRestAzure.loginWithUsernamePassword(username, password);
|
return await msRestAzure.loginWithUsernamePassword(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,14 +113,14 @@ export class GBAdminService implements IGBAdminService {
|
||||||
|
|
||||||
public static getNumberIdentifier(digits: number = 14): string {
|
public static getNumberIdentifier(digits: number = 14): string {
|
||||||
|
|
||||||
if (digits <= 0) {
|
if (digits <= 0) {
|
||||||
throw new Error('Number of digits should be greater than 0.');
|
throw new Error('Number of digits should be greater than 0.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const min = 10 ** (digits - 1);
|
const min = 10 ** (digits - 1);
|
||||||
const max = 10 ** digits - 1;
|
const max = 10 ** digits - 1;
|
||||||
const randomNumber = Math.floor(Math.random() * (max - min + 1)) + min;
|
const randomNumber = Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
return randomNumber.toString();
|
return randomNumber.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +140,7 @@ export class GBAdminService implements IGBAdminService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async undeployPackageCommand(text: string, min: GBMinInstance) {
|
public static async undeployPackageCommand(text: string, min: GBMinInstance) {
|
||||||
|
|
||||||
const packageName = text.split(' ')[1];
|
const packageName = text.split(' ')[1];
|
||||||
const importer = new GBImporter(min.core);
|
const importer = new GBImporter(min.core);
|
||||||
const deployer = new GBDeployer(min.core, importer);
|
const deployer = new GBDeployer(min.core, importer);
|
||||||
|
@ -162,16 +162,16 @@ export class GBAdminService implements IGBAdminService {
|
||||||
}
|
}
|
||||||
await deployer['deployPackage2'](min, user, urlJoin(additionalPath, packageName));
|
await deployer['deployPackage2'](min, user, urlJoin(additionalPath, packageName));
|
||||||
} else {
|
} else {
|
||||||
const folderName = text.split(' ')[2];
|
const folderName = text.split(' ')[2];
|
||||||
const packageType = Path.extname(folderName).substr(1);
|
const packageType = Path.extname(folderName).substr(1);
|
||||||
const gbaiPath = DialogKeywords.getGBAIPath(min.instance.botId, packageType, null);
|
const gbaiPath = DialogKeywords.getGBAIPath(min.instance.botId, packageType, null);
|
||||||
const localFolder = Path.join('work', gbaiPath);
|
const localFolder = Path.join('work', gbaiPath);
|
||||||
|
|
||||||
// .gbot packages are handled using storage API, so no download
|
// .gbot packages are handled using storage API, so no download
|
||||||
// of local resources is required.
|
// of local resources is required.
|
||||||
const gbai = DialogKeywords.getGBAIPath(min.instance.botId);
|
const gbai = DialogKeywords.getGBAIPath(min.instance.botId);
|
||||||
await deployer ['downloadFolder'](min,
|
await deployer['downloadFolder'](min,
|
||||||
Path.join('work', `${gbai}`),
|
Path.join('work', `${gbai}`),
|
||||||
Path.basename(localFolder));
|
Path.basename(localFolder));
|
||||||
await deployer['deployPackage2'](min, user, localFolder);
|
await deployer['deployPackage2'](min, user, localFolder);
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ export class GBAdminService implements IGBAdminService {
|
||||||
|
|
||||||
public async acquireElevatedToken(instanceId: number, root: boolean = false): Promise<string> {
|
public async acquireElevatedToken(instanceId: number, root: boolean = false): Promise<string> {
|
||||||
|
|
||||||
if (root){
|
if (root) {
|
||||||
const minBoot = GBServer.globals.minBoot;
|
const minBoot = GBServer.globals.minBoot;
|
||||||
instanceId = minBoot.instance.instanceId;
|
instanceId = minBoot.instance.instanceId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue