diff --git a/src/api.js b/src/api.js index 4b1e338..67d937f 100644 --- a/src/api.js +++ b/src/api.js @@ -209,7 +209,8 @@ function api(db, channelDB, fillerDB, xmltvInterval, guideService ) { res.status(500).send("error"); } }) - router.post('/api/channel/logo', async (req, res) => { + + router.post('/api/upload/image', async (req, res) => { try { if(!req.files) { res.send({ @@ -217,7 +218,7 @@ function api(db, channelDB, fillerDB, xmltvInterval, guideService ) { message: 'No file uploaded' }); } else { - const logo = req.files.logo; + const logo = req.files.image; logo.mv(path.join(process.env.DATABASE, '/images/uploads/', logo.name)); res.send({ diff --git a/web/directives/channel-config.js b/web/directives/channel-config.js index 18b3626..00ce1ca 100644 --- a/web/directives/channel-config.js +++ b/web/directives/channel-config.js @@ -1854,12 +1854,21 @@ module.exports = function ($timeout, $location, dizquetv, resolutionOptions) { scope.logoOnChange = (event) => { const formData = new FormData(); - formData.append('logo', event.target.files[0]); - dizquetv.addChannelLogo(formData).then((response) => { + formData.append('image', event.target.files[0]); + dizquetv.uploadImage(formData).then((response) => { scope.channel.icon = response.data.fileUrl; }) } + scope.watermarkOnChange = (event) => { + const formData = new FormData(); + formData.append('image', event.target.files[0]); + dizquetv.uploadImage(formData).then((response) => { + scope.channel.watermark.url = response.data.fileUrl; + }) + } + + }, pre: function(scope) { diff --git a/web/public/templates/channel-config.html b/web/public/templates/channel-config.html index f9f1e39..506265a 100644 --- a/web/public/templates/channel-config.html +++ b/web/public/templates/channel-config.html @@ -34,19 +34,24 @@
{{error.icon}} +
+
+ + +
+
Channel Icon Preview
{{channel.name}} {{channel.name}} -
- -
@@ -696,8 +701,19 @@ + +
+ + +
+
diff --git a/web/services/dizquetv.js b/web/services/dizquetv.js index 57076f2..6acace0 100644 --- a/web/services/dizquetv.js +++ b/web/services/dizquetv.js @@ -150,10 +150,18 @@ module.exports = function ($http) { headers: { 'Content-Type': 'application/json; charset=utf-8' } }).then((d) => { return d.data }) }, - addChannelLogo: (file) => { + uploadImage: (file) => { return $http({ method: 'POST', - url: '/api/channel/logo?logo', + url: '/api/upload/image', + data: file, + headers: { 'Content-Type': undefined } + }).then((d) => { return d.data }) + }, + addChannelWatermark: (file) => { + return $http({ + method: 'POST', + url: '/api/channel/watermark', data: file, headers: { 'Content-Type': undefined } }).then((d) => { return d.data })