magnetk 2.2.3 → 2.2.4
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/client.js +13 -5
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -209,7 +209,9 @@ export class MagnetkClient extends EventEmitter {
|
|
|
209
209
|
console.warn(`[Magnetk-JS] Failed to fetch relay identity: ${e.message}. Using default/configured address might fail if Peer ID is missing.`);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
const
|
|
212
|
+
const isWin = process.platform === 'win32';
|
|
213
|
+
const binName = isWin ? 'seed.exe' : 'seed';
|
|
214
|
+
const binPath = this._resolveBinPath(binName);
|
|
213
215
|
const configPath = this._resolveConfigPath();
|
|
214
216
|
|
|
215
217
|
// Construct full multiaddr if we have the Peer ID
|
|
@@ -408,12 +410,17 @@ export class MagnetkClient extends EventEmitter {
|
|
|
408
410
|
}
|
|
409
411
|
|
|
410
412
|
_resolveBinPath(binName) {
|
|
413
|
+
const isWin = process.platform === 'win32';
|
|
414
|
+
const isSeeder = binName.includes('seed');
|
|
415
|
+
|
|
411
416
|
// 1. Check explicit config
|
|
412
|
-
if (this.config.seederPath
|
|
417
|
+
if (isSeeder && this.config.seederPath) return this.config.seederPath;
|
|
413
418
|
|
|
414
419
|
// 2. Check environment variable
|
|
415
|
-
const
|
|
416
|
-
if (
|
|
420
|
+
const envVar = isSeeder ? 'MAGNETK_SEEDER_PATH' : null;
|
|
421
|
+
if (envVar && process.env[envVar] && fs.existsSync(process.env[envVar])) {
|
|
422
|
+
return process.env[envVar];
|
|
423
|
+
}
|
|
417
424
|
|
|
418
425
|
// 3. Check local dev environment paths
|
|
419
426
|
const paths = [
|
|
@@ -425,7 +432,8 @@ export class MagnetkClient extends EventEmitter {
|
|
|
425
432
|
for (const p of paths) {
|
|
426
433
|
if (fs.existsSync(p)) return p;
|
|
427
434
|
}
|
|
428
|
-
|
|
435
|
+
|
|
436
|
+
return binName; // Fallback to PATH (e.g. "seed" or "seed.exe")
|
|
429
437
|
}
|
|
430
438
|
|
|
431
439
|
_resolveConfigPath() {
|