Shinobi/libs/extenders.js

67 lines
2.8 KiB
JavaScript
Raw Normal View History

2018-10-02 00:21:48 +00:00
module.exports = function(s,config){
s.cloudDiskUseStartupExtensions = {}
s.cloudDiskUseOnGetVideoDataExtensions = {}
2022-07-03 21:09:56 +00:00
function createExtension(nameOfExtension,nameOfExtensionContainer,objective){
2022-07-03 20:50:53 +00:00
nameOfExtensionContainer = nameOfExtensionContainer || `${nameOfExtension}Extensions`
2022-07-03 21:09:56 +00:00
if(objective){
s[nameOfExtensionContainer] = []
s[nameOfExtension] = function(nameOfCallback,callback){
s[nameOfExtensionContainer][nameOfCallback] = callback
}
}else{
s[nameOfExtensionContainer] = []
s[nameOfExtension] = function(callback){
s[nameOfExtensionContainer].push(callback)
}
2022-07-03 20:50:53 +00:00
}
2018-10-02 00:21:48 +00:00
}
2022-07-03 20:50:53 +00:00
////// USER //////
createExtension(`onSocketAuthentication`)
createExtension(`onUserLog`)
createExtension(`loadGroupExtender`,`loadGroupExtensions`)
createExtension(`loadGroupAppExtender`,`loadGroupAppExtensions`)
createExtension(`unloadGroupAppExtender`,`unloadGroupAppExtensions`)
createExtension(`onAccountSave`)
createExtension(`beforeAccountSave`)
createExtension(`onTwoFactorAuthCodeNotification`)
createExtension(`onStalePurgeLock`)
////// EVENTS //////
createExtension(`onEventTrigger`)
createExtension(`onEventTriggerBeforeFilter`)
createExtension(`onFilterEvent`)
////// MONITOR //////
2022-07-03 20:50:53 +00:00
createExtension(`onMonitorInit`)
createExtension(`onMonitorStart`)
createExtension(`onMonitorStop`)
createExtension(`onMonitorSave`)
createExtension(`onMonitorUnexpectedExit`)
createExtension(`onDetectorNoTriggerTimeout`)
createExtension(`onFfmpegCameraStringCreation`)
createExtension(`onFfmpegBuildMainStream`)
createExtension(`onFfmpegBuildStreamChannel`)
createExtension(`onMonitorPingFailed`)
createExtension(`onMonitorDied`)
createExtension(`onMonitorCreateStreamPipe`)
2018-12-12 22:56:29 +00:00
///////// SYSTEM ////////
2022-07-03 20:50:53 +00:00
createExtension(`onProcessReady`)
createExtension(`onProcessExit`)
createExtension(`onBeforeDatabaseLoad`)
createExtension(`onFFmpegLoaded`)
createExtension(`beforeMonitorsLoadedOnStartup`)
createExtension(`onWebSocketConnection`)
createExtension(`onWebSocketDisconnection`)
createExtension(`onWebsocketMessageSend`)
createExtension(`onOtherWebSocketMessages`)
createExtension(`onGetCpuUsage`)
createExtension(`onGetRamUsage`)
createExtension(`onSubscriptionCheck`)
createExtension(`onDataPortMessage`)
2022-07-03 21:52:30 +00:00
createExtension(`onHttpRequestUpgrade`,null,true)
/////// VIDEOS ////////
2022-07-03 20:50:53 +00:00
createExtension(`insertCompletedVideoExtender`,`insertCompletedVideoExtensions`)
createExtension(`onEventBasedRecordingComplete`)
2022-07-03 20:50:53 +00:00
createExtension(`onBeforeInsertCompletedVideo`)
/////// TIMELAPSE ////////
2022-07-03 20:50:53 +00:00
createExtension(`onInsertTimelapseFrame`)
2018-10-02 00:21:48 +00:00
}