@fangyb/ahchat-bridge 0.1.17 → 0.1.18
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/dist/cli.cjs +20 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -52059,6 +52059,25 @@ function isProtocolRegistered() {
|
|
|
52059
52059
|
|
|
52060
52060
|
// src/cli.ts
|
|
52061
52061
|
var logger30 = createModuleLogger("bridge");
|
|
52062
|
+
function resolveDataDir(dataDir) {
|
|
52063
|
+
const userHome = process.env.USERPROFILE || import_node_os13.default.homedir();
|
|
52064
|
+
if (/^~[/\\]/.test(dataDir)) {
|
|
52065
|
+
return import_node_path21.default.join(import_node_os13.default.homedir(), dataDir.slice(2));
|
|
52066
|
+
}
|
|
52067
|
+
if (dataDir === "$env:USERPROFILE") {
|
|
52068
|
+
return userHome;
|
|
52069
|
+
}
|
|
52070
|
+
if (dataDir.startsWith("$env:USERPROFILE\\") || dataDir.startsWith("$env:USERPROFILE/")) {
|
|
52071
|
+
return import_node_path21.default.join(userHome, dataDir.slice("$env:USERPROFILE".length + 1));
|
|
52072
|
+
}
|
|
52073
|
+
if (dataDir === "%USERPROFILE%") {
|
|
52074
|
+
return userHome;
|
|
52075
|
+
}
|
|
52076
|
+
if (dataDir.startsWith("%USERPROFILE%\\") || dataDir.startsWith("%USERPROFILE%/")) {
|
|
52077
|
+
return import_node_path21.default.join(userHome, dataDir.slice("%USERPROFILE%".length + 1));
|
|
52078
|
+
}
|
|
52079
|
+
return dataDir;
|
|
52080
|
+
}
|
|
52062
52081
|
function parseAhchatUrl(url2) {
|
|
52063
52082
|
try {
|
|
52064
52083
|
if (!url2.startsWith("ahchat://")) return null;
|
|
@@ -52085,7 +52104,7 @@ async function run(args) {
|
|
|
52085
52104
|
}
|
|
52086
52105
|
if (args.token) config2 = { ...config2, bridgeToken: args.token };
|
|
52087
52106
|
if (args.dataDir) {
|
|
52088
|
-
const resolved =
|
|
52107
|
+
const resolved = resolveDataDir(args.dataDir);
|
|
52089
52108
|
config2 = { ...config2, dataDir: resolved };
|
|
52090
52109
|
}
|
|
52091
52110
|
if (args.logLevel) config2 = { ...config2, logLevel: args.logLevel };
|