mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 00:29:41 +00:00
cleanup
This commit is contained in:
@@ -26,12 +26,12 @@ import {
|
|||||||
import {
|
import {
|
||||||
validateAliases,
|
validateAliases,
|
||||||
validateOSC,
|
validateOSC,
|
||||||
validateOscSubscriptionObject,
|
|
||||||
validatePatchProjectFile,
|
validatePatchProjectFile,
|
||||||
validateSettings,
|
validateSettings,
|
||||||
validateUserFields,
|
validateUserFields,
|
||||||
viewValidator,
|
viewValidator,
|
||||||
validateHTTP,
|
validateHTTP,
|
||||||
|
validateOscSubscription,
|
||||||
} from '../controllers/ontimeController.validate.js';
|
} from '../controllers/ontimeController.validate.js';
|
||||||
import { projectSanitiser } from '../controllers/projectController.validate.js';
|
import { projectSanitiser } from '../controllers/projectController.validate.js';
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ router.get('/osc', getOSC);
|
|||||||
router.post('/osc', validateOSC, postOSC);
|
router.post('/osc', validateOSC, postOSC);
|
||||||
|
|
||||||
// create route between controller and '/ontime/osc-subscriptions' endpoint
|
// create route between controller and '/ontime/osc-subscriptions' endpoint
|
||||||
router.post('/osc-subscriptions', validateOscSubscriptionObject, postOscSubscriptions);
|
router.post('/osc-subscriptions', validateOscSubscription, postOscSubscriptions);
|
||||||
|
|
||||||
// create route between controller and '/ontime/http' endpoint
|
// create route between controller and '/ontime/http' endpoint
|
||||||
router.get('/http', getHTTP);
|
router.get('/http', getHTTP);
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
//TODO: cleanup stuff left over from OSC copy
|
//TODO: cleanup stuff left over from OSC copy
|
||||||
import http from 'node:http';
|
import http from 'node:http';
|
||||||
|
import { URL } from 'node:url';
|
||||||
|
|
||||||
import { HttpSettings, HttpSubscription, HttpSubscriptionOptions, LogOrigin } from 'ontime-types';
|
import { HttpSettings, HttpSubscription, HttpSubscriptionOptions, LogOrigin } from 'ontime-types';
|
||||||
|
|
||||||
import IIntegration, { TimerLifeCycleKey } from './IIntegration.js';
|
import IIntegration, { TimerLifeCycleKey } from './IIntegration.js';
|
||||||
import { parseTemplateNested } from './integrationUtils.js';
|
import { parseTemplateNested } from './integrationUtils.js';
|
||||||
import { dbModel } from '../../models/dataModel.js';
|
import { dbModel } from '../../models/dataModel.js';
|
||||||
import { validateHttpSubscriptionEntry } from '../../utils/parserFunctions.js';
|
|
||||||
import { logger } from '../../classes/Logger.js';
|
import { logger } from '../../classes/Logger.js';
|
||||||
|
import { validateHttpSubscriptionObject } from '../../utils/parserFunctions.js';
|
||||||
|
|
||||||
import { URL } from 'node:url';
|
|
||||||
type Action = TimerLifeCycleKey | string;
|
type Action = TimerLifeCycleKey | string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,8 +62,7 @@ export class HttpIntegration implements IIntegration<HttpSubscriptionOptions> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initSubscriptions(subscriptionOptions: HttpSubscription) {
|
initSubscriptions(subscriptionOptions: HttpSubscription) {
|
||||||
// TODO: here we have to validate the entire subscription object
|
if (validateHttpSubscriptionObject(subscriptionOptions)) {
|
||||||
if (validateHttpSubscriptionEntry(subscriptionOptions)) {
|
|
||||||
this.subscriptions = { ...subscriptionOptions };
|
this.subscriptions = { ...subscriptionOptions };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ export const parseOsc = (data: { osc?: Partial<OSCSettings> }): OSCSettings => {
|
|||||||
if ('osc' in data) {
|
if ('osc' in data) {
|
||||||
console.log('Found OSC definition, importing...');
|
console.log('Found OSC definition, importing...');
|
||||||
|
|
||||||
|
// TODO: this can be improved by only merging known keys
|
||||||
const loadedConfig = data.osc || {};
|
const loadedConfig = data.osc || {};
|
||||||
const validatedSubscriptions = validateOscSubscriptionObject(loadedConfig.subscriptions)
|
const validatedSubscriptions = validateOscSubscriptionObject(loadedConfig.subscriptions)
|
||||||
? loadedConfig.subscriptions
|
? loadedConfig.subscriptions
|
||||||
@@ -266,6 +267,7 @@ export const parseHttp = (data: { http?: Partial<HttpSettings> }): HttpSettings
|
|||||||
if ('http' in data) {
|
if ('http' in data) {
|
||||||
console.log('Found HTTP definition, importing...');
|
console.log('Found HTTP definition, importing...');
|
||||||
|
|
||||||
|
// TODO: this can be improved by only merging known keys
|
||||||
const loadedConfig = data?.http || {};
|
const loadedConfig = data?.http || {};
|
||||||
const validatedSubscriptions = validateHttpSubscriptionObject(loadedConfig.subscriptions)
|
const validatedSubscriptions = validateHttpSubscriptionObject(loadedConfig.subscriptions)
|
||||||
? loadedConfig.subscriptions
|
? loadedConfig.subscriptions
|
||||||
|
|||||||
Reference in New Issue
Block a user