Skip to content

Commit

Permalink
fix(core.gbapp): Fix GET/SET in .gbdialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Nov 6, 2020
1 parent c6f3d52 commit 8842bf7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Dário Vieira <dario.junior3@gmail.com>"
],
"engines": {
"node": "=10.15.2"
"node": "=14.10.1"
},
"license": "AGPL-3.0",
"preferGlobal": true,
Expand Down
10 changes: 8 additions & 2 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,16 @@ export class GBMinService {
} else if (context.activity.text.charAt(0) === '/') {
let text = context.activity.text;
let parts = text.split(' ');
let dialogName = parts[0];
let cmdOrDialogName = parts[0];
parts.splice(0, 1);
let args = parts.join(' ');
await step.beginDialog(dialogName, { args: args });

if (cmdOrDialogName === '/call'){
await GBVMService.callVM(args, min, step, this.deployer);
}
else{
await step.beginDialog(cmdOrDialogName, { args: args });
}
} else if (globalQuit(step.context.activity.locale, context.activity.text)) {
// TODO: Hard-code additional languages.
await step.cancelAllDialogs();
Expand Down
10 changes: 9 additions & 1 deletion packages/core.gbapp/services/GBVMService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,15 @@ export class GBVMService extends GBService {
});

code = code.replace(/(\w+)\s*\=\s*get\s(.*)/gi, ($0, $1, $2) => {
return `let ${$1} = sys().httpGet (${$2})`;
if ($2.indexOf('http') !== -1) {
return `let ${$1} = sys().httpGet (${$2})`;
} else {
return `let ${$1} = sys().get (${$2})`;
}
});

code = code.replace(/set\s(.*)/gi, ($0, $1, $2) => {
return `sys().set (${$1})`;
});

code = code.replace(/(\w+)\s*\=\s*post\s*(.*),\s*(.*)/gi, ($0, $1, $2, $3) => {
Expand Down

0 comments on commit 8842bf7

Please sign in to comment.