@vielhuber/wahelper 1.4.6 → 1.4.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
@@ -107,7 +107,7 @@ $wahelper->sendGroup(
107
107
  npm install -g pm2
108
108
 
109
109
  # start daemon
110
- pm2 start npx --name wahelper-xxxxxxxxxxxx -- wahelper-daemon --device xxxxxxxxxxxx
110
+ pm2 start npx --name wahelper-xxxxxxxxxxxx --cwd /var/www/wahelper -- wahelper-daemon --device xxxxxxxxxxxx
111
111
 
112
112
  # optional: autostart
113
113
  ## save config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vielhuber/wahelper",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "Lightweight whatsapp integration layer.",
5
5
  "main": "wahelper.js",
6
6
  "files": [
@@ -46,6 +46,9 @@ export default class wahelperDaemon {
46
46
  currentDir = dirname(fileURLToPath(import.meta.url));
47
47
  if (currentDir.includes('node_modules')) {
48
48
  projectRoot = dirname(dirname(dirname(currentDir)));
49
+ if (!fs.existsSync(projectRoot + '/package.json')) {
50
+ projectRoot = process.cwd();
51
+ }
49
52
  } else if (currentDir.includes('vendor')) {
50
53
  projectRoot = dirname(dirname(dirname(currentDir)));
51
54
  } else {
@@ -697,8 +700,12 @@ export default class wahelperDaemon {
697
700
  process.exit(1);
698
701
  }
699
702
 
700
- this.log('Daemon starting.. (device: ' + this.device + ')');
701
- console.log('Daemon starting... (device: ' + this.device + ')');
703
+ this.log(
704
+ 'Daemon starting.. (device: ' + this.device + ', socket: ' + this.dirname + '/' + this.socketPath + ')'
705
+ );
706
+ console.log(
707
+ 'Daemon starting... (device: ' + this.device + ', socket: ' + this.dirname + '/' + this.socketPath + ')'
708
+ );
702
709
 
703
710
  this.initDatabase();
704
711
  this.initExitHooks();
package/wahelper.js CHANGED
@@ -33,6 +33,9 @@ export default class wahelper {
33
33
  currentDir = dirname(fileURLToPath(import.meta.url));
34
34
  if (currentDir.includes('node_modules')) {
35
35
  projectRoot = dirname(dirname(dirname(currentDir)));
36
+ if (!fs.existsSync(projectRoot + '/package.json')) {
37
+ projectRoot = process.cwd();
38
+ }
36
39
  } else if (currentDir.includes('vendor')) {
37
40
  projectRoot = dirname(dirname(dirname(currentDir)));
38
41
  } else {