nextclaw 0.1.0 → 0.2.0
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/bridge/src/brand.ts +7 -0
- package/bridge/src/index.ts +4 -18
- package/bridge/src/whatsapp.ts +2 -1
- package/dist/chunk-X77K7Y4T.js +2316 -0
- package/dist/cli/index.js +40 -15
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const ENV_APP_NAME_KEY = "NEXTCLAW_APP_NAME";
|
|
2
|
+
export const ENV_HOME_KEY = "NEXTCLAW_HOME";
|
|
3
|
+
export const DEFAULT_HOME_DIR = ".nextclaw";
|
|
4
|
+
|
|
5
|
+
const envAppName = process.env[ENV_APP_NAME_KEY]?.trim();
|
|
6
|
+
export const APP_NAME = envAppName && envAppName.length > 0 ? envAppName : "nextclaw";
|
|
7
|
+
export const APP_TITLE = `${APP_NAME.slice(0, 1).toUpperCase()}${APP_NAME.slice(1)}`;
|
package/bridge/src/index.ts
CHANGED
|
@@ -22,29 +22,15 @@ if (!globalCrypto.crypto) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
import { BridgeServer } from './server.js';
|
|
25
|
-
import { existsSync } from 'fs';
|
|
26
25
|
import { homedir } from 'os';
|
|
27
26
|
import { join } from 'path';
|
|
27
|
+
import { APP_NAME, DEFAULT_HOME_DIR, ENV_HOME_KEY } from './brand.js';
|
|
28
28
|
|
|
29
29
|
const PORT = parseInt(process.env.BRIDGE_PORT || '3001', 10);
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
if (envHome) {
|
|
33
|
-
return envHome;
|
|
34
|
-
}
|
|
35
|
-
const primary = join(homedir(), '.nextclaw');
|
|
36
|
-
if (existsSync(primary)) {
|
|
37
|
-
return primary;
|
|
38
|
-
}
|
|
39
|
-
const legacy = join(homedir(), '.nextbot');
|
|
40
|
-
if (existsSync(legacy)) {
|
|
41
|
-
return legacy;
|
|
42
|
-
}
|
|
43
|
-
return primary;
|
|
44
|
-
})();
|
|
45
|
-
const AUTH_DIR = process.env.AUTH_DIR || join(defaultHome, 'whatsapp-auth');
|
|
30
|
+
const homeDir = process.env[ENV_HOME_KEY]?.trim() || join(homedir(), DEFAULT_HOME_DIR);
|
|
31
|
+
const AUTH_DIR = process.env.AUTH_DIR || join(homeDir, 'whatsapp-auth');
|
|
46
32
|
|
|
47
|
-
console.log(
|
|
33
|
+
console.log(`🤖 ${APP_NAME} WhatsApp Bridge`);
|
|
48
34
|
console.log('========================\n');
|
|
49
35
|
|
|
50
36
|
const server = new BridgeServer(PORT, AUTH_DIR);
|
package/bridge/src/whatsapp.ts
CHANGED
|
@@ -14,6 +14,7 @@ import makeWASocket, {
|
|
|
14
14
|
import type { Boom } from '@hapi/boom';
|
|
15
15
|
import qrcode from 'qrcode-terminal';
|
|
16
16
|
import pino from 'pino';
|
|
17
|
+
import { APP_NAME } from './brand.js';
|
|
17
18
|
|
|
18
19
|
const VERSION = '0.1.0';
|
|
19
20
|
|
|
@@ -58,7 +59,7 @@ export class WhatsAppClient {
|
|
|
58
59
|
version,
|
|
59
60
|
logger,
|
|
60
61
|
printQRInTerminal: false,
|
|
61
|
-
browser: [
|
|
62
|
+
browser: [APP_NAME, 'cli', VERSION],
|
|
62
63
|
syncFullHistory: false,
|
|
63
64
|
markOnlineOnConnect: false,
|
|
64
65
|
});
|