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 +1 -1
- package/dist/utils/native.js +2 -9
- package/native/png_utils.rs +17 -7
- package/package.json +1 -1
package/Cargo.toml
CHANGED
package/dist/utils/native.js
CHANGED
|
@@ -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) {
|
package/native/png_utils.rs
CHANGED
|
@@ -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
|
|
196
|
-
Ok(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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