roxify 1.8.0 → 1.8.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.8.0"
3
+ version = "1.8.1"
4
4
  edition = "2021"
5
5
  publish = false
6
6
 
Binary file
package/native/archive.rs CHANGED
@@ -157,7 +157,7 @@ mod tests {
157
157
  encoder.write_all(&tar_data).unwrap();
158
158
  let compressed = encoder.finish().unwrap();
159
159
 
160
- let decompressed = zstd::stream::decode_all(std::io::Cursor::new(&compressed)).unwrap();
160
+ let decompressed = crate::core::zstd_decompress_bytes(&compressed, None).unwrap();
161
161
  assert!(is_tar(&decompressed));
162
162
 
163
163
  let out = std::env::temp_dir().join("rox_tar_zstd_test_out");
package/native/core.rs CHANGED
@@ -206,15 +206,19 @@ pub fn zstd_compress_bytes(buf: &[u8], level: i32, dict: Option<&[u8]>) -> std::
206
206
 
207
207
  pub fn zstd_decompress_bytes(buf: &[u8], dict: Option<&[u8]>) -> std::result::Result<Vec<u8>, String> {
208
208
  use std::io::Read;
209
+ let mut out = Vec::new();
209
210
  if let Some(d) = dict {
210
211
  let mut decoder = zstd::stream::Decoder::with_dictionary(std::io::Cursor::new(buf), d)
211
212
  .map_err(|e| format!("zstd decoder init error: {}", e))?;
212
- let mut out = Vec::new();
213
+ decoder.window_log_max(31).map_err(|e| format!("zstd window_log_max error: {}", e))?;
213
214
  decoder.read_to_end(&mut out).map_err(|e| format!("zstd decompress error: {}", e))?;
214
- Ok(out)
215
215
  } else {
216
- zstd::stream::decode_all(buf).map_err(|e| format!("zstd decompress error: {}", e))
216
+ let mut decoder = zstd::stream::Decoder::new(std::io::Cursor::new(buf))
217
+ .map_err(|e| format!("zstd decoder init error: {}", e))?;
218
+ decoder.window_log_max(31).map_err(|e| format!("zstd window_log_max error: {}", e))?;
219
+ decoder.read_to_end(&mut out).map_err(|e| format!("zstd decompress error: {}", e))?;
217
220
  }
221
+ Ok(out)
218
222
  }
219
223
 
220
224
 
package/native/main.rs CHANGED
@@ -338,7 +338,8 @@ fn main() -> anyhow::Result<()> {
338
338
  let mut reader: Box<dyn std::io::Read> = if normalized.starts_with(b"ROX1") {
339
339
  Box::new(Cursor::new(normalized[4..].to_vec()))
340
340
  } else {
341
- let dec = zstd::stream::Decoder::new(Cursor::new(normalized)).map_err(|e| anyhow::anyhow!("zstd decoder init: {}", e))?;
341
+ let mut dec = zstd::stream::Decoder::new(Cursor::new(normalized)).map_err(|e| anyhow::anyhow!("zstd decoder init: {}", e))?;
342
+ dec.window_log_max(31).map_err(|e| anyhow::anyhow!("zstd window_log_max: {}", e))?;
342
343
  Box::new(dec)
343
344
  };
344
345
 
package/native/packer.rs CHANGED
@@ -376,6 +376,7 @@ mod stream_tests {
376
376
  let compressed = encoder.finish().map_err(|e| anyhow::anyhow!(e))?;
377
377
 
378
378
  let mut dec = zstd::stream::Decoder::new(std::io::Cursor::new(compressed.clone())).map_err(|e| anyhow::anyhow!(e))?;
379
+ dec.window_log_max(31).map_err(|e| anyhow::anyhow!(e))?;
379
380
 
380
381
  let mut all = Vec::new();
381
382
  dec.read_to_end(&mut all).map_err(|e| anyhow::anyhow!(e))?;
@@ -383,6 +384,7 @@ mod stream_tests {
383
384
  assert_eq!(&all[..], &parts[..]);
384
385
 
385
386
  let mut dec2 = zstd::stream::Decoder::new(std::io::Cursor::new(compressed)).map_err(|e| anyhow::anyhow!(e))?;
387
+ dec2.window_log_max(31).map_err(|e| anyhow::anyhow!(e))?;
386
388
 
387
389
  let ms = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis();
388
390
  let tmpdir = std::env::temp_dir().join(format!("rox_unpack_test_{}", ms));
@@ -424,6 +426,7 @@ mod stream_tests {
424
426
  assert_eq!(first, 0x00u8);
425
427
  let compressed = payload[1..].to_vec();
426
428
  let mut dec = zstd::stream::Decoder::new(std::io::Cursor::new(compressed)).map_err(|e| anyhow::anyhow!(e))?;
429
+ dec.window_log_max(31).map_err(|e| anyhow::anyhow!(e))?;
427
430
 
428
431
  let ms = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis();
429
432
  let tmpdir = std::env::temp_dir().join(format!("rox_unpack_png_test_{}", ms));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roxify",
3
- "version": "1.8.0",
3
+ "version": "1.8.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",
@@ -6,96 +6,96 @@ const root = join(__dirname, '..');
6
6
  const distDir = join(root, 'dist');
7
7
 
8
8
  function hasCargo() {
9
- try {
10
- execSync('cargo --version', { stdio: 'ignore', timeout: 5000 });
11
- return true;
12
- } catch { return false; }
9
+ try {
10
+ execSync('cargo --version', { stdio: 'ignore', timeout: 5000 });
11
+ return true;
12
+ } catch { return false; }
13
13
  }
14
14
 
15
15
  function getBinaryName() {
16
- return process.platform === 'win32' ? 'roxify_native.exe' : 'roxify_native';
16
+ return process.platform === 'win32' ? 'roxify_native.exe' : 'roxify_native';
17
17
  }
18
18
 
19
19
  function findExistingBinary() {
20
- const name = getBinaryName();
21
- const candidates = [
22
- join(distDir, name),
23
- join(root, 'target', 'release', name),
24
- ];
20
+ const name = getBinaryName();
21
+ const candidates = [
22
+ join(distDir, name),
23
+ join(root, 'target', 'release', name),
24
+ ];
25
25
 
26
- if (process.platform === 'win32') {
27
- candidates.push(join(root, 'target', 'x86_64-pc-windows-gnu', 'release', name));
28
- candidates.push(join(root, 'target', 'x86_64-pc-windows-msvc', 'release', name));
29
- } else if (process.platform === 'linux') {
30
- candidates.push(join(root, 'target', 'x86_64-unknown-linux-gnu', 'release', name));
31
- } else if (process.platform === 'darwin') {
32
- candidates.push(join(root, 'target', 'x86_64-apple-darwin', 'release', name));
33
- candidates.push(join(root, 'target', 'aarch64-apple-darwin', 'release', name));
34
- }
26
+ if (process.platform === 'win32') {
27
+ candidates.push(join(root, 'target', 'x86_64-pc-windows-gnu', 'release', name));
28
+ candidates.push(join(root, 'target', 'x86_64-pc-windows-msvc', 'release', name));
29
+ } else if (process.platform === 'linux') {
30
+ candidates.push(join(root, 'target', 'x86_64-unknown-linux-gnu', 'release', name));
31
+ } else if (process.platform === 'darwin') {
32
+ candidates.push(join(root, 'target', 'x86_64-apple-darwin', 'release', name));
33
+ candidates.push(join(root, 'target', 'aarch64-apple-darwin', 'release', name));
34
+ }
35
35
 
36
- for (const c of candidates) {
37
- if (existsSync(c)) return c;
38
- }
39
- return null;
36
+ for (const c of candidates) {
37
+ if (existsSync(c)) return c;
38
+ }
39
+ return null;
40
40
  }
41
41
 
42
42
  function buildBinary() {
43
- if (!hasCargo()) {
44
- console.log('roxify: Cargo not found, skipping native binary build (TypeScript fallback will be used)');
45
- return false;
46
- }
43
+ if (!hasCargo()) {
44
+ console.log('roxify: Cargo not found, skipping native binary build (TypeScript fallback will be used)');
45
+ return false;
46
+ }
47
47
 
48
- console.log('roxify: Building native CLI binary with Cargo...');
49
- try {
50
- execSync('cargo build --release --bin roxify_native', {
51
- cwd: root,
52
- stdio: 'inherit',
53
- timeout: 600000,
54
- });
55
- return true;
56
- } catch (e) {
57
- console.log('roxify: Native build failed, TypeScript fallback will be used');
58
- return false;
59
- }
48
+ console.log('roxify: Building native CLI binary with Cargo...');
49
+ try {
50
+ execSync('cargo build --release --bin roxify_native', {
51
+ cwd: root,
52
+ stdio: 'inherit',
53
+ timeout: 600000,
54
+ });
55
+ return true;
56
+ } catch (e) {
57
+ console.log('roxify: Native build failed, TypeScript fallback will be used');
58
+ return false;
59
+ }
60
60
  }
61
61
 
62
62
  function run() {
63
- if (!existsSync(distDir)) {
64
- mkdirSync(distDir, { recursive: true });
65
- }
63
+ if (!existsSync(distDir)) {
64
+ mkdirSync(distDir, { recursive: true });
65
+ }
66
66
 
67
- const dest = join(distDir, getBinaryName());
68
- if (existsSync(dest)) {
69
- return;
70
- }
67
+ const dest = join(distDir, getBinaryName());
68
+ if (existsSync(dest)) {
69
+ return;
70
+ }
71
71
 
72
- const existing = findExistingBinary();
73
- if (existing && existing !== dest) {
74
- copyFileSync(existing, dest);
75
- if (process.platform !== 'win32') {
76
- try { require('fs').chmodSync(dest, 0o755); } catch {}
77
- }
78
- console.log(`roxify: Copied native binary from ${existing}`);
79
- return;
80
- }
72
+ const existing = findExistingBinary();
73
+ if (existing && existing !== dest) {
74
+ copyFileSync(existing, dest);
75
+ if (process.platform !== 'win32') {
76
+ try { require('fs').chmodSync(dest, 0o755); } catch { }
77
+ }
78
+ console.log(`roxify: Copied native binary from ${existing}`);
79
+ return;
80
+ }
81
81
 
82
- if (existing) return;
82
+ if (existing) return;
83
83
 
84
- if (process.env.ROXIFY_SKIP_BUILD === '1') {
85
- console.log('roxify: ROXIFY_SKIP_BUILD=1, skipping native build');
86
- return;
87
- }
84
+ if (process.env.ROXIFY_SKIP_BUILD === '1') {
85
+ console.log('roxify: ROXIFY_SKIP_BUILD=1, skipping native build');
86
+ return;
87
+ }
88
88
 
89
- if (buildBinary()) {
90
- const built = join(root, 'target', 'release', getBinaryName());
91
- if (existsSync(built)) {
92
- copyFileSync(built, dest);
93
- if (process.platform !== 'win32') {
94
- try { require('fs').chmodSync(dest, 0o755); } catch {}
89
+ if (buildBinary()) {
90
+ const built = join(root, 'target', 'release', getBinaryName());
91
+ if (existsSync(built)) {
92
+ copyFileSync(built, dest);
93
+ if (process.platform !== 'win32') {
94
+ try { require('fs').chmodSync(dest, 0o755); } catch { }
95
+ }
96
+ console.log('roxify: Native binary built and copied to dist/');
97
+ }
95
98
  }
96
- console.log('roxify: Native binary built and copied to dist/');
97
- }
98
- }
99
99
  }
100
100
 
101
101
  run();