UNPKG

478 BJavaScriptView Raw
1#!/usr/bin/env node
2const chalk = require('chalk')
3const Gmail = require('./gmail')
4const db = require('./db')
5const auth = require('./auth')
6
7const clear = () => {
8 db.set('messages', []).set('pages', {}).write()
9}
10
11async function init () {
12 clear()
13 let accounts = db.get('prefs.accounts').value()
14 if (accounts) {
15 await (new Gmail(accounts)).renderMain()
16 } else {
17 console.log(chalk.bold('Authorizing...'))
18 await auth()
19 require('./server')
20 }
21}
22
23init()