mirror of https://github.com/Kylart/KawAnime.git
Made basic service to send analytics to kawanime
This commit is contained in:
parent
5c5ccb2ba5
commit
9883cd3a83
|
@ -0,0 +1,23 @@
|
|||
import { eventsList } from '../../../../vendor'
|
||||
import { Logger, https } from '../../utils'
|
||||
|
||||
const events = eventsList.analytics
|
||||
const ANALYTICS_URL = 'https://kawanime.com/api/v1/analytics'
|
||||
|
||||
const logger = new Logger('Analytics')
|
||||
|
||||
async function send (event, { eventName, data }) {
|
||||
https.post(ANALYTICS_URL, {
|
||||
eventName,
|
||||
data
|
||||
})
|
||||
.catch(() => {
|
||||
// We ignore errors
|
||||
logger.error(`Could not send ${eventName} analytics event.`)
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
eventName: events.main,
|
||||
handler: send
|
||||
}
|
|
@ -13,6 +13,7 @@ import isOnline from './isOnline'
|
|||
import vault from './vault'
|
||||
import watchLists from './watchLists'
|
||||
import registerService from './registerService'
|
||||
import analytics from './analytics'
|
||||
|
||||
const services = [
|
||||
...config,
|
||||
|
@ -29,7 +30,8 @@ const services = [
|
|||
news,
|
||||
seasons,
|
||||
episodes,
|
||||
isOnline
|
||||
isOnline,
|
||||
analytics
|
||||
]
|
||||
|
||||
// auto update
|
||||
|
|
|
@ -19,7 +19,8 @@ const getOnly = [
|
|||
// Internal
|
||||
'env',
|
||||
'isOnline',
|
||||
'externalOpen'
|
||||
'externalOpen',
|
||||
'analytics'
|
||||
]
|
||||
|
||||
const updatable = [
|
||||
|
|
Loading…
Reference in New Issue