From ec78765c0bfbe583ff9b5cbdcd6d011ecb89ac62 Mon Sep 17 00:00:00 2001
From: jb-alvarado <jb@pixelcrusher.de>
Date: Fri, 19 Aug 2022 13:30:26 +0200
Subject: [PATCH] add audio to source, fix advertisement checkbox

---
 package-lock.json | 82 +++++++++++++++++++++++------------------------
 package.json      |  8 ++---
 pages/player.vue  | 17 ++++++++--
 plugins/axios.js  |  4 ++-
 4 files changed, 62 insertions(+), 49 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index f526c9c7..f4b3b9ff 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,25 +1,25 @@
 {
   "name": "ffplayout-frontend",
-  "version": "5.1.1",
+  "version": "5.1.2",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "ffplayout-frontend",
-      "version": "5.1.1",
+      "version": "5.1.2",
       "dependencies": {
         "@nuxtjs/axios": "^5.13.6",
         "@nuxtjs/dayjs": "^1.4.1",
         "@nuxtjs/dotenv": "^1.4.1",
         "bootstrap": "^4.6.1",
         "bootstrap-vue": "^2.22.0",
-        "cookie-universal-nuxt": "^2.2.1",
+        "cookie-universal-nuxt": "^2.2.2",
         "jwt-decode": "^3.1.2",
         "lodash": "^4.17.21",
         "mpegts.js": "^1.6.10",
         "nuxt": "^2.15.8",
         "splitpanes": "^2.3.8",
-        "video.js": "^7.20.1",
+        "video.js": "^7.20.2",
         "vue-loading-overlay": "^3.4.2",
         "vue2-perfect-scrollbar": "^1.5.5",
         "vuedraggable": "^2.24.3"
@@ -32,7 +32,7 @@
         "@nuxtjs/style-resources": "^1.2.1",
         "eslint": "^7.32.0",
         "eslint-plugin-nuxt": ">=2.0.0",
-        "sass": "^1.53.0",
+        "sass": "^1.54.4",
         "sass-loader": "^10.2.1"
       }
     },
@@ -5157,21 +5157,21 @@
       }
     },
     "node_modules/cookie-universal": {
-      "version": "2.2.1",
-      "resolved": "https://registry.npmjs.org/cookie-universal/-/cookie-universal-2.2.1.tgz",
-      "integrity": "sha512-HMm8mNbMJ81IER5BZ3QF0wz5OA/od4jDB6agNwJjJ7oDnBnQBQwUJNeCXrYCBiCKh+ZzHDQ74D96HjUTHQHjsg==",
+      "version": "2.2.2",
+      "resolved": "https://registry.npmjs.org/cookie-universal/-/cookie-universal-2.2.2.tgz",
+      "integrity": "sha512-nUXF6HH2YKbn8vGcdSzWJhjRkDHbnbekuVu2nsRu00zYsX7o/H3xGJRlPVoM4wX/8cpJYpyi9nDt+boER0Wjug==",
       "dependencies": {
         "@types/cookie": "^0.3.3",
         "cookie": "^0.4.0"
       }
     },
     "node_modules/cookie-universal-nuxt": {
-      "version": "2.2.1",
-      "resolved": "https://registry.npmjs.org/cookie-universal-nuxt/-/cookie-universal-nuxt-2.2.1.tgz",
-      "integrity": "sha512-pzk+CsmnNgcpFPNr8GO+B3dR0d0ovjnyFMC5Trx3zNUEEplw94CoEbv+SLSjxsXCMOF21Cmq202Od0zYbkOa+g==",
+      "version": "2.2.2",
+      "resolved": "https://registry.npmjs.org/cookie-universal-nuxt/-/cookie-universal-nuxt-2.2.2.tgz",
+      "integrity": "sha512-Pr6P5UCzl1EAvPh7z7jFkknBw0KTdykm6gFmPHrH4LV9s3flVmAH0ZP/ZqUXcp6b0SKZfizkn+XR1cO+QinGhQ==",
       "dependencies": {
         "@types/cookie": "^0.3.3",
-        "cookie-universal": "^2.2.1"
+        "cookie-universal": "^2.2.2"
       }
     },
     "node_modules/copy-concurrently": {
@@ -10614,13 +10614,13 @@
       }
     },
     "node_modules/parse-url": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-6.0.2.tgz",
-      "integrity": "sha512-uCSjOvD3T+6B/sPWhR+QowAZcU/o4bjPrVBQBGFxcDF6J6FraCGIaDBsdoQawiaaAVdHvtqBe3w3vKlfBKySOQ==",
+      "version": "6.0.5",
+      "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-6.0.5.tgz",
+      "integrity": "sha512-e35AeLTSIlkw/5GFq70IN7po8fmDUjpDPY1rIK+VubRfsUvBonjQ+PBZG+vWMACnQSmNlvl524IucoDmcioMxA==",
       "dependencies": {
         "is-ssh": "^1.3.0",
         "normalize-url": "^6.1.0",
-        "parse-path": "^4.0.4",
+        "parse-path": "^4.0.0",
         "protocols": "^1.4.0"
       }
     },
@@ -12874,9 +12874,9 @@
       "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
     },
     "node_modules/sass": {
-      "version": "1.53.0",
-      "resolved": "https://registry.npmjs.org/sass/-/sass-1.53.0.tgz",
-      "integrity": "sha512-zb/oMirbKhUgRQ0/GFz8TSAwRq2IlR29vOUJZOx0l8sV+CkHUfHa4u5nqrG+1VceZp7Jfj59SVW9ogdhTvJDcQ==",
+      "version": "1.54.4",
+      "resolved": "https://registry.npmjs.org/sass/-/sass-1.54.4.tgz",
+      "integrity": "sha512-3tmF16yvnBwtlPrNBHw/H907j8MlOX8aTBnlNX1yrKx24RKcJGPyLhFUwkoKBKesR3unP93/2z14Ll8NicwQUA==",
       "dev": true,
       "dependencies": {
         "chokidar": ">=3.0.0 <4.0.0",
@@ -14958,9 +14958,9 @@
       }
     },
     "node_modules/video.js": {
-      "version": "7.20.1",
-      "resolved": "https://registry.npmjs.org/video.js/-/video.js-7.20.1.tgz",
-      "integrity": "sha512-QMuj+bjwvLId9SY8uBAjO9sw7pCDhdVzJtwsAwg1MdVLXgVuxhhSYswdsdsRk+YMssHtReopINclvDlTGTxMLA==",
+      "version": "7.20.2",
+      "resolved": "https://registry.npmjs.org/video.js/-/video.js-7.20.2.tgz",
+      "integrity": "sha512-hdvAHKAyaL6bCDkeu0pPtFYKi1EDaOUovm7FN1xqBDolUxgH8FKy1WIgTS+Ouuaw7R54SCTcSeXjZEizhy9ouQ==",
       "dependencies": {
         "@babel/runtime": "^7.12.5",
         "@videojs/http-streaming": "2.14.2",
@@ -15474,7 +15474,7 @@
     "node_modules/watchpack-chokidar2/node_modules/glob-parent": {
       "version": "3.1.0",
       "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
-      "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
+      "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==",
       "optional": true,
       "dependencies": {
         "is-glob": "^3.1.0",
@@ -20622,21 +20622,21 @@
       "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA=="
     },
     "cookie-universal": {
-      "version": "2.2.1",
-      "resolved": "https://registry.npmjs.org/cookie-universal/-/cookie-universal-2.2.1.tgz",
-      "integrity": "sha512-HMm8mNbMJ81IER5BZ3QF0wz5OA/od4jDB6agNwJjJ7oDnBnQBQwUJNeCXrYCBiCKh+ZzHDQ74D96HjUTHQHjsg==",
+      "version": "2.2.2",
+      "resolved": "https://registry.npmjs.org/cookie-universal/-/cookie-universal-2.2.2.tgz",
+      "integrity": "sha512-nUXF6HH2YKbn8vGcdSzWJhjRkDHbnbekuVu2nsRu00zYsX7o/H3xGJRlPVoM4wX/8cpJYpyi9nDt+boER0Wjug==",
       "requires": {
         "@types/cookie": "^0.3.3",
         "cookie": "^0.4.0"
       }
     },
     "cookie-universal-nuxt": {
-      "version": "2.2.1",
-      "resolved": "https://registry.npmjs.org/cookie-universal-nuxt/-/cookie-universal-nuxt-2.2.1.tgz",
-      "integrity": "sha512-pzk+CsmnNgcpFPNr8GO+B3dR0d0ovjnyFMC5Trx3zNUEEplw94CoEbv+SLSjxsXCMOF21Cmq202Od0zYbkOa+g==",
+      "version": "2.2.2",
+      "resolved": "https://registry.npmjs.org/cookie-universal-nuxt/-/cookie-universal-nuxt-2.2.2.tgz",
+      "integrity": "sha512-Pr6P5UCzl1EAvPh7z7jFkknBw0KTdykm6gFmPHrH4LV9s3flVmAH0ZP/ZqUXcp6b0SKZfizkn+XR1cO+QinGhQ==",
       "requires": {
         "@types/cookie": "^0.3.3",
-        "cookie-universal": "^2.2.1"
+        "cookie-universal": "^2.2.2"
       }
     },
     "copy-concurrently": {
@@ -24786,13 +24786,13 @@
       }
     },
     "parse-url": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-6.0.2.tgz",
-      "integrity": "sha512-uCSjOvD3T+6B/sPWhR+QowAZcU/o4bjPrVBQBGFxcDF6J6FraCGIaDBsdoQawiaaAVdHvtqBe3w3vKlfBKySOQ==",
+      "version": "6.0.5",
+      "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-6.0.5.tgz",
+      "integrity": "sha512-e35AeLTSIlkw/5GFq70IN7po8fmDUjpDPY1rIK+VubRfsUvBonjQ+PBZG+vWMACnQSmNlvl524IucoDmcioMxA==",
       "requires": {
         "is-ssh": "^1.3.0",
         "normalize-url": "^6.1.0",
-        "parse-path": "^4.0.4",
+        "parse-path": "^4.0.0",
         "protocols": "^1.4.0"
       },
       "dependencies": {
@@ -26596,9 +26596,9 @@
       "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
     },
     "sass": {
-      "version": "1.53.0",
-      "resolved": "https://registry.npmjs.org/sass/-/sass-1.53.0.tgz",
-      "integrity": "sha512-zb/oMirbKhUgRQ0/GFz8TSAwRq2IlR29vOUJZOx0l8sV+CkHUfHa4u5nqrG+1VceZp7Jfj59SVW9ogdhTvJDcQ==",
+      "version": "1.54.4",
+      "resolved": "https://registry.npmjs.org/sass/-/sass-1.54.4.tgz",
+      "integrity": "sha512-3tmF16yvnBwtlPrNBHw/H907j8MlOX8aTBnlNX1yrKx24RKcJGPyLhFUwkoKBKesR3unP93/2z14Ll8NicwQUA==",
       "dev": true,
       "requires": {
         "chokidar": ">=3.0.0 <4.0.0",
@@ -28221,9 +28221,9 @@
       "integrity": "sha512-/juG65kTL4Cy2su4P8HjtkTxk6VmJDiOPBufWniqQ6wknac6jNiXS9vU+hO3wgusiyqWlzTbVHi0dyJqRONg3w=="
     },
     "video.js": {
-      "version": "7.20.1",
-      "resolved": "https://registry.npmjs.org/video.js/-/video.js-7.20.1.tgz",
-      "integrity": "sha512-QMuj+bjwvLId9SY8uBAjO9sw7pCDhdVzJtwsAwg1MdVLXgVuxhhSYswdsdsRk+YMssHtReopINclvDlTGTxMLA==",
+      "version": "7.20.2",
+      "resolved": "https://registry.npmjs.org/video.js/-/video.js-7.20.2.tgz",
+      "integrity": "sha512-hdvAHKAyaL6bCDkeu0pPtFYKi1EDaOUovm7FN1xqBDolUxgH8FKy1WIgTS+Ouuaw7R54SCTcSeXjZEizhy9ouQ==",
       "requires": {
         "@babel/runtime": "^7.12.5",
         "@videojs/http-streaming": "2.14.2",
@@ -28645,7 +28645,7 @@
         "glob-parent": {
           "version": "3.1.0",
           "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
-          "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
+          "integrity": "sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA==",
           "optional": true,
           "requires": {
             "is-glob": "^3.1.0",
diff --git a/package.json b/package.json
index 4f67f987..ee6aa083 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "ffplayout-frontend",
-  "version": "5.1.1",
+  "version": "5.1.2",
   "description": "Web GUI for ffplayout",
   "author": "Jonathan Baecker",
   "private": true,
@@ -17,13 +17,13 @@
     "@nuxtjs/dotenv": "^1.4.1",
     "bootstrap": "^4.6.1",
     "bootstrap-vue": "^2.22.0",
-    "cookie-universal-nuxt": "^2.2.1",
+    "cookie-universal-nuxt": "^2.2.2",
     "jwt-decode": "^3.1.2",
     "lodash": "^4.17.21",
     "mpegts.js": "^1.6.10",
     "nuxt": "^2.15.8",
     "splitpanes": "^2.3.8",
-    "video.js": "^7.20.1",
+    "video.js": "^7.20.2",
     "vue-loading-overlay": "^3.4.2",
     "vue2-perfect-scrollbar": "^1.5.5",
     "vuedraggable": "^2.24.3"
@@ -36,7 +36,7 @@
     "@nuxtjs/style-resources": "^1.2.1",
     "eslint": "^7.32.0",
     "eslint-plugin-nuxt": ">=2.0.0",
-    "sass": "^1.53.0",
+    "sass": "^1.54.4",
     "sass-loader": "^10.2.1"
   }
 }
diff --git a/pages/player.vue b/pages/player.vue
index 60a74297..82b5b9f0 100644
--- a/pages/player.vue
+++ b/pages/player.vue
@@ -284,7 +284,7 @@
                                                 <b-form-checkbox
                                                     v-model="item.category"
                                                     value="advertisement"
-                                                    :unchecked-value="item.category"
+                                                    unchecked-value=""
                                                 />
                                             </b-col>
                                             <b-col cols="1" class="text-center playlist-input">
@@ -373,11 +373,14 @@
                 <b-form-group label="Source" label-for="source-input" invalid-feedback="Source is required">
                     <b-form-input id="source-input" v-model="newSource.source" required />
                 </b-form-group>
+                <b-form-group label="Audio" label-for="audio-input">
+                    <b-form-input id="audio-input" v-model="newSource.audio" />
+                </b-form-group>
                 <b-form-checkbox
                     id="ad-input"
                     v-model="newSource.category"
                     value="advertisement"
-                    :unchecked-value="newSource.category"
+                    unchecked-value=""
                 >
                     Advertisement
                 </b-form-checkbox>
@@ -715,10 +718,18 @@ export default {
             if (postSave.status === 200 || postSave.status === 201) {
                 this.$store.commit('UPDATE_VARIANT', 'success')
                 this.$store.commit('UPDATE_SHOW_ERROR_ALERT', true)
-                this.$store.commit('UPDATE_ERROR_ALERT_MESSAGE', 'Playlist saved...')
+                this.$store.commit('UPDATE_ERROR_ALERT_MESSAGE', postSave.data)
 
                 setTimeout(() => { this.$store.commit('UPDATE_SHOW_ERROR_ALERT', false) }, 2000)
             }
+
+            if (postSave.status === 409) {
+                this.$store.commit('UPDATE_VARIANT', 'success')
+                this.$store.commit('UPDATE_SHOW_ERROR_ALERT', true)
+                this.$store.commit('UPDATE_ERROR_ALERT_MESSAGE', postSave.data)
+
+                setTimeout(() => { this.$store.commit('UPDATE_SHOW_ERROR_ALERT', false) }, 4000)
+            }
         },
 
         async deletePlaylist (playlistDate) {
diff --git a/plugins/axios.js b/plugins/axios.js
index 14fe1e0f..7e33500c 100644
--- a/plugins/axios.js
+++ b/plugins/axios.js
@@ -38,10 +38,12 @@ export default function ({ $axios, store, redirect, route }) {
 
         if (code === 401 && route.path !== '/') {
             redirect('/')
-        } else if (code !== 401 && code !== 503) {
+        } else if (code !== 401 && code !== 409 && code !== 503) {
             store.commit('UPDATE_VARIANT', 'danger')
             store.commit('UPDATE_SHOW_ERROR_ALERT', true)
             store.commit('UPDATE_ERROR_ALERT_MESSAGE', error)
         }
+
+        return error.response
     })
 }