fix(core.gbapp): #341 fix regarding COPY files.

This commit is contained in:
rodrigorodriguez 2023-04-01 08:01:10 -03:00
parent f2889879a6
commit a292b77116
4 changed files with 18 additions and 10 deletions

View file

@ -426,9 +426,9 @@ export class DialogKeywords {
}
/**
* Returns current time in format hh:dd.
* Returns current time in format hh:mm.
*
* @example SAVE "contacts.xlsx", name, email, NOW
* @example NOW
*
*/
public async getNow({ pid }) {
@ -1133,6 +1133,11 @@ export class DialogKeywords {
}
else if (filename.url)
{
url = filename.url;
}
// Handles Markdown.
else if (filename.indexOf('.md') > -1) {
GBLog.info(`BASIC: Sending the contents of ${filename} markdown to mobile ${mobile}.`);

View file

@ -684,7 +684,7 @@ export class KeywordsExpressions {
keywords[i++] = [
/^\s*(copy)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
const params = this.getParams($3, ['src', 'dst']);
const params = this.getParams($3, ['src', 'dest']);
return `await sys.copyFile ({pid: pid, ${params}})`;
}
];
@ -692,7 +692,7 @@ export class KeywordsExpressions {
keywords[i++] = [
/^\s*(convert)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
const params = this.getParams($3, ['src', 'dst']);
const params = this.getParams($3, ['src', 'dest']);
return `await sys.convert ({pid: pid, ${params}})`;
}
];
@ -727,9 +727,9 @@ export class KeywordsExpressions {
];
keywords[i++] = [
/^\s*SCREENSHOT\s*(.*)/gim,
/^\s*((?:[a-z]+.?)(?:(?:\w+).)(?:\w+)*)\s*=\s*SCREENSHOT\s*(.*)/gim,
($0, $1, $2) => {
return `await wa.screenshot({pid: pid, handle: page, selector: ${$1}})`;
return `${$1} = await wa.screenshot({pid: pid, handle: page, selector: ${$1}})`;
}
];
@ -788,8 +788,7 @@ export class KeywordsExpressions {
keywords[i++] = [
/^\s*((?:[a-z]+.?)(?:(?:\w+).)(?:\w+)*)\s*=\s*BLUR\s*(.*)/gim,
($0, $1, $2, $3) => {
return `
${$1} = await img.blur({pid: pid, args: [${$2}]})`;
return `${$1} = await img.blur({pid: pid, args: [${$2}]})`;
}
];

View file

@ -316,7 +316,7 @@ export class WebAutomationServices {
/**
* Returns the screenshot of page or element
*
* @example file = SCREENSHOT page
* @example file = SCREENSHOT "#selector"
*/
public async screenshot({ pid, handle, selector }) {
const { min, user } = await DialogKeywords.getProcessInfo(pid);
@ -331,7 +331,7 @@ export class WebAutomationServices {
const url = urlJoin(GBServer.globals.publicAddress, min.botId, 'cache', Path.basename(localName));
GBLog.info(`BASIC: WebAutomation: Screenshot captured at ${url}.`);
return url;
return { data: null, localName: localName, url: url };
}
/**

View file

@ -112,6 +112,10 @@ export class GBServer {
GBLog.error(`UNCAUGHT_EXCEPTION: ${err.toString()} ${err['stack'] ? '\n' + err['stack'] : ''}`);
});
process.on('SIGTERM', () => {
GBLog.info('SIGTERM signal received.');
});
// Creates working directory.
process.env.PWD = process.cwd();