whatsapp-pi 1.0.21 → 1.0.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-pi",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "description": "WhatsApp integration extension for Pi",
6
6
  "main": "whatsapp-pi.ts",
@@ -1,19 +1,17 @@
1
1
  import { useMultiFileAuthState } from '@whiskeysockets/baileys';
2
- import { join, dirname } from 'path';
3
- import { fileURLToPath } from 'url';
4
- import { rm, readFile, writeFile, mkdir } from 'fs/promises';
2
+ import { join } from 'path';
3
+ import { readFile, writeFile, mkdir, rm } from 'fs/promises';
4
+ import { homedir } from 'os';
5
5
  import { SessionStatus } from '../models/whatsapp.types.js';
6
6
 
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
-
9
7
  export interface Contact {
10
8
  number: string;
11
9
  name?: string;
12
10
  }
13
11
 
14
12
  export class SessionManager {
15
- // Data is stored in a fixed folder inside the extension project
16
- private readonly baseDir = join(__dirname, '..', '..', '.pi-data');
13
+ // Data is stored in the user's home directory to persist across updates
14
+ private readonly baseDir = join(homedir(), '.pi', 'whatsapp-pi');
17
15
  private readonly authDir = join(this.baseDir, 'auth');
18
16
  private readonly configPath = join(this.baseDir, 'config.json');
19
17