mirror of https://github.com/Kylart/KawAnime.git
Added version to send to analytics
This commit is contained in:
parent
cccfc8db31
commit
0000f9ae66
|
@ -1,3 +1,4 @@
|
|||
VUE_APP_KAWANIME_API_URL=
|
||||
VUE_APP_KAWANIME_SECRET=
|
||||
|
||||
VUE_APP_ANILIST_CLIENT_ID=
|
||||
|
|
|
@ -6,16 +6,18 @@ import { localFiles } from '../../externals'
|
|||
|
||||
const events = eventsList.analytics
|
||||
const secretKey = process.env.VUE_APP_KAWANIME_SECRET
|
||||
const ANALYTICS_URL = 'https://api.kawanime.com/v1/analytics'
|
||||
const ANALYTICS_URL = process.env.VUE_APP_KAWANIME_API_URL
|
||||
const VERSION = process.env.KAWANIME_VERSION
|
||||
const userToken = readFileSync(localFiles.getPath('_token'))
|
||||
|
||||
const logger = new Logger('Analytics')
|
||||
|
||||
async function send (event, { eventName, data }) {
|
||||
https.post(ANALYTICS_URL, {
|
||||
https.post(`${ANALYTICS_URL}/analytics`, {
|
||||
eventName,
|
||||
data,
|
||||
userToken
|
||||
userToken,
|
||||
version: VERSION
|
||||
}, [], { Authorization: `Bearer ${secretKey}` })
|
||||
.catch(() => {
|
||||
// We ignore errors
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
process.env.KAWANIME_VERSION = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json'))).version
|
||||
|
||||
/**
|
||||
* Taken from https://gist.github.com/kethinov/6658166#gistcomment-2389484
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue