Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
validate: () => {
let device = PeripheralDevices.findOne({type: PeripheralDeviceAPI.DeviceType.PLAYOUT})
if (!device) return 'Playout-gateway not found'
let settings = device.settings || {devices: {}} as PlayoutDeviceSettings
let casparcg0 = settings.devices['casparcg0'] as PlayoutDeviceSettingsDeviceCasparCG
if (!casparcg0) return '"casparcg0" missing'
// @ts-ignore
if (!casparcg0.options) casparcg0.options = {}
if (casparcg0.type !== PlayoutDeviceType.CASPARCG) return 'Type is not "CASPARCG"'
if (!casparcg0.options.host) return 'Host is not set'
if (!casparcg0.options.launcherHost) return 'Launcher host is not set'
return false
},
migrate: () => {
migrate: () => {
let device = PeripheralDevices.findOne({type: PeripheralDeviceAPI.DeviceType.PLAYOUT})
if (device) {
// Set some default values:
let casparcg1 = device.settings && device.settings.devices['casparcg1']
if (!casparcg1) {
logger.info(`Migration: Add PeripheralDevice.settings to ${device._id}: casparcg1`)
PeripheralDevices.update(device._id, {$set: {
'settings.devices.casparcg1': {
type: PlayoutDeviceType.CASPARCG,
options: {
host: '127.0.0.1',
port: 5250,
launcherHost: '127.0.0.1',
launcherPort: 8010, // todo: change this
}
}
}})
}
}
},
input: [{
}).forEach((pd) => {
PeripheralDevices.update(pd._id, {$set: {
'settings.devices.casparcg0': ((pd['settings'] || {})['devices'] || {})['casparcg0'] || {
type: PlayoutDeviceType.CASPARCG,
options: {
host: '160.67.87.50',
port: 5250,
launcherHost: '160.67.87.50',
launcherPort: 8005
}
},
'settings.devices.casparcg1': ((pd['settings'] || {})['devices'] || {})['casparcg1'] || {
type: PlayoutDeviceType.CASPARCG,
options: {
host: '',
port: 5250,
launcherHost: '',
launcherPort: 8005
}
},
}).forEach((pd) => {
PeripheralDevices.update(pd._id, {$set: {
'settings.devices.casparcg0': ((pd['settings'] || {})['devices'] || {})['casparcg0'] || {
type: PlayoutDeviceType.CASPARCG,
options: {
host: '160.67.87.50',
port: 5250,
launcherHost: '160.67.87.50',
launcherPort: 8005
}
},
'settings.devices.casparcg1': ((pd['settings'] || {})['devices'] || {})['casparcg1'] || {
type: PlayoutDeviceType.CASPARCG,
options: {
host: '',
port: 5250,
launcherHost: '',
launcherPort: 8005
}
},
'settings.devices.atem0': ((pd['settings'] || {})['devices'] || {})['atem0'] || {
type: PlayoutDeviceType.ATEM,
options: {
host: '160.67.87.51',
port: 9910
}
},
'settings.devices.lawo0': ((pd['settings'] || {})['devices'] || {})['lawo0'] || {
type: PlayoutDeviceType.LAWO,
type: SourceLayerType.MIC,
unlimited: false,
onPGMClean: true,
},
{
_id: 'studio0-camera0',
_rank: 100,
name: 'Kam',
type: SourceLayerType.CAMERA,
unlimited: false,
onPGMClean: true,
},
],
mappings: {
'layer0': {
device: PlayoutDeviceType.CASPARCG,
lookahead: LookaheadMode.NONE,
deviceId: 'casparcg0'
}
},
config: [
{
_id: 'nora_group',
value: 'dksl'
},
{
_id: 'nora_apikey',
value: ''
},
{
_id: 'slack_evaluation',