roxify 1.9.4 → 1.9.5

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/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "roxify_native"
3
- version = "1.9.4"
3
+ version = "1.9.5"
4
4
  edition = "2021"
5
5
  publish = false
6
6
 
@@ -126,6 +126,13 @@ export async function listFilesInPng(pngBuf, opts = {}) {
126
126
  }
127
127
  }
128
128
  catch (e) { }
129
+ try {
130
+ const json = native.extractFileListFromPixels(pngBuf);
131
+ if (json) {
132
+ return parseFileList(JSON.parse(json));
133
+ }
134
+ }
135
+ catch (e) { }
129
136
  return null;
130
137
  }
131
138
  export async function hasPassphraseInPng(pngBuf) {
package/native/lib.rs CHANGED
@@ -389,6 +389,13 @@ pub fn crop_and_reconstitute(png_buffer: Buffer) -> Result<Vec<u8>> {
389
389
  .map_err(|e| Error::from_reason(e))
390
390
  }
391
391
 
392
+ #[cfg(not(test))]
393
+ #[napi]
394
+ pub fn extract_file_list_from_pixels(png_buffer: Buffer) -> Result<String> {
395
+ png_utils::extract_file_list_from_pixels(&png_buffer)
396
+ .map_err(|e| Error::from_reason(e))
397
+ }
398
+
392
399
  // ─── WAV container NAPI exports ──────────────────────────────────────────────
393
400
 
394
401
  #[cfg(not(test))]
@@ -184,8 +184,13 @@ pub fn extract_name_from_png(png_data: &[u8]) -> Option<String> {
184
184
  if let Some(name) = extract_name_direct(png_data) {
185
185
  return Some(name);
186
186
  }
187
- let reconst = crate::reconstitution::crop_and_reconstitute(png_data).ok()?;
188
- extract_name_direct(&reconst)
187
+ if let Ok(reconst) = crate::reconstitution::crop_and_reconstitute(png_data) {
188
+ if let Some(name) = extract_name_direct(&reconst) {
189
+ return Some(name);
190
+ }
191
+ }
192
+ let unstretched = crate::reconstitution::unstretch_nn(png_data).ok()?;
193
+ extract_name_direct(&unstretched)
189
194
  }
190
195
 
191
196
  fn extract_name_direct(png_data: &[u8]) -> Option<String> {
@@ -224,8 +229,13 @@ pub fn extract_file_list_from_pixels(png_data: &[u8]) -> Result<String, String>
224
229
  if let Ok(result) = extract_file_list_direct(png_data) {
225
230
  return Ok(result);
226
231
  }
227
- let reconst = crate::reconstitution::crop_and_reconstitute(png_data)?;
228
- extract_file_list_direct(&reconst)
232
+ if let Ok(reconst) = crate::reconstitution::crop_and_reconstitute(png_data) {
233
+ if let Ok(result) = extract_file_list_direct(&reconst) {
234
+ return Ok(result);
235
+ }
236
+ }
237
+ let unstretched = crate::reconstitution::unstretch_nn(png_data)?;
238
+ extract_file_list_direct(&unstretched)
229
239
  }
230
240
 
231
241
  fn extract_file_list_direct(png_data: &[u8]) -> Result<String, String> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roxify",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "type": "module",
5
5
  "description": "Ultra-lightweight PNG steganography with native Rust acceleration. Encode binary data into PNG images with zstd compression.",
6
6
  "main": "dist/index.js",