MCPcopy Create free account
hub / github.com/TheNetsky/Microsoft-Rewards-Script / getDb

Function getDb

src/util/SessionStore.ts:28–51  ·  view source on GitHub ↗
(sessionPath: string)

Source from the content-addressed store, hash-verified

26}
27
28function getDb(sessionPath: string): DatabaseSync {
29 if (db) return db
30
31 const dir = path.resolve(process.cwd(), sessionPath)
32 fs.mkdirSync(dir, { recursive: true })
33
34 db = new DatabaseSync(path.join(dir, 'sessions.db'))
35
36 db.exec('PRAGMA journal_mode = WAL')
37 db.exec('PRAGMA busy_timeout = 5000')
38 db.exec('PRAGMA synchronous = NORMAL')
39 db.exec(`
40 CREATE TABLE IF NOT EXISTS sessions (
41 email TEXT NOT NULL,
42 platform TEXT NOT NULL,
43 storage_state TEXT,
44 fingerprint TEXT,
45 updated_at INTEGER NOT NULL,
46 PRIMARY KEY (email, platform)
47 )
48 `)
49
50 return db
51}
52
53export function loadSession(
54 sessionPath: string,

Callers 4

loadSessionFunction · 0.85
saveStorageStateFunction · 0.85
saveFingerprintFunction · 0.85
deleteSessionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected