fix(azuredeployerservice.gbapp): Update of password generator libs.

This commit is contained in:
Alan Perdomo 2023-01-03 11:24:08 -03:00
parent 07d9cf67db
commit 57461ee006
3 changed files with 29 additions and 31 deletions

View file

@ -49,7 +49,7 @@ import { GBSharePointService } from '../../sharepoint.gblib/services/SharePointS
import { GuaribasAdmin } from '../models/AdminModel.js'; import { GuaribasAdmin } from '../models/AdminModel.js';
import msRestAzure from 'ms-rest-azure'; import msRestAzure from 'ms-rest-azure';
import Path from 'path'; import Path from 'path';
import {caseSensitive_Numbs_SpecialCharacters_PW} from 'super-strong-password-generator' import { caseSensitive_Numbs_SpecialCharacters_PW, lowercase_PW } from 'super-strong-password-generator'
import crypto from 'crypto'; import crypto from 'crypto';
import Fs from 'fs'; import Fs from 'fs';
import { GBServer } from '../../../src/app.js'; import { GBServer } from '../../../src/app.js';
@ -91,7 +91,7 @@ export class GBAdminService implements IGBAdminService {
public static getMobileCode() { public static getMobileCode() {
return caseSensitive_Numbs_SpecialCharacters_PW(15); return Math.trunc(Math.random() * 6);
} }
public static getRndPassword(): string { public static getRndPassword(): string {
@ -103,18 +103,18 @@ export class GBAdminService implements IGBAdminService {
public static getRndReadableIdentifier() { public static getRndReadableIdentifier() {
return caseSensitive_Numbs_SpecialCharacters_PW(15); return lowercase_PW(14);
} }
public static getNumberIdentifier () { public static getNumberIdentifier(size: number = 14): string {
return caseSensitive_Numbs_SpecialCharacters_PW(15); return Math.trunc(Math.random() * size).toString();
} }
/** /**
* @see https://stackoverflow.com/a/52171480 * @see https://stackoverflow.com/a/52171480
*/ */
public static getHash (str, seed = 0) { public static getHash(str: string, seed = 0) {
let h1 = 0xdeadbeef ^ seed, let h1 = 0xdeadbeef ^ seed,
h2 = 0x41c6ce57 ^ seed; h2 = 0x41c6ce57 ^ seed;
for (let i = 0, ch; i < str.length; i++) { for (let i = 0, ch; i < str.length; i++) {
@ -127,7 +127,7 @@ export class GBAdminService implements IGBAdminService {
return 4294967296 * (2097151 & h2) + (h1 >>> 0); return 4294967296 * (2097151 & h2) + (h1 >>> 0);
} }
public static async undeployPackageCommand (text: any, 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);
@ -151,8 +151,6 @@ export class GBAdminService implements IGBAdminService {
const siteName = text.split(' ')[1]; const siteName = text.split(' ')[1];
const folderName = text.split(' ')[2]; const folderName = text.split(' ')[2];
const s = new GBSharePointService();
const localFolder = Path.join('work', `${min.instance.botId}.gbai`, Path.basename(folderName)); const localFolder = Path.join('work', `${min.instance.botId}.gbai`, Path.basename(folderName));
// .gbot packages are handled using storage API, so no download // .gbot packages are handled using storage API, so no download
@ -212,7 +210,7 @@ export class GBAdminService implements IGBAdminService {
} }
public async acquireElevatedToken(instanceId: number): Promise<string> { public async acquireElevatedToken(instanceId: number): Promise<string> {
const minBoot = GBServer.globals.minBoot as any; const minBoot = GBServer.globals.minBoot;
instanceId = minBoot.instance.instanceId; instanceId = minBoot.instance.instanceId;
return new Promise<string>(async (resolve, reject) => { return new Promise<string>(async (resolve, reject) => {

View file

@ -404,7 +404,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
await this.createSearch(name, searchName, instance.cloudLocation); await this.createSearch(name, searchName, instance.cloudLocation);
const searchKeys = await this.searchClient.adminKeys.get(name, searchName); const searchKeys = await this.searchClient.adminKeys.get(name, searchName);
instance.searchHost = `${searchName}.search.windows.net`; instance.searchHost = `${searchName}.search.windows.net`;
instance.searchIndex = 'azuresql-index.js'; instance.searchIndex = 'azuresql-index';
instance.searchIndexer = 'azuresql-indexer'; instance.searchIndexer = 'azuresql-indexer';
instance.searchKey = searchKeys.primaryKey; instance.searchKey = searchKeys.primaryKey;

View file

@ -10,7 +10,7 @@
"@midudev/react-static-content": "1.0.4", "@midudev/react-static-content": "1.0.4",
"ajv": "8.11.2", "ajv": "8.11.2",
"botframework-directlinejs": "0.15.1", "botframework-directlinejs": "0.15.1",
"botframework-webchat": "4.15.5", "botframework-webchat": "4.15.6",
"deep-extend": "0.6.0", "deep-extend": "0.6.0",
"eslint": "8.28.0", "eslint": "8.28.0",
"fetch": "1.1.0", "fetch": "1.1.0",