roxify 1.9.0 → 1.9.1

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.0"
3
+ version = "1.9.1"
4
4
  edition = "2021"
5
5
  publish = false
6
6
 
@@ -69,18 +69,11 @@ function getNativeModule() {
69
69
  // --- 1. Platform-specific candidates (checked FIRST) ---
70
70
  // These are the ONLY safe candidates — they match the current OS+arch.
71
71
  const candidates = [];
72
+ candidates.push(resolve(root, 'roxify_native.node'), resolve(moduleDir, '..', 'roxify_native.node'));
72
73
  for (const triple of triples) {
73
74
  const name = `roxify_native-${triple}.node`;
74
75
  const libName = `libroxify_native-${triple}.node`;
75
- candidates.push(
76
- // dist/ sibling (npm-installed package)
77
- resolve(moduleDir, '..', name), resolve(moduleDir, '..', libName),
78
- // package root
79
- resolve(root, name), resolve(root, libName),
80
- // node_modules/roxify/
81
- resolve(root, 'node_modules', 'roxify', name), resolve(root, 'node_modules', 'roxify', libName),
82
- // two levels up (global npm install)
83
- resolve(moduleDir, '..', '..', name), resolve(moduleDir, '..', '..', libName));
76
+ candidates.push(resolve(moduleDir, '..', name), resolve(moduleDir, '..', libName), resolve(root, name), resolve(root, libName), resolve(root, 'node_modules', 'roxify', name), resolve(root, 'node_modules', 'roxify', libName), resolve(moduleDir, '..', '..', name), resolve(moduleDir, '..', '..', libName));
84
77
  }
85
78
  // --- 2. Build output candidates (local dev) ---
86
79
  for (const triple of triples) {
@@ -160,6 +160,14 @@ fn decode_to_rgb(png_data: &[u8]) -> Result<Vec<u8>, String> {
160
160
  }
161
161
 
162
162
  pub fn extract_name_from_png(png_data: &[u8]) -> Option<String> {
163
+ if let Some(name) = extract_name_direct(png_data) {
164
+ return Some(name);
165
+ }
166
+ let reconst = crate::reconstitution::crop_and_reconstitute(png_data).ok()?;
167
+ extract_name_direct(&reconst)
168
+ }
169
+
170
+ fn extract_name_direct(png_data: &[u8]) -> Option<String> {
163
171
  let raw = decode_to_rgb(png_data).ok()?;
164
172
  let pos = find_pixel_header(&raw).ok()?;
165
173
  let mut idx = pos + 4;
@@ -192,13 +200,15 @@ fn extract_payload_direct(png_data: &[u8]) -> Result<Vec<u8>, String> {
192
200
  }
193
201
 
194
202
  pub fn extract_file_list_from_pixels(png_data: &[u8]) -> Result<String, String> {
195
- let raw = match decode_to_rgb(png_data) {
196
- Ok(r) => r,
197
- Err(_) => {
198
- let reconst = crate::reconstitution::crop_and_reconstitute(png_data)?;
199
- decode_to_rgb(&reconst)?
200
- }
201
- };
203
+ if let Ok(result) = extract_file_list_direct(png_data) {
204
+ return Ok(result);
205
+ }
206
+ let reconst = crate::reconstitution::crop_and_reconstitute(png_data)?;
207
+ extract_file_list_direct(&reconst)
208
+ }
209
+
210
+ fn extract_file_list_direct(png_data: &[u8]) -> Result<String, String> {
211
+ let raw = decode_to_rgb(png_data)?;
202
212
  let pos = find_pixel_header(&raw)?;
203
213
  let mut idx = pos + 4;
204
214
  if idx + 2 > raw.len() { return Err("Truncated header".to_string()); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roxify",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
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",