From c75f9b943de3617e86e7ea145d15fdb9f88119e1 Mon Sep 17 00:00:00 2001 From: Marco Dengel Date: Tue, 12 Dec 2023 10:54:12 +0100 Subject: [PATCH 1/4] chore: added logging for dts --- package.json | 2 +- src/ingest/events/post.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 190f2798..b0ff82cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ard-eventhub", - "version": "1.7.0", + "version": "1.7.1", "description": "ARD system to distribute real-time (live) metadata for primarily radio broadcasts.", "main": "./src/ingest/index.js", "engines": { diff --git a/src/ingest/events/post.js b/src/ingest/events/post.js index 4734b4de..445e8cd5 100644 --- a/src/ingest/events/post.js +++ b/src/ingest/events/post.js @@ -131,7 +131,10 @@ module.exports = async (req, res) => { // add opt-out plugins const isDtsPluginSet = message.plugins?.find((plugin) => plugin.type === 'dts') const isMusic = req.body.type === 'music' - if (!isDtsPluginSet && isMusic && DTS_INSTITUTION_ALLOW_LIST.includes(req.user.institutionId)) { + const isInDtsAllowList = DTS_INSTITUTION_ALLOW_LIST.includes(req.user.institutionId) + const institutionId = req.user.institutionId || 'unknown' + + if (!isDtsPluginSet && isMusic && isInDtsAllowList) { message.plugins.push({ type: 'dts', isDeactivated: false, @@ -182,7 +185,7 @@ module.exports = async (req, res) => { // log success logger.log({ level: 'info', - message: `event processed > ${eventName} > ${message.services.length}x services (${message.services[0]?.publisherId})`, + message: `event processed > ${eventName} > institution ${institutionId} > isInDtsAllowList ${isInDtsAllowList} > ${message.services.length}x services (${message.services[0]?.publisherId})`, source, data: { ...data, body: req.body, isDtsPluginSet }, }) From bf135942b626a9efcbd94b7f28fd05410daf9a78 Mon Sep 17 00:00:00 2001 From: Marco Dengel Date: Tue, 12 Dec 2023 11:30:16 +0100 Subject: [PATCH 2/4] fix: institution ids for swr and br --- src/ingest/events/post.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ingest/events/post.js b/src/ingest/events/post.js index 445e8cd5..4467a301 100644 --- a/src/ingest/events/post.js +++ b/src/ingest/events/post.js @@ -23,8 +23,8 @@ const DEFAULT_ZONE = 'Europe/Berlin' // feature flags const IS_COMMON_TOPIC_ENABLED = true -// allow DTS for SWR (a3004ff924ece1a2) and BR (95a02eb6cc4f3d59) -const DTS_INSTITUTION_ALLOW_LIST = ['urn:ard:institution:a3004ff924ece1a2', 'urn:ard:institution:95a02eb6cc4f3d59'] +// allow DTS for SWR (baa7e9a52223a090) and BR (7d64899d03610af2) +const DTS_INSTITUTION_ALLOW_LIST = ['urn:ard:institution:baa7e9a52223a090', 'urn:ard:institution:7d64899d03610af2'] module.exports = async (req, res) => { try { From 2856ac6dd06407037033915a0bbd1c40f0e9d051 Mon Sep 17 00:00:00 2001 From: Marco Dengel Date: Tue, 12 Dec 2023 11:54:09 +0100 Subject: [PATCH 3/4] refactor: log cleanup --- src/ingest/events/post.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ingest/events/post.js b/src/ingest/events/post.js index 4467a301..832ee30f 100644 --- a/src/ingest/events/post.js +++ b/src/ingest/events/post.js @@ -132,7 +132,6 @@ module.exports = async (req, res) => { const isDtsPluginSet = message.plugins?.find((plugin) => plugin.type === 'dts') const isMusic = req.body.type === 'music' const isInDtsAllowList = DTS_INSTITUTION_ALLOW_LIST.includes(req.user.institutionId) - const institutionId = req.user.institutionId || 'unknown' if (!isDtsPluginSet && isMusic && isInDtsAllowList) { message.plugins.push({ @@ -185,7 +184,7 @@ module.exports = async (req, res) => { // log success logger.log({ level: 'info', - message: `event processed > ${eventName} > institution ${institutionId} > isInDtsAllowList ${isInDtsAllowList} > ${message.services.length}x services (${message.services[0]?.publisherId})`, + message: `event processed > ${eventName} > ${message.services.length}x services (${message.services[0]?.publisherId})`, source, data: { ...data, body: req.body, isDtsPluginSet }, }) From 8f2a6fa4fdda08e23d1cb84fc9cfe434a8b290ec Mon Sep 17 00:00:00 2001 From: Marco Dengel Date: Tue, 12 Dec 2023 11:56:25 +0100 Subject: [PATCH 4/4] chore: add new version to readme --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48277e09..59a879b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.7.1] - 2023-12-12 + +- feat: added allow list by institution for `dts` plugin + ## [1.7.0] - 2023-10-27 - refactor: drop `contentId` mapping from `dts` plugin