@tiledesk/tiledesk-server 2.3.10 → 2.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -14
- package/app.js +6 -4
- package/package.json +1 -1
- package/routes/widget.js +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
curl --location --request POST 'https://console.native.tiledesk.com/api/62ea3c58cd9923001a6ccdf3/requests/support-group-62ea3c58cd9923001a6ccdf3-088a9b9d28d3427ea99ab928a7aeb9d4/messages' \
|
|
2
|
-
--header 'Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ3ZWJob29rX2VuYWJsZWQiOmZhbHNlLCJ0eXBlIjoiZXh0ZXJuYWwiLCJsYW5ndWFnZSI6ImVuIiwiX2lkIjoiNjJlYTNkOGFjZDk5MjMwMDFhNmNjZjQ1IiwibmFtZSI6IkhlbGxvQm90IiwidXJsIjoiaHR0cHM6Ly9Cb3RUaW1lc3RhbXAuZ2FicmllbGVwYW5pY28ucmVwbC5jby9ib3QiLCJpZF9wcm9qZWN0IjoiNjJlYTNjNThjZDk5MjMwMDFhNmNjZGYzIiwidHJhc2hlZCI6ZmFsc2UsImNyZWF0ZWRCeSI6IjYxYmRkMGM0ZDBhMmE3MDAxYTI4YjliNCIsImNyZWF0ZWRBdCI6IjIwMjItMDgtMDNUMDk6MTk6MDYuNDMyWiIsInVwZGF0ZWRBdCI6IjIwMjItMDgtMDNUMDk6MTk6MDYuNDMyWiIsIl9fdiI6MCwiaWF0IjoxNjU5NTE4NzI1LCJhdWQiOiJodHRwczovL3RpbGVkZXNrLmNvbS9ib3RzLzYyZWEzZDhhY2Q5OTIzMDAxYTZjY2Y0NSIsImlzcyI6Imh0dHBzOi8vdGlsZWRlc2suY29tIiwic3ViIjoiYm90IiwianRpIjoiMzY3ZWI4YzAtNjczZi00NzUwLThhNmEtNzUyMzA4YmNhMGIyIn0.B4cq9b9V__S0uR9xYkuxykBKfQ4vU0DyO278KAJG4Us' \
|
|
3
|
-
--header 'Content-Type: application/json' \
|
|
4
|
-
--data-raw '{"text":"Cheers! You said:"}'
|
|
5
1
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
--header 'Content-Type: application/json' \
|
|
9
|
-
--data-raw '{"text":"Cheers! You said:"}'
|
|
2
|
+
# 2.3.11 -> PROD
|
|
3
|
+
- Getting ip fix
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
https://www.intercom.com/help/en/articles/3449698-prevent-replies-after-you-close-a-conversation
|
|
13
|
-
|
|
14
|
-
visitor counter fa uscire errore mongo
|
|
15
|
-
|
|
16
|
-
# # 2.3.10 -> PROD
|
|
5
|
+
# 2.3.10
|
|
17
6
|
- Added tilebot submodule
|
|
18
7
|
- Askbot endpoint fix for tilebot and auto create faqs for tilebot
|
|
19
8
|
- Added /widgets/ip endpoint
|
package/app.js
CHANGED
|
@@ -175,8 +175,6 @@ if (process.env.CREATE_INITIAL_DATA !== "false") {
|
|
|
175
175
|
|
|
176
176
|
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
180
178
|
var app = express();
|
|
181
179
|
|
|
182
180
|
|
|
@@ -339,8 +337,12 @@ var projectSetter = function (req, res, next) {
|
|
|
339
337
|
|
|
340
338
|
function customDetection (req) {
|
|
341
339
|
// const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
|
342
|
-
const ip = (req.headers['x-forwarded-for'] || '').split(',').pop().trim() || //https://stackoverflow.com/questions/8107856/how-to-determine-a-users-ip-address-in-node
|
|
343
|
-
|
|
340
|
+
// const ip = (req.headers['x-forwarded-for'] || '').split(',').pop().trim() || //https://stackoverflow.com/questions/8107856/how-to-determine-a-users-ip-address-in-node
|
|
341
|
+
// req.socket.remoteAddress
|
|
342
|
+
|
|
343
|
+
const ip = (req) =>
|
|
344
|
+
req.headers['x-forwarded-for']?.split(',').shift()
|
|
345
|
+
|| req.socket?.remoteAddress
|
|
344
346
|
|
|
345
347
|
winston.info("standard ip: "+ip); // ip address of the user
|
|
346
348
|
return ip;
|
package/package.json
CHANGED
package/routes/widget.js
CHANGED
|
@@ -217,12 +217,20 @@ router.get('/', function(req, res, next) {
|
|
|
217
217
|
|
|
218
218
|
|
|
219
219
|
|
|
220
|
-
const ipStandard = (req.headers['x-forwarded-for'] || '').split(',').
|
|
220
|
+
const ipStandard = (req.headers['x-forwarded-for'] || '').split(',').shift().trim() || //https://stackoverflow.com/questions/8107856/how-to-determine-a-users-ip-address-in-node
|
|
221
221
|
req.socket.remoteAddress
|
|
222
222
|
|
|
223
223
|
winston.info("standard ip: "+ipStandard); // ip address of the user
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
const parseIp = (req) =>
|
|
228
|
+
req.headers['x-forwarded-for']?.split(',').shift()
|
|
229
|
+
|| req.socket?.remoteAddress
|
|
230
|
+
|
|
231
|
+
winston.info("parseIp: "+parseIp); // ip address of the user
|
|
232
|
+
|
|
233
|
+
res.json( {ip:ip, ipStandard:ipStandard, parseIp: parseIp} );
|
|
226
234
|
|
|
227
235
|
|
|
228
236
|
});
|