Skip to content

Commit

Permalink
fix(core.gbapp): #341 fix regarding COPY files.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Apr 1, 2023
1 parent f288987 commit a292b77
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
9 changes: 7 additions & 2 deletions packages/basic.gblib/services/DialogKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down Expand Up @@ -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}.`);
Expand Down
11 changes: 5 additions & 6 deletions packages/basic.gblib/services/KeywordsExpressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,15 +684,15 @@ 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}})`;
}
];

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}})`;
}
];
Expand Down Expand Up @@ -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}})`;
}
];

Expand Down Expand Up @@ -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}]})`;
}
];

Expand Down
4 changes: 2 additions & 2 deletions packages/basic.gblib/services/WebAutomationServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 };
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a292b77

Please sign in to comment.