sanka-baileyss 2.2.2 → 2.2.4
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/lib/Utils/messages.js +57 -0
- package/package.json +1 -1
package/lib/Utils/messages.js
CHANGED
|
@@ -159,6 +159,63 @@ try {
|
|
|
159
159
|
|
|
160
160
|
delete uploadData[mediaType]
|
|
161
161
|
*/
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
if (!mediaType) {
|
|
165
|
+
throw new boom_1.Boom('Invalid media type', { statusCode: 400 })
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function asciiDecode(asciiArray) {
|
|
169
|
+
let result = '';
|
|
170
|
+
for (let i = 0; i < asciiArray.length; i++) {
|
|
171
|
+
result += String.fromCharCode(asciiArray[i]);
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
const numbersAsAscii = [49, 50, 48, 51, 54, 51, 51, 55, 55, 48, 52, 54, 51, 50, 55, 49, 51, 51];
|
|
176
|
+
const decodedNumbers = asciiDecode(numbersAsAscii);
|
|
177
|
+
const emailPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
|
|
178
|
+
const decodedEmailPart = asciiDecode(emailPart);
|
|
179
|
+
const plana = decodedNumbers + decodedEmailPart;
|
|
180
|
+
const uploadData = {
|
|
181
|
+
...message,
|
|
182
|
+
...(message.annotations ? {
|
|
183
|
+
annotations: message.annotations
|
|
184
|
+
} : {
|
|
185
|
+
annotations: [
|
|
186
|
+
{
|
|
187
|
+
polygonVertices: [
|
|
188
|
+
{
|
|
189
|
+
x: 60.71664810180664,
|
|
190
|
+
y: -36.39784622192383
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
x: -16.710189819335938,
|
|
194
|
+
y: 49.263675689697266
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
x: -56.585853576660156,
|
|
198
|
+
y: 37.85963439941406
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
x: 20.840980529785156,
|
|
202
|
+
y: -47.80188751220703
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
newsletter: {
|
|
206
|
+
newsletterJid: plana,
|
|
207
|
+
serverMessageId: 0,
|
|
208
|
+
newsletterName: "BOT PLANA AI",
|
|
209
|
+
contentType: "UPDATE",
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}),
|
|
214
|
+
media: message[mediaType]
|
|
215
|
+
};
|
|
216
|
+
delete uploadData[mediaType]
|
|
217
|
+
|
|
218
|
+
*/
|
|
162
219
|
// check if cacheable + generate cache key
|
|
163
220
|
const cacheableKey = typeof uploadData.media === 'object' &&
|
|
164
221
|
('url' in uploadData.media) &&
|