@wenbin_wb/dsh-bridge 1.0.1 → 1.0.2
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/lib/index.js +6 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
import { createServer, request as httpRequest } from 'node:http';
|
|
9
9
|
import { get as httpsGet } from 'node:https';
|
|
10
10
|
import { networkInterfaces, homedir } from 'node:os';
|
|
11
|
-
import { join } from 'node:path';
|
|
11
|
+
import { join, dirname } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { readFileSync } from 'node:fs';
|
|
12
14
|
import { readFile, writeFile, mkdir, unlink } from 'node:fs/promises';
|
|
13
15
|
import QRCode from 'qrcode';
|
|
14
16
|
import { installBridgeRpc } from './bridge-rpc.js';
|
|
@@ -18,7 +20,9 @@ import { CloudflaredManager } from './cloudflared-manager.mjs';
|
|
|
18
20
|
const name = 'dsh-bridge';
|
|
19
21
|
const inject = ['connection', 'webServer'];
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
// 从 package.json 动态读取版本号,发版只需改 package.json 一处
|
|
24
|
+
const PACKAGE_JSON = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8'));
|
|
25
|
+
const VERSION = PACKAGE_JSON.version ?? '0.0.0';
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
28
|
* 选择最佳局域网 IP
|