@tiledesk/tiledesk-server 2.3.125 → 2.3.126

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.3.125",
4
+ "version": "2.3.126",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -392,9 +392,12 @@
392
392
 
393
393
  botEvent.on("faqbot.create", function(faq_kb) {
394
394
  setImmediate(() => {
395
+ let clonedbot = Object.assign({}, faq_kb);
396
+ delete clonedbot.secret;
397
+
395
398
  var key = faq_kb.id_project+":faq_kbs:id:"+faq_kb._id;
396
399
  winston.verbose("Creating cache for faq_kb.create with key: " + key);
397
- client.set(key, faq_kb, cacheUtil.defaultTTL, (err, reply) => {
400
+ client.set(key, clonedbot, cacheUtil.defaultTTL, (err, reply) => {
398
401
  winston.debug("Created cache for faq_kb.create",reply);
399
402
  winston.verbose("Created cache for faq_kb.create",{err:err});
400
403
  });
@@ -639,6 +642,7 @@
639
642
  subscriptionEvent.on('subscription.create', function(trigger) {
640
643
  setImmediate(() => {
641
644
 
645
+ //TODO i think you must clone trigger and remove .secret before caching
642
646
  var key =trigger.id_project+":subscriptions:*";
643
647
  winston.verbose("Deleting cache for subscription.create with key: " + key);
644
648
  client.del(key, function (err, reply) {
package/routes/faq_kb.js CHANGED
@@ -826,7 +826,7 @@ router.post('/importjson/:id_faq_kb', upload.single('uploadFile'), async (req, r
826
826
 
827
827
  router.get('/exportjson/:id_faq_kb', (req, res) => {
828
828
 
829
- winston.info("exporting bot...")
829
+ winston.debug("exporting bot...")
830
830
 
831
831
 
832
832
  let id_faq_kb = req.params.id_faq_kb;
@@ -51,7 +51,14 @@ class BotSubscriptionNotifier {
51
51
  };
52
52
 
53
53
  // TODO metti bot_? a user._id
54
- var token = jwt.sign(bot.toObject(), botWithSecret.secret, signOptions);
54
+
55
+ // tolgo description, attributes
56
+ let botPayload = bot.toObject();
57
+ delete botPayload.secret;
58
+ delete botPayload.description;
59
+ delete botPayload.attributes;
60
+
61
+ var token = jwt.sign(botPayload, botWithSecret.secret, signOptions);
55
62
  json["token"] = token;
56
63
 
57
64