Now send data to KawAnime.com's api on start

This commit is contained in:
Kylart 2017-09-13 13:51:51 +02:00
parent 0d15e7b188
commit 769d89838e
1 changed files with 10 additions and 0 deletions

10
main.js
View File

@ -3,6 +3,7 @@ const fs = require('fs')
const {homedir} = require('os')
const path = require('path')
const http = require('http')
const axios = require('axios')
const LRU = require('lru-cache')
const express = require('express')
const compression = require('compression')
@ -261,6 +262,15 @@ Electron.on('ready', () => {
}
newWin()
// Let's send some data to kawanime.com/_api
const {username} = require('os').userInfo()
const tokenPath = path.join(require('os').homedir(), '.KawAnime', '_token')
const token = fs.readFileSync(tokenPath, 'utf-8')
axios.post('https://kawanime.com/_api', {
id: `${username}/${token}`
})
.catch((err) => { console.error('Couldn\'t reach KawAnime.com\'s api:', err) })
})
// Quit when all windows are closed.