fix(core.gbapp): FIX SSR errors and setOption impersonated.
This commit is contained in:
parent
19e1292693
commit
e596f31de6
2 changed files with 27 additions and 9 deletions
|
@ -557,10 +557,17 @@ export class DialogKeywords {
|
|||
// throw new Error(`Not possible to define ${name} as it is a reserved system param name.`);
|
||||
// }
|
||||
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
|
||||
const sec = new SecService();
|
||||
await sec.setParam(user.userId, name , value);
|
||||
GBLog.info(`BASIC: ${name} = ${value} (botId: ${min.botId})`);
|
||||
return { min, user, params };
|
||||
const sec = new SecService();
|
||||
if (user)
|
||||
{
|
||||
await sec.setParam(user.userId, name , value);
|
||||
return { min, user, params };
|
||||
}
|
||||
else
|
||||
{
|
||||
min[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static async getOption({ pid, name }) {
|
||||
|
@ -568,8 +575,15 @@ export class DialogKeywords {
|
|||
throw new Error(`Not possible to retrieve ${name} system param.`);
|
||||
}
|
||||
let { min, user, params } = await DialogKeywords.getProcessInfo(pid);
|
||||
const sec = new SecService();
|
||||
return await sec.getParam(user, name);
|
||||
|
||||
if (user){
|
||||
const sec = new SecService();
|
||||
return await sec.getParam(user, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return min[name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -284,10 +284,14 @@ export class GBSSR {
|
|||
// Tries to find botId from URL.
|
||||
|
||||
const minBoot = GBServer.globals.minBoot;
|
||||
let botId =
|
||||
req.originalUrl && req.originalUrl === '/' ?
|
||||
minBoot.botId :
|
||||
/\/([A-Za-z0-9\-\_]+)\/*/.exec(req.originalUrl)[1]
|
||||
let botId = minBoot.botId;
|
||||
if (req.originalUrl && req.originalUrl === '/') {
|
||||
let tmp = /\/([A-Za-z0-9\-\_]+)\/*/.exec(req.originalUrl);
|
||||
if (tmp) {
|
||||
botId = tmp[1];
|
||||
}
|
||||
}
|
||||
|
||||
let min: GBMinInstance =
|
||||
req.url === '/'
|
||||
? minBoot
|
||||
|
|
Loading…
Add table
Reference in a new issue