diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-01-22 16:38:04 -0500 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-01-22 16:38:04 -0500 |
| commit | 5a80b2394a4bedd1212835c6dfb00fb0300893f1 (patch) | |
| tree | 3bc26ac0a76f6cefc33805b61148e634b172e4d2 | |
| parent | 5c5a5fd83d8552de34cbe0a40d192b2443c62d83 (diff) | |
#147 - Content Security Policy and modified new directive to honor my share factory
Former-commit-id: 06a5c6cf48019d05bb0365d92670b9235a4ab8ff
| -rw-r--r-- | www/index.html | 2 | ||||
| -rw-r--r-- | www/js/app.js | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/www/index.html b/www/index.html index 487eee6f..4e5772f3 100644 --- a/www/index.html +++ b/www/index.html @@ -4,7 +4,7 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> - <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' https://www.google.com 'unsafe-inline' 'unsafe-eval'; "> + <meta http-equiv="Content-Security-Policy" content="img-src * 'self' data:; default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' https://www.google.com 'unsafe-inline' 'unsafe-eval'; "> <title></title> <meta name="format-detection" content="telephone=no"> diff --git a/www/js/app.js b/www/js/app.js index 0b289623..d0e96838 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -71,7 +71,7 @@ angular.module('zmApp', [ //credit http://stackoverflow.com/questions/20997406/force-http-interceptor-in-dynamic-ngsrc-request .directive('httpSrc', [ - '$http', function ($http) { + '$http', 'imageLoadingDataShare', function ($http, imageLoadingDataShare) { var directive = { link: link, restrict: 'A' @@ -86,6 +86,7 @@ angular.module('zmApp', [ cache: 'true' }; + imageLoadingDataShare.set(1); $http(requestConfig) .success(function(data) { var arr = new Uint8Array(data); @@ -100,7 +101,12 @@ angular.module('zmApp', [ var b64 = btoa(raw); attrs.$set('src', "data:image/jpeg;base64," + b64); - }); + imageLoadingDataShare.set(0); + }) + .error (function(data) { + attrs.$set('src', 'img/novideo.png'); + imageLoadingDataShare.set(0); + }); } } |
