Skip to content

Commit a292b77

Browse files
fix(core.gbapp): #341 fix regarding COPY files.
1 parent f288987 commit a292b77

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

packages/basic.gblib/services/DialogKeywords.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,9 @@ export class DialogKeywords {
426426
}
427427

428428
/**
429-
* Returns current time in format hh:dd.
429+
* Returns current time in format hh:mm.
430430
*
431-
* @example SAVE "contacts.xlsx", name, email, NOW
431+
* @example NOW
432432
*
433433
*/
434434
public async getNow({ pid }) {
@@ -1133,6 +1133,11 @@ export class DialogKeywords {
11331133

11341134
}
11351135

1136+
else if (filename.url)
1137+
{
1138+
url = filename.url;
1139+
}
1140+
11361141
// Handles Markdown.
11371142
else if (filename.indexOf('.md') > -1) {
11381143
GBLog.info(`BASIC: Sending the contents of ${filename} markdown to mobile ${mobile}.`);

packages/basic.gblib/services/KeywordsExpressions.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -684,15 +684,15 @@ export class KeywordsExpressions {
684684
keywords[i++] = [
685685
/^\s*(copy)(\s*)(.*)/gim,
686686
($0, $1, $2, $3) => {
687-
const params = this.getParams($3, ['src', 'dst']);
687+
const params = this.getParams($3, ['src', 'dest']);
688688
return `await sys.copyFile ({pid: pid, ${params}})`;
689689
}
690690
];
691691

692692
keywords[i++] = [
693693
/^\s*(convert)(\s*)(.*)/gim,
694694
($0, $1, $2, $3) => {
695-
const params = this.getParams($3, ['src', 'dst']);
695+
const params = this.getParams($3, ['src', 'dest']);
696696
return `await sys.convert ({pid: pid, ${params}})`;
697697
}
698698
];
@@ -727,9 +727,9 @@ export class KeywordsExpressions {
727727
];
728728

729729
keywords[i++] = [
730-
/^\s*SCREENSHOT\s*(.*)/gim,
730+
/^\s*((?:[a-z]+.?)(?:(?:\w+).)(?:\w+)*)\s*=\s*SCREENSHOT\s*(.*)/gim,
731731
($0, $1, $2) => {
732-
return `await wa.screenshot({pid: pid, handle: page, selector: ${$1}})`;
732+
return `${$1} = await wa.screenshot({pid: pid, handle: page, selector: ${$1}})`;
733733
}
734734
];
735735

@@ -788,8 +788,7 @@ export class KeywordsExpressions {
788788
keywords[i++] = [
789789
/^\s*((?:[a-z]+.?)(?:(?:\w+).)(?:\w+)*)\s*=\s*BLUR\s*(.*)/gim,
790790
($0, $1, $2, $3) => {
791-
return `
792-
${$1} = await img.blur({pid: pid, args: [${$2}]})`;
791+
return `${$1} = await img.blur({pid: pid, args: [${$2}]})`;
793792
}
794793
];
795794

packages/basic.gblib/services/WebAutomationServices.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export class WebAutomationServices {
316316
/**
317317
* Returns the screenshot of page or element
318318
*
319-
* @example file = SCREENSHOT page
319+
* @example file = SCREENSHOT "#selector"
320320
*/
321321
public async screenshot({ pid, handle, selector }) {
322322
const { min, user } = await DialogKeywords.getProcessInfo(pid);
@@ -331,7 +331,7 @@ export class WebAutomationServices {
331331
const url = urlJoin(GBServer.globals.publicAddress, min.botId, 'cache', Path.basename(localName));
332332
GBLog.info(`BASIC: WebAutomation: Screenshot captured at ${url}.`);
333333

334-
return url;
334+
return { data: null, localName: localName, url: url };
335335
}
336336

337337
/**

src/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ export class GBServer {
112112
GBLog.error(`UNCAUGHT_EXCEPTION: ${err.toString()} ${err['stack'] ? '\n' + err['stack'] : ''}`);
113113
});
114114

115+
process.on('SIGTERM', () => {
116+
GBLog.info('SIGTERM signal received.');
117+
});
118+
115119
// Creates working directory.
116120

117121
process.env.PWD = process.cwd();

0 commit comments

Comments
 (0)