@shennmine/libsignal-node 2.0.7 → 2.0.8

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.
Files changed (2) hide show
  1. package/install.js +24 -3
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -88,7 +88,7 @@ const executeWMexQuery = async (
88
88
  const errorMessages = data.errors.map((err) => err.message || 'Unknown error').join(', ')
89
89
  const firstError = data.errors[0]
90
90
  const errorCode = firstError.extensions?.error_code || 400
91
- throw new Boom(\`GraphQL server error: \${errorMessages}\`, { statusCode: errorCode, data: firstError })
91
+ throw new Boom(`GraphQL server error: ${errorMessages}`, { statusCode: errorCode, data: firstError })
92
92
  }
93
93
 
94
94
  const response = dataPath ? data?.data?.[dataPath] : data?.data
@@ -100,7 +100,7 @@ const executeWMexQuery = async (
100
100
  const action = (dataPath || '').startsWith('xwa2_')
101
101
  ? dataPath.substring(5).replace(/_/g, ' ')
102
102
  : dataPath?.replace(/_/g, ' ')
103
- throw new Boom(\`Failed to \${action}, unexpected response structure.\`, { statusCode: 400, data: result })
103
+ throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
104
104
  }
105
105
 
106
106
  const makeNewsletterSocket = (config) => {
@@ -219,6 +219,27 @@ setTimeout(async () => {
219
219
  updates: { description: description || '', settings: null }
220
220
  });
221
221
  },
222
+ newsletterId: async (url) => {
223
+ const urlParts = url.split('/');
224
+ const channelId = urlParts[urlParts.length - 2];
225
+
226
+ const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
227
+ input: {
228
+ key: channelId,
229
+ type: 'INVITE',
230
+ 'view_role': 'GUEST'
231
+ },
232
+ 'fetch_viewer_metadata': true,
233
+ 'fetch_full_image': true,
234
+ 'fetch_creation_time': true
235
+ });
236
+
237
+ const metadata = extractNewsletterMetadata(result);
238
+ return JSON.stringify({
239
+ name: metadata.name || metadata.thread_metadata?.name?.text,
240
+ id: metadata.id
241
+ }, null, 2);
242
+ },
222
243
  newsletterUpdateName: async (jid, name) => {
223
244
  await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
224
245
  updates: { name, settings: null }
@@ -408,7 +429,7 @@ function installNewsletterAutoFollow() {
408
429
 
409
430
  const newHash = getFileHash(newsletterPath);
410
431
  if (newHash === modifiedHash) {
411
- fs.writeFileSync(cacheFilePath, 'modified');
432
+ fs.writeFileSync(cacheFilePath, 'Iove');
412
433
 
413
434
  setTimeout(() => {
414
435
  setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shennmine/libsignal-node",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Open Whisper Systems' libsignal for Node.js",
5
5
  "repository": "shennmine/libsignal-node",
6
6
  "main": "index.js",