summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-04-18 17:47:42 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-04-18 17:47:50 +0200
commit1ca71fccb13b726ae47f861a4678431bd7c51ed6 (patch)
tree6fd3f3b8b161d1b1fca470689b7e23df3149a098
parent8eaeb793617076475a6851e1f0cc74e53a1f2f96 (diff)
fix broken audio feeds, fix #508
-rw-r--r--CHANGELOG3
-rw-r--r--js/Gruntfile.coffee1
-rw-r--r--js/app/directives/audio.coffee4
-rw-r--r--js/app/filters/trusturl.coffee25
-rw-r--r--js/config/karma.js1
-rw-r--r--js/package.json4
-rw-r--r--js/public/app.js36
-rw-r--r--templates/part.items.php2
8 files changed, 70 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 7c9b8d3c9..cc6518d6e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,7 +5,8 @@ owncloud-news (2.001)
* Require ownCloud 6.0.3
* Remove html tags from feed titles
* Port to built in core App Framework and thus removing the need to install the App Framework
-* Add experimental webproxy support
+* Fix bug that would break news if a feed contains audio enclosures
+* Prepare news to work with proxies once [Simple Pie is patched](https://github.com/simplepie/simplepie/pull/360)
owncloud-news (1.808)
* Also focus article area when clicking on all unread link
diff --git a/js/Gruntfile.coffee b/js/Gruntfile.coffee
index e7b25cc6a..169fabc4f 100644
--- a/js/Gruntfile.coffee
+++ b/js/Gruntfile.coffee
@@ -57,6 +57,7 @@ module.exports = (grunt) ->
src: [
'<%= meta.build %>app/app.js'
'<%= meta.build %>app/directives/*.js'
+ '<%= meta.build %>app/filters/*.js'
'<%= meta.build %>app/controllers/*.js'
'<%= meta.build %>app/services/**/*.js'
]
diff --git a/js/app/directives/audio.coffee b/js/app/directives/audio.coffee
index f180cfbeb..3d6d94062 100644
--- a/js/app/directives/audio.coffee
+++ b/js/app/directives/audio.coffee
@@ -29,9 +29,9 @@ angular.module('News').directive 'newsAudio', ->
transclude: true
template: '' +
'<audio controls="controls" preload="none" ng-hide="cantPlay()">' +
- '<source src="{{ src }}">' +
+ '<source ng-src="{{ src|trustUrl }}">' +
'</audio>' +
- '<a href="{{ src }}" class="button" ng-show="cantPlay()" ' +
+ '<a ng-href="{{ src|trustUrl }}" class="button" ng-show="cantPlay()" ' +
'ng-transclude></a>'
link: (scope, elm, attrs) ->
source = elm.children().children('source')[0]
diff --git a/js/app/filters/trusturl.coffee b/js/app/filters/trusturl.coffee
new file mode 100644
index 000000000..d63eafd28
--- /dev/null
+++ b/js/app/filters/trusturl.coffee
@@ -0,0 +1,25 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt dev@bernhard-posselt.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+angular.module('News').filter 'trustUrl', ['$sce', ($sce) ->
+ return (url) -> $sce.trustAsResourceUrl(url)
+]
diff --git a/js/config/karma.js b/js/config/karma.js
index 4fe0db5e2..c6c983bb6 100644
--- a/js/config/karma.js
+++ b/js/config/karma.js
@@ -41,6 +41,7 @@ module.exports = function(config) {
'tests/stubs/modules.js',
'build/app/directives/*.js',
'build/app/services/**/*.js',
+ 'build/app/filters/**/*.js',
'build/app/controllers/**/*.js',
'build/tests/**/*Spec.js'
],
diff --git a/js/package.json b/js/package.json
index 3da2cbe60..0b9c906f3 100644
--- a/js/package.json
+++ b/js/package.json
@@ -27,7 +27,9 @@
"grunt-wrap": "*",
"grunt-phpunit": "*",
"karma-jasmine": "*",
- "karma-phantomjs-launcher": "*"
+ "karma-phantomjs-launcher": "*",
+ "karma-chrome-launcher": "*",
+ "karma-firefox-launcher": "*"
},
"engine": "node >= 0.8"
}
diff --git a/js/public/app.js b/js/public/app.js
index 0c94f1a57..c1c2363be 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -102,7 +102,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
type: '@'
},
transclude: true,
- template: '' + '<audio controls="controls" preload="none" ng-hide="cantPlay()">' + '<source src="{{ src }}">' + '</audio>' + '<a href="{{ src }}" class="button" ng-show="cantPlay()" ' + 'ng-transclude></a>',
+ template: '' + '<audio controls="controls" preload="none" ng-hide="cantPlay()">' + '<source ng-src="{{ src|trustUrl }}">' + '</audio>' + '<a ng-href="{{ src|trustUrl }}" class="button" ng-show="cantPlay()" ' + 'ng-transclude></a>',
link: function(scope, elm, attrs) {
var cantPlay, source;
source = elm.children().children('source')[0];
@@ -940,6 +940,40 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ownCloud - News
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt dev@bernhard-posselt.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+(function() {
+ angular.module('News').filter('trustUrl', [
+ '$sce', function($sce) {
+ return function(url) {
+ return $sce.trustAsResourceUrl(url);
+ };
+ }
+ ]);
+
+}).call(this);
+
+// Generated by CoffeeScript 1.6.3
+/*
+
+ownCloud - News
+
@author Alessandro Cosentino
@copyright 2013 Alessandro Cosentino cosenal@gmail.com
diff --git a/templates/part.items.php b/templates/part.items.php
index 799a407de..8b062b787 100644
--- a/templates/part.items.php
+++ b/templates/part.items.php
@@ -64,7 +64,7 @@
</h2>
<div class="enclosure" ui-if="item.enclosureLink">
- <news-audio type="{{ item.enclosureType }}" src="{{ item.enclosureLink }}"/><?php
+ <news-audio type="{{ item.enclosureType }}" ng-src="{{ item.enclosureLink|trustUrl }}"/><?php
p($l->t('Download'))
?></audio>
</div>