@dns-data/remote 0.2.5 → 0.2.7

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/README.md CHANGED
@@ -9,8 +9,28 @@ It neither installs a system autostart entry nor connects to the former RC5 stag
9
9
  Version 0.2.5 official release. Windows and Apple Silicon builds compiled on X99.
10
10
 
11
11
  After approved macOS pairing and desktop launcher creation, DNS-DATA removes the verified obsolete stable and RC5 Pair Bridge apps from the current user's Applications folder. Existing bound Macs clean them after successful account and hardware validation. Future re-pairing runs through the same official npx launcher; device credentials and Runtime are retained.
12
-
13
- Version 0.2.4: Local launcher reports confirmed monthly Free quota exhaustion and offers the official DNS-DATA Android app on Google Play. The server still authorizes and enforces all account and tool permissions.
12
+
13
+ Version 0.2.4: Local launcher reports confirmed monthly Free quota exhaustion and offers the official DNS-DATA Android app on Google Play. The server still authorizes and enforces all account and tool permissions.
14
14
 
15
15
 
16
16
  Version 0.2.5: bounded retries for transient control network failures, longer policy and WebSocket handshake timeouts, and corrected response-body cancellation. Authoritative device/account denials are not overridden. Hardware and entitlement verification remain mandatory on every start and reconnect.
17
+
18
+ Version 0.2.6 official release: macOS users continue starting with
19
+ npx -y @dns-data/remote@latest; the same native Agent now includes LAN Direct
20
+ v3 from the Windows implementation. The launcher installs this verified Agent
21
+ under ~/Library/Application Support/DNS-DATA/Remote-Agent/ so ordinary npm
22
+ cache rotation does not change its executable path. Initial macOS / third-party
23
+ firewall approval may be needed. The system firewall and code-signing policies
24
+ remain in force; this package does not disable or bypass them. The Agent
25
+ performs authorized full-file direct LAN copies over TLS 1.3 and TCP 443
26
+ without an intermediate server handling file bytes. Desktop and Documents
27
+ folder access is still subject to macOS file privacy authorization.
28
+
29
+ Version 0.2.7 candidate (not published): Running npx -y @dns-data/remote@latest
30
+ now creates or repairs a single DNS-DATA desktop launcher automatically for
31
+ Windows x64 (DNS-DATA.cmd) and macOS Apple Silicon (DNS-DATA.command).
32
+ Normal startup works for both newly enrolled and already-bound devices.
33
+ The desktop shortcut always executes npm @latest, not a fixed local binary.
34
+ Repeated runs do not duplicate it; unrelated user files and symlinks are
35
+ not replaced. Failure to write the Desktop does not prevent service startup.
36
+ No extra Mac app, SSH, SMB, file relay or changes to account entitlements.
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
6
+ const crypto = require('crypto');
7
+ const {execFileSync} = require('child_process');
8
+
9
+ // The desktop shortcut is user-facing; the native Agent and the actual
10
+ // service always run from the npm package, never a second installed app.
11
+ const CONTENT = Object.freeze({
12
+ darwin: '#!/bin/zsh\n' +
13
+ 'cd "$HOME"\n' +
14
+ 'export PATH="$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$PATH"\n' +
15
+ 'exec npx -y @dns-data/remote@latest\n',
16
+ win32: '@echo off\r\n' +
17
+ 'cd /d "%USERPROFILE%"\r\n' +
18
+ 'npx -y @dns-data/remote@latest\r\n' +
19
+ 'if errorlevel 1 pause\r\n'
20
+ });
21
+
22
+ function windowsDesktop(home) {
23
+ // Supports OneDrive, redirected and non-English Windows desktop locations.
24
+ try {
25
+ const resolved = execFileSync('powershell.exe', [
26
+ '-NoLogo', '-NoProfile', '-NonInteractive', '-Command',
27
+ '[Environment]::GetFolderPath("Desktop")'
28
+ ], {encoding:'utf8', timeout:6000, windowsHide:true, stdio:['ignore','pipe','ignore']}).trim();
29
+ if (resolved && fs.existsSync(resolved) && fs.statSync(resolved).isDirectory()) {
30
+ return resolved;
31
+ }
32
+ } catch (_) {}
33
+ const options = [
34
+ process.env.OneDrive ? path.join(process.env.OneDrive, 'Desktop') : '',
35
+ process.env.OneDriveCommercial ? path.join(process.env.OneDriveCommercial, 'Desktop') : '',
36
+ path.join(home, 'Desktop')
37
+ ];
38
+ return options.find(x => x && fs.existsSync(x) && fs.statSync(x).isDirectory()) ||
39
+ path.join(home,'Desktop');
40
+ }
41
+
42
+ // No overwrite of arbitrary user scripts, folders or symlinks.
43
+ function recognizedOldLauncher(text) {
44
+ return text.includes('@dns-data/remote') ||
45
+ (text.includes('DNS-DATA') && text.includes('dns-data.js'));
46
+ }
47
+
48
+ function ensureDesktopShortcut({platform=process.platform, desktop=null, home=os.homedir()}={}) {
49
+ if (!Object.hasOwn(CONTENT,platform)) {
50
+ throw Error('Unsupported desktop shortcut platform');
51
+ }
52
+ const dir = desktop || (platform==='win32' ? windowsDesktop(home) : path.join(home,'Desktop'));
53
+ const dirInfo=fs.statSync(dir);
54
+ if (!dirInfo.isDirectory()) throw Error('Desktop directory is not a folder');
55
+ const name=platform==='darwin' ? 'DNS-DATA.command' : 'DNS-DATA.cmd';
56
+ const filename=path.join(dir,name);
57
+ const expected=CONTENT[platform];
58
+ let oldText=null;
59
+ try {
60
+ const st=fs.lstatSync(filename);
61
+ if (!st.isFile() || st.isSymbolicLink()) {
62
+ throw Error('Desktop shortcut path is not a regular file');
63
+ }
64
+ oldText=fs.readFileSync(filename,'utf8');
65
+ if (oldText===expected) {
66
+ if (platform==='darwin' && (st.mode & 0o111)===0) fs.chmodSync(filename,0o755);
67
+ return {path:filename, changed:false};
68
+ }
69
+ if (!recognizedOldLauncher(oldText)) {
70
+ throw Error('Existing desktop script is not a DNS-DATA launcher; preserved');
71
+ }
72
+ } catch (e) {
73
+ if (e.code!=='ENOENT') throw e;
74
+ }
75
+ const tmp=path.join(dir,'.dns-data-shortcut-'+process.pid+'-'+crypto.randomBytes(8).toString('hex'));
76
+ try {
77
+ const fd=fs.openSync(tmp,'wx',0o600);
78
+ try {
79
+ fs.writeFileSync(fd,expected,'utf8');
80
+ fs.fsyncSync(fd);
81
+ } finally { fs.closeSync(fd); }
82
+ fs.chmodSync(tmp,platform==='darwin' ? 0o755 : 0o644);
83
+ fs.renameSync(tmp,filename);
84
+ } finally {
85
+ try { fs.unlinkSync(tmp); } catch (e) { if(e.code!=='ENOENT') throw e; }
86
+ }
87
+ return {path:filename, changed:true};
88
+ }
89
+
90
+ module.exports={ensureDesktopShortcut};
package/bin/dns-data.js CHANGED
@@ -3,13 +3,14 @@
3
3
  const fs=require('fs');
4
4
  const path=require('path');
5
5
  const crypto=require('crypto');
6
+ const os=require('os');
6
7
  const {spawn}=require('child_process');
7
8
 
8
9
  const id=process.platform+'-'+process.arch;
9
10
  const binaries={'win32-x64':'windows-x64.exe','darwin-arm64':'macos-arm64'};
10
11
  const expected={
11
- 'windows-x64.exe':'82a7db47ed0cf3df299e6872916b4aa49446d07aad877ddf8f71ceb0a9dc3686',
12
- 'macos-arm64':'33fedfdebddf32d9901742b7c80348a50a99058145e4134fb4c7e09cb87d6c9c'
12
+ 'windows-x64.exe':'6883b48b75a2c6ee313e9e6868619fd56fb74007e3c0db62df1fd7948648c613',
13
+ 'macos-arm64':'f0674c40615084531a4ac671a27b05f82be9cdcae5232ff47dade8c8d76e6c82'
13
14
  };
14
15
  const nativeName=binaries[id];
15
16
  if(!nativeName){console.error('[ERROR] DNS-DATA supports Windows x64 and macOS arm64.');process.exit(2);}
@@ -19,18 +20,78 @@ try{
19
20
  if(hash.toLowerCase()!==expected[nativeName].toLowerCase()) throw Error('native binary integrity mismatch');
20
21
  if(process.platform==='darwin') fs.chmodSync(binary,0o755);
21
22
  }catch(e){console.error('[ERROR] DNS-DATA integrity: '+e.message);process.exit(3);}
23
+
24
+ // macOS uses a persistent, per-user Agent path. The executable and its
25
+ // associated network identity no longer change when npx rotates cache paths.
26
+ // All copies are verified against the package's embedded SHA-256. No root,
27
+ // SMB share, SSH daemon, or second macOS application is required.
28
+ let runtimeBinary=binary;
29
+ if(process.platform==='darwin'){
30
+ const stableDir=path.join(os.homedir(),'Library','Application Support',
31
+ 'DNS-DATA','Remote-Agent');
32
+ const stableBinary=path.join(stableDir,'dns-data-agent-macos-arm64');
33
+ const digest=(p)=>crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');
34
+ try {
35
+ fs.mkdirSync(stableDir,{recursive:true,mode:0o700});
36
+ const dirInfo=fs.lstatSync(stableDir);
37
+ if(!dirInfo.isDirectory()||dirInfo.isSymbolicLink())
38
+ throw Error('unsafe native agent directory');
39
+ fs.chmodSync(stableDir,0o700);
40
+ let current=false;
41
+ try{
42
+ const st=fs.lstatSync(stableBinary);
43
+ if(!st.isFile()||st.isSymbolicLink())throw Error('unsafe native agent path');
44
+ current=digest(stableBinary)===expected[nativeName];
45
+ }catch(e){if(e.code!=='ENOENT')throw e;}
46
+ if(!current){
47
+ const temp=path.join(stableDir,'.dns-data-agent-'+process.pid+
48
+ '-'+crypto.randomBytes(8).toString('hex')+'.tmp');
49
+ try{
50
+ fs.copyFileSync(binary,temp,fs.constants.COPYFILE_EXCL);
51
+ fs.chmodSync(temp,0o700);
52
+ if(digest(temp)!==expected[nativeName])throw Error('staged native hash mismatch');
53
+ fs.renameSync(temp,stableBinary);
54
+ }finally{if(fs.existsSync(temp))fs.unlinkSync(temp);}
55
+ }
56
+ fs.chmodSync(stableBinary,0o700);
57
+ if(digest(stableBinary)!==expected[nativeName])
58
+ throw Error('installed native hash mismatch');
59
+ runtimeBinary=stableBinary;
60
+ }catch(e){
61
+ console.error('[ERROR] DNS-DATA macOS agent installation: '+e.message);
62
+ process.exit(4);
63
+ }
64
+ }
65
+
22
66
  const args=process.argv.slice(2);
23
67
  const safe=new Set(['--start','--pair-only','--hardware-check','--pair-probe','--policy-check']);
24
68
  const isPreview=args.length===1&&args[0]==='--flow-preview';
25
69
  if(isPreview){
26
- console.log('DNS-DATA 0.2.5: fresh motherboard/CPU/GPU + account -> native Go executor via npx');
70
+ console.log('DNS-DATA 0.2.7: fresh motherboard/CPU/GPU + account -> native Go executor via npx');
27
71
  console.log('New device: eight-digit pairing -> fresh hardware recheck -> built-in remote service (no .NET)');
28
72
  console.log('V1 pairing, V1 device startup and legacy bootstrap: disabled');
29
73
  process.exit(0);
30
74
  }
31
- if(args.length>1||args.some(a=>!safe.has(a))){console.error('[ERROR] Unknown or unsafe DNS-DATA arguments.');process.exit(2);}
75
+ const isNativeLANCopy=['win32','darwin'].includes(process.platform) &&
76
+ args.length===4 &&
77
+ ((args[0]==='--lan-copy-send' && args[2]==='--lan-copy-done') ||
78
+ (args[0]==='--lan-copy-receive' && args[2]==='--lan-copy-offer-file')) &&
79
+ [args[1],args[3]].every(p=>typeof p==='string' && p.length>0 && p.length<4096 &&
80
+ path.isAbsolute(p) && [0,10,13].every(c=>!p.includes(String.fromCharCode(c))));
81
+ if(!isNativeLANCopy && (args.length>1||args.some(a=>!safe.has(a)))){console.error('[ERROR] Unknown or unsafe DNS-DATA arguments.');process.exit(2);}
82
+ // Create or repair one desktop shortcut on every ordinary npm startup, also
83
+ // for already-bound devices. Never trigger this for diagnostic or transfer verbs.
84
+ if(args.length===0 || (args.length===1 && (args[0]==='--start' || args[0]==='--pair-only'))){
85
+ try {
86
+ const shortcut=require('./desktop-shortcut').ensureDesktopShortcut();
87
+ if(shortcut.changed) console.log('DNS-DATA desktop launcher ready: '+shortcut.path);
88
+ } catch(e) {
89
+ // Desktop/OneDrive permissions must not prevent the existing service running.
90
+ console.warn('[WARN] DNS-DATA desktop launcher: '+e.message);
91
+ }
92
+ }
32
93
  console.log('DNS-DATA Remote Connection - V2');
33
- const child=spawn(binary,args,{stdio:'inherit',shell:false,windowsHide:false,env:process.env});
94
+ const child=spawn(runtimeBinary,args,{stdio:'inherit',shell:false,windowsHide:false,env:process.env});
34
95
  let done=false;
35
96
  function finish(code){
36
97
  if(done)return;done=true;
Binary file
Binary file
package/package.json CHANGED
@@ -1,33 +1,34 @@
1
- {
2
- "name": "@dns-data/remote",
3
- "version": "0.2.5",
4
- "description": "DNS-DATA native remote device launcher 0.2.5 with bounded network verification retry",
5
- "license": "UNLICENSED",
6
- "private": false,
7
- "bin": {
8
- "dns-data": "bin/dns-data.js"
9
- },
10
- "engines": {
11
- "node": ">=18"
12
- },
13
- "os": [
14
- "win32",
15
- "darwin"
16
- ],
17
- "files": [
18
- "bin/dns-data.js",
19
- "native/windows-x64.exe",
20
- "native/macos-arm64",
21
- "README.md",
22
- "DISCLOSURE"
23
- ],
24
- "keywords": [
25
- "dns-data",
26
- "mcp",
27
- "remote",
28
- "native-launcher"
29
- ],
30
- "contentPolicy": {
31
- "class": "dual-use"
32
- }
1
+ {
2
+ "name": "@dns-data/remote",
3
+ "version": "0.2.7",
4
+ "description": "DNS-DATA native Windows and macOS launcher with automatic npm desktop shortcuts and LAN Direct v3",
5
+ "license": "UNLICENSED",
6
+ "private": false,
7
+ "bin": {
8
+ "dns-data": "bin/dns-data.js"
9
+ },
10
+ "engines": {
11
+ "node": "\u003e=18"
12
+ },
13
+ "os": [
14
+ "win32",
15
+ "darwin"
16
+ ],
17
+ "files": [
18
+ "bin/dns-data.js",
19
+ "bin/desktop-shortcut.js",
20
+ "native/windows-x64.exe",
21
+ "native/macos-arm64",
22
+ "README.md",
23
+ "DISCLOSURE"
24
+ ],
25
+ "keywords": [
26
+ "dns-data",
27
+ "mcp",
28
+ "remote",
29
+ "native-launcher"
30
+ ],
31
+ "contentPolicy": {
32
+ "class": "dual-use"
33
+ }
33
34
  }